lang/emacs-lisp: better imenu support; better doom fn/macro highlights; remove +emacs-lisp:byte-compile
This commit is contained in:
parent
6c06aa0ce7
commit
774f55e867
2 changed files with 22 additions and 20 deletions
|
@ -2,12 +2,6 @@
|
||||||
|
|
||||||
;; ---- emacs-lisp ---------------------------------------------------
|
;; ---- emacs-lisp ---------------------------------------------------
|
||||||
|
|
||||||
;;;###autoload (autoload '+emacs-lisp:byte-compile "lang/emacs-lisp/autoload" nil t)
|
|
||||||
(evil-define-command +emacs-lisp:byte-compile (&optional bang)
|
|
||||||
"Byte compile the current file, or if BANG, the entire emacs configuration."
|
|
||||||
(interactive "<!>")
|
|
||||||
(if bang (doom-byte-compile) (byte-compile-file buffer-file-name)))
|
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +emacs-lisp/find-function ()
|
(defun +emacs-lisp/find-function ()
|
||||||
"Jump to the definition of the function at point."
|
"Jump to the definition of the function at point."
|
||||||
|
|
|
@ -21,21 +21,29 @@
|
||||||
(add-hook 'before-save-hook 'delete-trailing-whitespace nil t)
|
(add-hook 'before-save-hook 'delete-trailing-whitespace nil t)
|
||||||
|
|
||||||
(font-lock-add-keywords
|
(font-lock-add-keywords
|
||||||
nil `(("(\\(lambda\\)" (1 (ignore (compose-region (match-beginning 1) (match-end 1) ?λ 'decompose-region))))
|
nil `(;; Display "lambda" as λ
|
||||||
("[^'](\\(\\(doom\\)\\([-:/|!][^) ]*\\)?\\)[) \n]" (1 font-lock-builtin-face))
|
("(\\(lambda\\)" (1 (ignore (compose-region (match-beginning 1) (match-end 1) ?λ 'decompose-region))))
|
||||||
;; Highlight doom macros (macros are fontified in emacs 25+)
|
;; Highlight doom/module functions
|
||||||
("[^'](\\([^ ]+!\\)"
|
("\\(^\\|\\s-\\)(\\(\\(doom\\|\\+\\)[^) ]+\\)[) \n]" (2 font-lock-builtin-face))
|
||||||
(1 font-lock-keyword-face append))
|
;; Highlight doom macros (no need, macros are fontified in emacs 25+)
|
||||||
;; Ert
|
;; ("\\(^\\|\\s-\\)(\\(@[^) ]+\\)[) \n]" (2 font-lock-preprocessor-face append))
|
||||||
("[^'](\\(ert-deftest\\) \\([^ ]+\\)"
|
))
|
||||||
(1 font-lock-keyword-face)
|
|
||||||
(2 font-lock-function-name-face))))
|
|
||||||
|
|
||||||
(dolist (i '(("Evil Command" "\\(^\\s-*(evil-define-command +\\)\\(\\_<[^ ]+\\_>\\)" 2)
|
(setq imenu-generic-expression
|
||||||
("Evil Operator" "\\(^\\s-*(evil-define-operator +\\)\\(\\_<[^ ]+\\_>\\)" 2)
|
'(("Evil Commands" "^\\s-*(evil-define-\\(?:command\\|operator\\|motion\\) +\\(\\_<[^ ()\n]+\\_>\\)" 1)
|
||||||
("Package" "\\(^\\s-*(\\(use-package\\|package\\)!? +\\)\\(\\_<[^ \n]+\\_>\\)" 3)
|
("Package" "^\\s-*(@\\(?:use-package\\|package\\) +\\(\\_<[^ ()\n]+\\_>\\)" 1)
|
||||||
("Spaceline Segment" "\\(^\\s-*(spaceline-define-segment +\\)\\(\\_<.+\\_>\\)" 2)))
|
("Settings" "^\\s-*(@def-setting +\\([^ ()\n]+\\)" 1)
|
||||||
(push i imenu-generic-expression))))
|
("Modelines" "^\\s-*(@def-modeline +\\([^ ()\n]+\\)" 1)
|
||||||
|
("Modeline Segments" "^\\s-*(@def-modeline-segment +\\([^ ()\n]+\\)" 1)
|
||||||
|
("Advice" "^\\s-*(def\\(?:\\(?:ine-\\)?advice\\))")
|
||||||
|
("Modes" "^\\s-*(define-\\(?:global\\(?:ized\\)?-minor\\|generic\\|minor\\)-mode +\\([^ ()\n]+\\)" 1)
|
||||||
|
("Macros" "^\\s-*(\\(?:cl-\\)?def\\(?:ine-compile-macro\\|macro\\) +\\([^ )\n]+\\)" 1)
|
||||||
|
("Inline Functions" "\\s-*(\\(?:cl-\\)?defsubst +\\([^ )\n]+\\)" 1)
|
||||||
|
("Functions" "^\\-s*(\\(?:cl-\\)?def\\(?:un\\*?\\|method\\|generic\\) +\\([^ )\n]+\\)" 1)
|
||||||
|
("Variables" "^\\s-*(\\(def\\(?:c\\(?:onst\\(?:ant\\)?\\|ustom\\)\\|ine-symbol-macro\\|parameter\\)\\)\\s-+\\(\\(?:\\sw\\|\\s_\\|\\\\.\\)+\\)" 2)
|
||||||
|
("Variables" "^\\s-*(defvar\\(?:-local\\)?\\s-+\\(\\(?:\\sw\\|\\s_\\|\\\\.\\)+\\)[[:space:]\n]+[^)]" 1)
|
||||||
|
("Types" "^\\s-*(\\(cl-def\\(?:struct\\|type\\)\\|def\\(?:class\\|face\\|group\\|ine-\\(?:condition\\|error\\|widget\\)\\|package\\|struct\\|t\\(?:\\(?:hem\\|yp\\)e\\)\\)\\)\\s-+'?\\(\\(?:\\sw\\|\\s_\\|\\\\.\\)+\\)" 2)
|
||||||
|
))))
|
||||||
|
|
||||||
|
|
||||||
(@after debug ;; elisp debugging
|
(@after debug ;; elisp debugging
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue