mirror of
https://github.com/correl/dotfiles.git
synced 2024-12-18 11:06:17 +00:00
[emacs] Org-mode keyword company completion
This commit is contained in:
parent
c76e77e47e
commit
84c3cfad9b
1 changed files with 22 additions and 0 deletions
|
@ -748,6 +748,28 @@ Taken from [[http://pragmaticemacs.com/emacs/wrap-text-in-an-org-mode-block/][Pr
|
|||
;;bind to key
|
||||
(define-key org-mode-map (kbd "C-<") 'org-begin-template)
|
||||
#+END_SRC
|
||||
**** Complete keywords with Company
|
||||
Taken from https://emacs.stackexchange.com/a/30691.
|
||||
|
||||
#+name: packages
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun org-keyword-backend (command &optional arg &rest ignored)
|
||||
(interactive (list 'interactive))
|
||||
(cl-case command
|
||||
(interactive (company-begin-backend 'org-keyword-backend))
|
||||
(prefix (and (eq major-mode 'org-mode)
|
||||
(cons (company-grab-line "^#\\+\\(\\w*\\)" 1)
|
||||
t)))
|
||||
(candidates (mapcar #'upcase
|
||||
(cl-remove-if-not
|
||||
(lambda (c) (string-prefix-p arg c))
|
||||
(pcomplete-completions))))
|
||||
(ignore-case t)
|
||||
(duplicates t)))
|
||||
|
||||
(add-to-list 'company-backends 'org-keyword-backend)
|
||||
(add-hook 'org-mode-hook 'company-mode)
|
||||
#+END_SRC
|
||||
**** Exporting
|
||||
***** LaTeX
|
||||
#+name: packages
|
||||
|
|
Loading…
Reference in a new issue