elisp: update macro fontification rules

This commit is contained in:
Henrik Lissner 2016-05-20 09:19:56 -04:00
parent 030cde12aa
commit 5b4117fc11
2 changed files with 15 additions and 13 deletions

View file

@ -81,19 +81,19 @@
(message "Running: %s" command) (message "Running: %s" command)
(shell-command command))) (shell-command command)))
(defmacro open-with! (id &optional app dir) (defmacro def-open-with! (id &optional app dir)
`(defun ,(intern (format "os-%s" id)) () `(defun ,(intern (format "os-%s" id)) ()
(interactive) (interactive)
(narf-open-with ,app ,dir))) (narf-open-with ,app ,dir)))
(open-with! open-in-default-program) (def-open-with! open-in-default-program)
(open-with! open-in-browser "Google Chrome") (def-open-with! open-in-browser "Google Chrome")
(open-with! reveal "Finder" default-directory) (def-open-with! reveal "Finder" default-directory)
(open-with! reveal-project "Finder" (narf/project-root)) (def-open-with! reveal-project "Finder" (narf/project-root))
(open-with! upload "Transmit") (def-open-with! upload "Transmit")
(open-with! upload-folder "Transmit" default-directory) (def-open-with! upload-folder "Transmit" default-directory)
(open-with! send-to-launchbar "LaunchBar") (def-open-with! send-to-launchbar "LaunchBar")
(open-with! send-project-to-launchbar "LaunchBar" (narf/project-root)) (def-open-with! send-project-to-launchbar "LaunchBar" (narf/project-root))
(defun os-switch-to-term () (defun os-switch-to-term ()
(interactive) (interactive)

View file

@ -37,24 +37,26 @@
(setq mode-name "Elisp") ; [pedantry intensifies] (setq mode-name "Elisp") ; [pedantry intensifies]
(font-lock-add-keywords (font-lock-add-keywords
nil `(("(\\(lambda\\)" nil `(("(\\(lambda\\)" (1 (narf/show-as )))
(1 (narf/show-as ))) ("(\\(narf\\)\\>" (1 font-lock-keyword-face append))
;; Highlight narf macros (macros are fontified in emacs 25+) ;; Highlight narf macros (macros are fontified in emacs 25+)
(,(concat (,(concat
"(\\(def-" "(\\(def-"
(regexp-opt '("electric" "project-type" "company-backend" (regexp-opt '("electric" "project-type" "company-backend"
"builder" "repl" "textobj" "tmp-excmd" "rotate" "builder" "repl" "textobj" "tmp-excmd" "rotate"
"repeat" "yas-mode" "version-cmd" "docset")) "repeat" "yas-mode" "version-cmd" "docset"
"open-with"))
"!\\)") "!\\)")
(1 font-lock-keyword-face append)) (1 font-lock-keyword-face append))
(,(concat (,(concat
"(\\(" "(\\("
(regexp-opt '("λ" "in" "map" "after" "shut-up" "add-hook" (regexp-opt '("λ" "in" "map" "after" "shut-up" "add-hook"
"associate" "open-with" "define-org-link" "associate" "define-org-link" "ex"
"define-org-section")) "define-org-section"))
"!\\)") "!\\)")
(1 font-lock-keyword-face append)) (1 font-lock-keyword-face append))
;; Ert ;; Ert
(,(concat (,(concat
"(" "("
(regexp-opt '("ert-deftest") t) (regexp-opt '("ert-deftest") t)