Search code examples
lispsyntax-highlightingemacs23

Why the function name that starts with "do-" gets highlighted in emacs?


I am using zenburn.el color-scheme in emacs 23. The function name that starts with "do-" gets highlighted, as given in the figure below --

enter image description here

How do I fix it? Any idea?


Solution

  • I do not observe this with Emacs 24.3 (the current development version). The code which would have resulted in this highlighting is commented out in lisp-mode.el:

       ;; This is too general -- rms.
       ;; A user complained that he has functions whose names start with `do'
       ;; and that they get the wrong color.
       ;; ;; CL `with-' and `do-' constructs
       ;;("(\\(\\(do-\\|with-\\)\\(\\s_\\|\\w\\)*\\)" 1 font-lock-keyword-face)
    

    So, what you need to do is:

    (dolist (s (apropos-internal "lisp.*-font-lock" #'boundp))
      (set s (cl-remove-if (lambda (l)
                             (let ((re (car l)))
                               (and (stringp re)
                                    (string-match re "do-something"))))
                           (symbol-value s))))
    

    or just edit lisp-mode.el, comment out the appropriate regexp, and rebuild.