From e43ed9381f2163a9e24ef63221b83d048520bead Mon Sep 17 00:00:00 2001 From: Marc Date: Sun, 11 Apr 2021 07:28:48 +0200 Subject: [PATCH] moved company backend functions to their corresponding packages --- init.org | 53 ++++++++++++++++++++++++++--------------------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/init.org b/init.org index 960e49a..fc97259 100644 --- a/init.org +++ b/init.org @@ -545,28 +545,6 @@ Windows Theme: (add-hook 'company-mode-hook 'company-box-mode)) #+END_SRC -** company backends - :PROPERTIES: - :ID: 4ce2e728-276d-41f9-9538-84e6e08afd8d - :END: - -#+BEGIN_SRC emacs-lisp -(defun company/org-mode-hook() - (set (make-local-variable 'company-backends) - '(company-capf company-files)) - (add-hook 'completion-at-point-functions 'pcomplete-completions-at-point nil t) - (message "company/org-mode-hook")) - -(defun company/elisp-mode-hook() - (set (make-local-variable 'company-backends) - '(company-capf company-files)) - (message "company/elisp-mode-hook")) - -(defun company/beancount-mode-hook() - (set (make-local-variable 'company-backends) - '(company-beancount))) -#+END_SRC - * orgmode ** org :PROPERTIES: @@ -578,11 +556,20 @@ Windows Theme: :mode (("\.org$" . org-mode)) :diminish org-indent-mode :defer t - :init - (add-hook 'org-mode-hook 'company/org-mode-hook) - (add-hook 'org-src-mode-hook 'smartparens-mode) - (add-hook 'org-mode-hook 'org-indent-mode) + :hook + (org-mode . my/org-company) + (org-mode . org-indent-mode) + (org-source-mode . smartparens-mode) +; :init +; (add-hook 'org-mode-hook 'company/org-mode-hook) +; (add-hook 'org-src-mode-hook 'smartparens-mode) +; (add-hook 'org-mode-hook 'org-indent-mode) :config + (defun my/org-company () + (set (make-local-variable 'company-backends) + '(company-capf company-files)) + (add-hook 'completion-at-point-functions 'pcomplete-completions-at-point nil t) + (message "company/org-mode-hook")) (setq org-modules (quote (org-id org-habit org-tempo ;; easy templates @@ -1059,7 +1046,14 @@ Manage projects and jump quickly between its files :ID: a2bc3e08-b203-49d3-b337-fb186a14eecb :END: #+BEGIN_SRC emacs-lisp - (add-hook 'emacs-lisp-mode-hook 'company/elisp-mode-hook) +(use-package elisp-mode + :defer t + :hook + (elisp-mode . my/elisp-company) + :config + (defun my/elisp-company () + (set (make-local-variable 'company-backends) + '(company-capf company-files)))) #+END_SRC ** web @@ -1231,9 +1225,14 @@ deactivate :defer t :mode ("\\.beancount$" . beancount-mode) + :hook + (beancount-mode . my/beancount-company) :init (add-hook 'beancount-mode-hook 'company/beancount-mode-hook) :config + (defun my/beancount-company () + (set (make-local-variable 'company-backends) + '(company-beancount))) (setq beancount-filename-main "/home/marc/Archiv/Finanzen/Transaktionen/transactions.beancount")) #+END_SRC