From b5cfd3afc09c25d4ea7f7c1ebbaf51c816624d45 Mon Sep 17 00:00:00 2001 From: Patrick Elliott Date: Fri, 22 Jun 2018 12:07:35 +0200 Subject: [PATCH 1/3] minor refactor of bibtex module --- modules/lang/latex/config.el | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/modules/lang/latex/config.el b/modules/lang/latex/config.el index 265529304..d4f85fe0b 100644 --- a/modules/lang/latex/config.el +++ b/modules/lang/latex/config.el @@ -171,10 +171,7 @@ (setq bibtex-completion-bibliography (list (expand-file-name +latex-bibtex-file)))) (unless (string-empty-p +latex-bibtex-dir) (setq bibtex-completion-library-path (list +latex-bibtex-dir) - bibtex-completion-pdf-field "file" - bibtex-completion-notes-path (expand-file-name "notes.org" +latex-bibtex-dir) - bibtex-completion-pdf-open-function - (lambda (fpath) (async-start-process "open-pdf" "/usr/bin/xdg-open" nil fpath)))) + bibtex-completion-notes-path (expand-file-name "notes.org" +latex-bibtex-dir))) (define-key bibtex-mode-map (kbd "C-c \\") #'bibtex-fill-entry)) @@ -194,12 +191,24 @@ (def-package! ivy-bibtex :when (featurep! :completion ivy) :commands ivy-bibtex - :config (setq ivy-bibtex-default-action 'ivy-bibtex-insert-key)) + :config + (setq ivy-bibtex-default-action 'ivy-bibtex-insert-key) + (unless (string-empty-p +latex-bibtex-file) + (setq bibtex-completion-bibliography (list (expand-file-name +latex-bibtex-file)))) + (unless (string-empty-p +latex-bibtex-dir) + (setq bibtex-completion-library-path (list +latex-bibtex-dir) + bibtex-completion-notes-path (expand-file-name "notes.org" +latex-bibtex-dir)))) (def-package! helm-bibtex :when (featurep! :completion helm) - :commands helm-bibtex) + :commands helm-bibtex + :config + (unless (string-empty-p +latex-bibtex-file) + (setq bibtex-completion-bibliography (list (expand-file-name +latex-bibtex-file)))) + (unless (string-empty-p +latex-bibtex-dir) + (setq bibtex-completion-library-path (list +latex-bibtex-dir) + bibtex-completion-notes-path (expand-file-name "notes.org" +latex-bibtex-dir)))) (def-package! company-auctex From af4fd8266f3ab8a42fb8a882ae32f6355379f2c2 Mon Sep 17 00:00:00 2001 From: Patrick Elliott Date: Fri, 22 Jun 2018 12:22:03 +0200 Subject: [PATCH 2/3] removed redundant config from latex module --- modules/lang/latex/config.el | 5 ----- 1 file changed, 5 deletions(-) diff --git a/modules/lang/latex/config.el b/modules/lang/latex/config.el index d4f85fe0b..9be62a148 100644 --- a/modules/lang/latex/config.el +++ b/modules/lang/latex/config.el @@ -167,11 +167,6 @@ (setq bibtex-dialect 'biblatex bibtex-align-at-equal-sign t bibtex-text-indentation 20) - (unless (string-empty-p +latex-bibtex-file) - (setq bibtex-completion-bibliography (list (expand-file-name +latex-bibtex-file)))) - (unless (string-empty-p +latex-bibtex-dir) - (setq bibtex-completion-library-path (list +latex-bibtex-dir) - bibtex-completion-notes-path (expand-file-name "notes.org" +latex-bibtex-dir))) (define-key bibtex-mode-map (kbd "C-c \\") #'bibtex-fill-entry)) From e88f413d4a568bb4496bc314186620cb43c307c3 Mon Sep 17 00:00:00 2001 From: Patrick Elliott Date: Tue, 26 Jun 2018 02:49:01 +0200 Subject: [PATCH 3/3] factored out setting --- modules/lang/latex/config.el | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/modules/lang/latex/config.el b/modules/lang/latex/config.el index 52bba4314..871ed8372 100644 --- a/modules/lang/latex/config.el +++ b/modules/lang/latex/config.el @@ -186,19 +186,15 @@ (def-package! ivy-bibtex :when (featurep! :completion ivy) :commands ivy-bibtex - :config - (setq ivy-bibtex-default-action 'ivy-bibtex-insert-key) - (unless (string-empty-p +latex-bibtex-file) - (setq bibtex-completion-bibliography (list (expand-file-name +latex-bibtex-file)))) - (unless (string-empty-p +latex-bibtex-dir) - (setq bibtex-completion-library-path (list +latex-bibtex-dir) - bibtex-completion-notes-path (expand-file-name "notes.org" +latex-bibtex-dir)))) + ) (def-package! helm-bibtex :when (featurep! :completion helm) :commands helm-bibtex - :config + ) + +(after! bibtex-completion (unless (string-empty-p +latex-bibtex-file) (setq bibtex-completion-bibliography (list (expand-file-name +latex-bibtex-file)))) (unless (string-empty-p +latex-bibtex-dir)