emacs-citar / citar

Emacs package to quickly find and act on bibliographic references, and edit org, markdown, and latex academic documents.
GNU General Public License v3.0
479 stars 53 forks source link

Misaligned completion suggestions with company mode #810

Closed henningninneh closed 8 months ago

henningninneh commented 8 months ago

Describe the bug The completion suggestions are not properly aligned in the second and third row.

To Reproduce Steps to reproduce the behavior:

  1. Start Emacs 29 with the minimal test configuration using emacs --init-directory=[test-directory].
  2. Open a markdown buffer or manually activate Citar.
  3. Enter a citation, starting with @.
  4. Observe misaligned suggestions (see screenshot).

Expected behavior The suggestions should be aligned and the number of spaces between the columns accordingly adjusted.

Screenshots Screenshot

Emacs version: 29.1

Additional context Minimal Emacs configuration follows. Please change the path to your reference (.bib) file accordingly

;; set up repositories

(require 'package)
(setq package-enable-at-startup nil)
(setq package-archives '(("melpa"     . "https://melpa.org/packages/")
                         ("org"       . "https://orgmode.org/elpa/")
                         ("gnu"       . "https://elpa.gnu.org/packages/"))
      )
(package-initialize)
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3") ; fixes "incomprehensible buffer" error

;; use-package

(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

;; company-mode

(use-package company
:ensure t
:bind (:map company-active-map
           ("C-n" . 'company-select-next)
           ("<tab>" . 'company-complete-common)
           ("C-p" . 'company-select-previous)
           ("<backtab>" . 'company-select-previous))
:config
(global-company-mode t)
(add-to-list 'company-backends '(company-capf
                                 company-files
                                 company-dabbrev
                                 company-dabbrev-code
                                 company-math-symbols-latex
                                 company-math-symbols-unicode))
(global-set-key (kbd "<C-tab>") 'company-complete)
(setq company-require-match nil) ;;cancel completion and continue to
                                 ;;write if input doesn't match
)

;; markdown-mode

(use-package markdown-mode
  :ensure t
  :mode
  ("README\\.md\\'" . gfm-mode)
  ("\\.Markdown" . markdown-mode)
  ("\\.MarkDown" . markdown-mode)
  ("\\.markdown" . markdown-mode)
  ("\\.md" . markdown-mode)
)

;; citar

(use-package citar
:ensure t 
:custom
(citar-bibliography '("~/cloud/misc/references.bib"))
(citar-open-entry-function 'citar-open-entry-in-zotero)
:hook
(markdown-mode . citar-capf-setup)
(org-mode . citar-capf-setup))

(use-package citar-embark
:ensure t
:after citar embark
:no-require
:config (citar-embark-mode))
bdarcus commented 8 months ago

I missed that was in company. Is it possible it's a bug there, or a configuration issue?

In the capf-only corfu, there's no such such issue, per the screenshot on the README.

henningninneh commented 8 months ago

I see. It's a configuration issue. Thanks for the pointer!

(setq company-tooltip-align-annotations t) does the trick. See here.