1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00
Commit graph

10391 commits

Author SHA1 Message Date
Eshel Yaron
73feb431b3
; elisp-mode.el: Improve consistency among face names.
Rename a couple of faces to solidify the convention that the
face name 'elisp-foo' implies "references to foo", not "foo
definitions".  For definitions we use 'elisp-deffoo' if foo is
only one word, or 'elisp-bar-baz-definition' otherwise.

* lisp/progmodes/elisp-mode.el (elisp-function-reference):
Rename to 'elisp-function'.
(elisp-macro-call): Rename to 'elisp-macro'.
(elisp-non-local-exit):
(elisp-unknown-call):
(elisp-special-form):
* lisp/emacs-lisp/elisp-scope.el:
* test/lisp/progmodes/elisp-mode-resources/semantic-highlighting.el:
Update references to renamed faces.
2025-10-12 10:33:58 +02:00
Eshel Yaron
026f3bbd8d
; elisp-scope.el: Clean up symbol role definitions.
* lisp/progmodes/elisp-mode.el (elisp-fontify-semantically):
Fix typo in doc string.
(elisp--annotate-symbol-with-help-echo): Accept plain string
as value of ':help' symbol role property.
* lisp/emacs-lisp/elisp-scope.el: Remove unused symbol role
properties from all defined symbol roles.  Use plain strings
for ':help' instead of wrapping them with 'cl-constantly'.
Cease 'require'ing 'cl-lib', no longer needed in runtime.
(elisp-scope-define-symbol-role): Update doc string.
2025-10-12 10:17:00 +02:00
Eshel Yaron
0d7fc4516c
Document 'elisp-fontify-semantically' in the Emacs manual
* doc/emacs/display.texi (Semantic Font Lock): New node.
* doc/emacs/emacs.texi: Update menu.
* etc/NEWS: Update relevant entry.
* lisp/emacs-lisp/elisp-scope.el: Expand commentary.
* doc/misc/elisp-semantic-highlighting.org: Delete it.
2025-10-11 14:25:45 +02:00
Eshel Yaron
e7df895c2e
; (elisp-scope-if-let): Fix case where bindings entry is a symbol
* lisp/emacs-lisp/elisp-scope.el (elisp-scope-if-let): Fix
handling of a plain symbol as one the bindings in an
'if-let*' form, as in (if-let* (foo) 'bar).

* test/lisp/progmodes/elisp-mode-resources/semantic-highlighting.el:
Test it.
2025-10-08 18:18:56 +02:00
Eshel Yaron
240bf0679c
; * lisp/emacs-lisp/elisp-scope.el (if-let*): Add comment. 2025-10-08 15:47:27 +02:00
Eshel Yaron
61caa91875
; elisp-scope.el: Fix 'wrong-type-argument' in local function analyzers
* lisp/emacs-lisp/elisp-scope.el
(elisp-scope--local-function-analyzer): New function.
(elisp-scope-flet, elisp-scope-labels)
(elisp-scope-named-let): Use it.
(elisp-scope-cl-macrolet): Check that argument is
'symbol-with-pos-p' before calling 'symbol-with-pos-pos'.
2025-10-08 00:13:34 +02:00
Eshel Yaron
94d314d756
; elisp-scope.el: Fix handling of 'if-let' and friends
* lisp/emacs-lisp/elisp-scope.el (elisp-scope-if-let): New
function, used to analyze 'if-let*' forms.
2025-10-07 23:48:38 +02:00
Eshel Yaron
fddc5f664e
; Rename 'elisp-scope--local' to 'elisp-scope-local-bindings'
We make this variable "public" since it's part of the interface that we
expose to custom analyzers.
2025-10-06 16:57:32 +02:00
Eshel Yaron
8dccb56662
; Drop 'elisp-scope-local-functions'
* lisp/emacs-lisp/elisp-scope.el
(elisp-scope-local-functions): Remove it, superseded by
'elisp-scope-local-definitions'.
(elisp-scope-sharpquote, elisp-scope-1): Update accordingly.
(elisp-scope-analyze-form): Fix typo in docstring.
2025-10-06 12:38:28 +02:00
Eshel Yaron
177658f068
; elisp-scope.el: Drop special-form special handling
* lisp/emacs-lisp/elisp-scope.el (elisp-scope-1): All
special-forms should have an associated analyzer, so drop
fallback handling for unknown special-forms.
2025-10-06 11:02:55 +02:00
Eshel Yaron
81c5399012
; Test semantic highlighting with 'cl-macrolet' and 'cl-flet' 2025-10-06 11:00:03 +02:00
Eshel Yaron
ec7b376dd4
elisp-scope.el: Unify and generalize local function/macro handling
* lisp/emacs-lisp/elisp-scope.el
(elisp-scope-local-definitions): New variable.  Replaces...
(elisp-scope-flet-alist, elisp-scope-macrolet-alist): these.
Removed, no longer used.
(elisp-scope-1, elisp-scope--handle-quoted): Update.
(elisp-scope-with-local-definition): New macro.
(elisp-scope-flet, elisp-scope-labels, elisp-scope-named-let)
(elisp-scope-cl-macrolet): Use it.
2025-10-06 10:54:21 +02:00
Eshel Yaron
dfb10509a4
; elisp-scope.el: Thread output spec though more macro analyzers
* lisp/emacs-lisp/elisp-scope.el (elisp-scope-flet)
(elisp-scope-labels, elisp-scope-cl-macrolet): Add argument
'outspec' and pass it down to 'elisp-scope-n'.
2025-10-06 10:32:59 +02:00
Eshel Yaron
7fc85f8dec
; elisp-scope.el: Recognize special variable declarations
* lisp/emacs-lisp/elisp-scope.el
(special-variable-declaration): New symbol role.
(defvar): Update analyzer to distinguish between
declarations and definitions.
(defconst): Add a separate analyzer.
* lisp/progmodes/elisp-mode.el
(elisp-special-variable-declaration): New face.
2025-10-06 10:27:09 +02:00
Eshel Yaron
3c645f3e62
; (elisp-scope-define-special-form-analyzer): Fix typo. 2025-10-03 21:19:51 +02:00
Eshel Yaron
f8b8b9edc8
; (elisp-scope-describe-symbol-role): Minor clean up. 2025-10-03 19:49:15 +02:00
Eshel Yaron
f269531255
; elisp-scope.el: Support hooking into `describe-symbol-backends'.
* lisp/emacs-lisp/elisp-scope.el
(elisp-scope-add-symbol-roles-to-describe-symbol): New
autoloaded function intended for user configs, hooks
`elisp-scope-describe-symbol-role' into `describe-symbol'.
2025-10-03 19:47:27 +02:00
Eshel Yaron
efa5b73044
; (elisp-scope-1): Add a "TODO". 2025-10-03 19:15:21 +02:00
Eshel Yaron
90e65c2abe
; (elisp-scope-gen-id-alist): Remove, unused. 2025-10-03 19:15:15 +02:00
Eshel Yaron
c412bd83ff
; elisp-scope.el: Fix 'custom-declare-face' analyzer. 2025-10-03 19:11:26 +02:00
Eshel Yaron
320df8ad35
; elisp-scope.el: Improve 'oclosure-define' 'slots' analysis 2025-10-03 19:10:51 +02:00
Eshel Yaron
bde38ef480
; Rename 'elisp-scope-output-type' to 'elisp-scope-output-spec'.
* lisp/emacs-lisp/elisp-scope.el: Change all references to
this notion of "type" to say "spec" instead.
2025-10-03 18:24:35 +02:00
Eshel Yaron
22327f58bb
; elisp-scope.el: Improve 'defclass' slots analysis.
Extend the "type" system (to be renamed to "spec" in
subsequent commit) of elisp-scope.el with a plist spec.
This allows us to define a spec for the 'slots' argument of
'eieio-defclass-internal'.  Also add a 'cl-type' spec,
describing the type specifications used by 'cl-typep', and
replace the 'equal' spec with a more general 'member' spec,
like we have in 'cl-typep'.
2025-10-03 18:17:34 +02:00
Eshel Yaron
5339cf0010
; Rename 'elisp-scope--output-type' to make it public
* lisp/emacs-lisp/elisp-scope.el (elisp-scope--output-type):
Add docstring and rename to...
(elisp-scope-output-type): this.  Update all references.
* lisp/emacs-lisp/elisp-scope.el (elisp-scope-analyze-form):
Add example 'elisp-scope-analyzer' to docstring.
2025-10-02 16:44:32 +02:00
Eshel Yaron
ceeeb390f0
; (elisp-scope-1): Analyze macros with (debug t) as progn
Take an Edebug spec of t as an indication that all of the
macro's arguments are evaluated, and analyze them as such.
Only do so as a fallback for macros that we cannot expand,
because expanding can lead to more accurate analysis,
e.g. with regards to the output type of the form.
2025-10-02 15:22:51 +02:00
Eshel Yaron
cfc58025cd
; Expand ELisp semantic highlighting documentation
* lisp/emacs-lisp/elisp-scope.el
(elisp-scope-get-symbol-role-property)
(elisp-scope-set-symbol-role-property)
(elisp-scope-safe-macro-p, elisp-scope-report-s)
(elisp-scope-1, elisp-scope-n): Add docstring.
(elisp-scope-analyze-form):
* lisp/progmodes/elisp-mode.el (elisp-fontify-semantically):
Expand docstring.
* etc/NEWS: Refer to 'elisp-fontify-semantically' for
documentation.
2025-10-02 14:41:45 +02:00
Eshel Yaron
e82620a360
; elisp-scope.el: Rename 'variable' role to 'free-variable'. 2025-10-01 13:18:55 +02:00
Eshel Yaron
737d99e4ed
; Fix recent small mistake in recent refactor. 2025-10-01 12:58:31 +02:00
Eshel Yaron
c2d01dda42
; elisp-scope.el: Simplify 'eval' analyzer. 2025-10-01 08:56:55 +02:00
Eshel Yaron
3cff47ec75
; elisp-scope.el: Rename 'declaration' role.
* lisp/emacs-lisp/elisp-scope.el (declaration): Rename to
'function-property-declaration'.
(elisp-scope-lambda):
* lisp/progmodes/elisp-mode.el
(elisp-function-property-declaration): Update accordingly.
2025-10-01 08:42:40 +02:00
Eshel Yaron
a7c1b126fa
; elisp-scope.el: Remove unused 'undefined-macro' role. 2025-10-01 08:37:44 +02:00
Eshel Yaron
7217350e85
; elisp-scope.el: Fix 'define-completion-category' handler. 2025-10-01 08:34:58 +02:00
Eshel Yaron
23ba18037b
; (elisp-scope-define-symbol-role): Add docstring. 2025-10-01 08:31:20 +02:00
Eshel Yaron
2447c1486e
; Call it "symbol role" instead of "symbol type".
Change the terminology used in elisp-scope.el to call the
symbols we use to categorizes the use of (other) symbols
"symbol roles" instead of "symbol types".

* lisp/emacs-lisp/elisp-scope.el:
* lisp/progmodes/elisp-mode.el: Change all occurrences of
"symbol type" say "role" instead.
2025-10-01 08:09:06 +02:00
Eshel Yaron
8c2f783591
(elisp-scope-get-symbol-type-property): Revise inheritance handling. 2025-10-01 07:48:58 +02:00
Eshel Yaron
409abfe96e
; (elisp-scope-define-symbol-type): Cease autoloading it. 2025-09-30 19:05:21 +02:00
Eshel Yaron
3ebd0efd09
; elisp-scope.el: Update multiple function handlers.
Update all remaining function handlers to use
'elisp-scope-define-func-analyzer' instead of
'elisp-scope-define-function-analyzer'.  The difference is
that the former handles all arguments explicitly, while the
latter analyzes all arguments as evaluated forms
automatically.  By handling the arguments explicitly, we get
a chance to specify the expected type of different arguments.
Lastly, since 'elisp-scope-define-function-analyzer' is now
unused, rename 'elisp-scope-define-func-analyzer' to
'elisp-scope-define-function-analyzer'.
2025-09-30 18:58:23 +02:00
Eshel Yaron
c6ee775cb2
; Rename scope.el to elisp-scope.el
* scope.el: Rename it to...
* elisp-scope: New file.
* lisp/progmodes/elisp-mode.el: Update accordingly.
2025-09-29 17:02:25 +02:00
Eshel Yaron
761e706505
; scope.el: Mark 'static-when/unless' as unsafe.
* lisp/emacs-lisp/scope.el: Add handlers for 'static-when'
and 'static-unless'.
(scope-unsafe-macros): Also add them to list of unsafe macros.
2025-09-29 16:42:35 +02:00
Eshel Yaron
136c39438f
Add optional semantic highlighting for Emacs Lisp.
* lisp/emacs-lisp/scope.el: New file.

* lisp/progmodes/elisp-mode.el (elisp): New 'defgroup'.
(elisp-add-help-echo, elisp-fontify-semantically)
(elisp-fontify-symbol-precedence-function): New options.
(elisp-symbol-at-mouse, elisp-free-variable, elisp-condition)
(elisp-major-mode-name, elisp-face, elisp-symbol-type)
(elisp-symbol-type-definition, elisp-function-reference)
(elisp-non-local-exit, elisp-unknown-call, elisp-macro-call)
(elisp-special-form, elisp-throw-tag, elisp-feature)
(elisp-rx, elisp-theme, elisp-binding-variable)
(elisp-bound-variable, elisp-shadowing-variable)
(elisp-shadowed-variable, elisp-variable-at-point)
(elisp-warning-type, elisp-declaration, elisp-thing)
(elisp-slot, elisp-widget-type, elisp-type, elisp-group)
(elisp-nnoo-backend, elisp-ampersand, elisp-constant)
(elisp-defun, elisp-defmacro, elisp-defvar, elisp-defface)
(elisp-icon, elisp-deficon, elisp-oclosure)
(elisp-defoclosure, elisp-coding, elisp-defcoding)
(elisp-charset, elisp-defcharset, elisp-completion-category)
(elisp-completion-category-definition): New faces.
(elisp-local-references, elisp-highlight-variable)
(elisp-unhighlight-variable, elisp-cursor-sensor)
(elisp--function-help-echo, elisp--help-echo-1)
(elisp--help-echo, elisp--annotate-symbol-with-help-echo)
(elisp-extend-region-to-whole-defuns, elisp-fontify-symbol)
(elisp-fontify-region-semantically, elisp-fontify-region):
New functions.
(emacs-lisp-mode): Set 'font-lock-extra-managed-props',
'font-lock-fontify-region-function' and
'font-lock-extend-region-functions'.

* etc/NEWS: Announce new feature.
2025-09-29 15:30:35 +02:00
Stefan Monnier
2c7b08d417 Revert "Fix generation of defvars defined by easy-mmode and company in loaddefs.el"
This reverts commit e9800cabff.
AFAICT that commit had no effect but it re-introduces some magic constants
in the code that we'd like to eliminate.
We presume it was a misunderstanding, trying to fix
a transient problem which a bootstrap would have fixed.
See https://lists.gnu.org/archive/html/emacs-devel/2025-08/msg00716.html
and https://lists.gnu.org/archive/html/emacs-devel/2025-09/msg00109.html
2025-09-16 10:50:14 -04:00
Eli Zaretskii
83b623ea3a Fix 'define-globalized-minor-mode' when :variable is used
* lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode):
Fix a typo (bug#79412).
2025-09-13 22:23:12 +03:00
Eli Zaretskii
d02181e39f ; * lisp/emacs-lisp/ring.el (ring-convert-sequence-to-ring): Bug#79330. 2025-09-13 12:06:35 +03:00
Philip Kaludercic
4c27866df9
; * lisp/emacs-lisp/timeout.el: Bump version header to 2.1
This is done to reflect the same version as in the upstream
repository, thus avoiding accidental upgrades:

6d31046c5b
2025-09-12 12:35:56 +02:00
Philip Kaludercic
0bf5898f20
Update timeout to 2f3ebb53
See https://github.com/karthink/timeout/commit/f3ebb5.
2025-09-11 23:25:46 +02:00
Mattias Engdegård
f4d0a2560a Remove unused and broken source inline code path
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand): We can
assume that non-compiled functions are from another file at this point
and remove an unused code branch which didn't actually work with
interpreted function objects anyway.
2025-09-10 12:11:53 +02:00
Stefan Monnier
82f6c16514 Allow use of \N{...} earlier to help fix bug#79353
* lisp/emacs-lisp/shorthands.el (hack-read-symbol-shorthands):
Avoid inf-loops during bootstrap.
E.g. this can occur while loading `uni-special-lowercase.el` where
`hack-local-variables--find-variables` uses `downcase` which triggers
loading `uni-special-lowercase.el`, ...

* lisp/international/mule-cmds.el (ucs-names): Explicitly require
`charprop`.

* src/Makefile.in ($(lispsource)/loaddefs.el): Depend on `charprop`.
2025-09-09 18:01:24 -04:00
Stefan Monnier
4c74b68fb1 (cl--make-usage-args): Try and fix bug#79353
* lisp/emacs-lisp/cl-macs.el (cl--make-usage-args): Don't depend on
`cl-extra` when `take` does the job.
2025-09-08 12:39:48 -04:00
Mattias Engdegård
a4ea22d998 * lisp/emacs-lisp/cl-lib.el (cl-copy-list): Not error-free, bug#79396 2025-09-07 17:47:51 +02:00
Eli Zaretskii
4ac9e93e5e Merge from origin/emacs-30
aad5b676d1 ; * lisp/emacs-lisp/ring.el (ring-convert-sequence-to-rin...
ddd63891a4 ; * doc/misc/flymake.texi (Troubleshooting): Fix typo (bu...
8dcb802046 ; vc-hooks.el: Standardize terminology in header.
2025-09-06 05:53:08 -04:00