chiark / gitweb /
el/dot-emacs (mdw-fontify-rust): Defeat doc-comment highlighting properly.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 12 Sep 2024 12:14:49 +0000 (13:14 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 28 Sep 2024 10:04:29 +0000 (11:04 +0100)
I don't want to highlight documentation comments differently from
ordinary comments.  I noticed, back in 77ccc2aa..., that this was done
using `font-lock-syntactic-face-function, and decided to force that to
`nil'.  I was right about the cause, but so wrong about the solution.

If the variable is `nil', then you just get errors about trying to apply
`nil'.  There is a default value, which selects `string' or `comment'
based on the `parse-partial-sexp' state, but for some stupid reason this
default is just a lambda expression in the `defvar' form rather than
having a name like `font-lock-default-syntactic-face-function' or
something.

Override the Rust-mode choice with the default (which isn't doing
anything other than the doc-comment highlighting behaviour that I don't
want) with the default.

el/dot-emacs.el

index fddcf78e3530de243737e63d426d639128a48def..911226b4513df7fae6d540285e350c095563325e 100644 (file)
@@ -3389,7 +3389,8 @@ (defun mdw-fontify-rust ()
             ;; And anything else is punctuation.
             (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)"
                   '(0 mdw-punct-face)))
             ;; And anything else is punctuation.
             (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)"
                   '(0 mdw-punct-face)))
-           font-lock-syntactic-face-function nil))
+         font-lock-syntactic-face-function
+           (default-value 'font-lock-syntactic-face-function)))
 
   ;; Hack key bindings.
   (local-set-key [?{] 'mdw-self-insert-and-indent)
 
   ;; Hack key bindings.
   (local-set-key [?{] 'mdw-self-insert-and-indent)