mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2026-09-10 07:46:51 -04:00
Allow setting font-lock-keyword property using declare form
* doc/lispref/functions.texi (Declare Form): Document 'font-lock-keyword' meta property. * etc/NEWS: Announce addition of 'font-lock-keyword' meta property. * lisp/emacs-lisp/byte-run.el (byte-run--set-font-lock-keyword): New function. * (defun-declarations-alist): Add entry for 'font-lock-keyword', using 'byte-run--set-font-lock-keyword'. * (with-no-warnings): Set 'font-lock-keyword' meta property.
This commit is contained in:
parent
67eb1ee26e
commit
5210b89cfa
|
|
@ -2924,6 +2924,11 @@ original signature to avoid these issues.
|
|||
This is valid for macros only. Macros with this declaration are
|
||||
highlighted by font-lock (@pxref{Font Lock Mode}) as normal functions,
|
||||
not specially as macros.
|
||||
|
||||
@item font-lock-keyword
|
||||
Normal functions with this declaration are highlighted by font-lock
|
||||
(@pxref{Font Lock Mode}) like macros.
|
||||
|
||||
@end table
|
||||
|
||||
@end defmac
|
||||
|
|
|
|||
8
etc/NEWS
8
etc/NEWS
|
|
@ -467,6 +467,7 @@ Emacs 30. It allows Lisp programs that present completion candidates
|
|||
("completion frontends") to provide additional information which can be
|
||||
used to adjust or optimize completion candidates computation.
|
||||
|
||||
+++
|
||||
** D-Bus
|
||||
|
||||
+++
|
||||
|
|
@ -508,6 +509,13 @@ the actual and expected output.
|
|||
Strings should use numeric abbreviations like "-0600" instead of
|
||||
alphabetic abbreviations like "CST", which are too often ambiguous.
|
||||
|
||||
** Function 'declare' forms
|
||||
|
||||
+++
|
||||
*** New 'font-lock-keyword' function declaration
|
||||
The declaration '(font-lock-keyword t)' specifies that a normal
|
||||
functions is to be highlighted by font-lock a macros.
|
||||
|
||||
|
||||
* Changes in Emacs 32.1 on Non-Free Operating Systems
|
||||
|
||||
|
|
|
|||
|
|
@ -252,6 +252,11 @@ declaration" f2 f))
|
|||
(let ((code (apply fn args)))
|
||||
(list 'progn ':autoload-end code)))))
|
||||
|
||||
(defalias 'byte-run--set-font-lock-keyword
|
||||
#'(lambda (name _args val)
|
||||
(list 'function-put (list 'quote name)
|
||||
''font-lock-keyword (list 'quote val))))
|
||||
|
||||
;; Add any new entries to info node `(elisp)Declare Form'.
|
||||
(defvar defun-declarations-alist
|
||||
(list
|
||||
|
|
@ -276,7 +281,8 @@ If `error-free', drop calls even if `byte-compile-delete-errors' is nil.")
|
|||
(list 'completion #'byte-run--set-completion)
|
||||
(list 'modes #'byte-run--set-modes)
|
||||
(list 'interactive-args #'byte-run--set-interactive-args)
|
||||
(list 'ftype #'byte-run--set-function-type))
|
||||
(list 'ftype #'byte-run--set-function-type)
|
||||
(list 'font-lock-keyword #'byte-run--set-font-lock-keyword))
|
||||
"List associating function properties to their macro expansion.
|
||||
Each element of the list takes the form (PROP FUN) where FUN is
|
||||
a function. For each (PROP . VALUES) in a function's declaration,
|
||||
|
|
@ -707,7 +713,7 @@ enabled."
|
|||
|
||||
(defun with-no-warnings (&rest body)
|
||||
"Like `progn', but prevents compiler warnings in the body."
|
||||
(declare (indent 0))
|
||||
(declare (indent 0) (font-lock-keyword t))
|
||||
;; The implementation for the interpreter is basically trivial.
|
||||
(car (last body)))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue