summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2015-10-02 17:25:40 +0300
committerAlex Kost <alezost@gmail.com>2015-10-09 16:17:44 +0300
commit88908d55e0ce020f9cbdfc2a505b27f43a863554 (patch)
treef8c9f38977cc8e459f8aa95f6917593d75643979
parent1af9815d81090e10a0f89596482e572dc59e454b (diff)
downloadguix-88908d55e0ce020f9cbdfc2a505b27f43a863554.tar.gz
emacs: devel: Fix 'modify-phases' highlighting.
* emacs/guix-devel.el (guix-devel-modify-phases-font-lock-pre): Handle
  the case when 'modify-phases' is commented.
-rw-r--r--emacs/guix-devel.el8
1 files changed, 6 insertions, 2 deletions
diff --git a/emacs/guix-devel.el b/emacs/guix-devel.el
index 2e85a7edae..1f760b6ee5 100644
--- a/emacs/guix-devel.el
+++ b/emacs/guix-devel.el
@@ -132,8 +132,12 @@ This function is used as a MATCHER for `font-lock-keywords'."
   "Skip the next sexp, and return the end point of the current list.
 This function is used as a PRE-MATCH-FORM for `font-lock-keywords'
 to find 'modify-phases' keywords."
-  (ignore-errors (forward-sexp))
-  (save-excursion (up-list) (point)))
+  (let ((in-comment? (nth 4 (syntax-ppss))))
+    ;; If 'modify-phases' is commented, do not try to search for its
+    ;; keywords.
+    (unless in-comment?
+      (ignore-errors (forward-sexp))
+      (save-excursion (up-list) (point)))))
 
 (defvar guix-devel-font-lock-keywords
   `((,(rx (or "#~" "#$" "#$@" "#+" "#+@")) .