Commit graph

179989 commits

Author SHA1 Message Date
Yuan Fu
b5c290cfbd
Revert "Use cached compiled tree-sitter queries for range settings"
This reverts commit e28ec76271.

* lisp/treesit.el (treesit-range-rules): Use treesit-query-compile.
2025-10-30 19:15:40 -07:00
Steven Allen
b0eaaf7366 More reliably check if a frame is the daemon's initial frame
Frames created when Emacs is running as a daemon may not have the
"client" frame parameter set, e.g., when:

1. Created from the user's init file.
2. Created via "emacsclient -e" (e.g., "emacsclient -e '(make-frame)'").

The "client" parameter simply indicates that the frame was created by
emacsclient directly (or recursively from another emacsclient frame).

Instead, this commit checks if (a) Emacs is running as a daemon and (b)
the target frame is the "terminal frame".  When run as a daemon, Emacs's
terminal frame is always the daemon's initial frame.

* lisp/desktop.el (desktop-clear):
(desktop-restoring-frameset-p):
* lisp/display-fill-column-indicator.el
(display-fill-column-indicator--turn-on):
* lisp/frame.el (frame-notice-user-settings):
* lisp/obsolete/linum.el (linum-on):
* lisp/progmodes/flymake.el (flymake-start):
* lisp/tab-bar.el (tab-bar--update-tab-bar-lines): Fix the "is this the
initial daemon-frame" checks.  (Bug#79686)
2025-10-30 20:27:19 +02:00
Spencer Baugh
97d2a659e8 Optimize PCM regex to not contain adjacent wildcards
When multiple wildcards occur in a PCM pattern,
completion-pcm--pattern->regex previously would generate one
instance of [^z-a]* for each of those wildcards, even if the
wildcards were adjacent and could therefore be matched by a
single [^z-a]*.  This can make regex matching performance much
worse.  For example, with a minibuffer containing "*/" with
point at the start, completion-pcm-all-completions would take
several seconds to match in project-find-file in the Emacs repo.

Now, we run completion-pcm--pattern->segments on the pattern
first, which adds additional structure to the pattern, including
consolidating adjacent regexes into a single sublist.  Then
completion-pcm--segments->regex generates a single regex
wildcard for each of those pattern wildcards.  As a consequence,
we need to update the callers of completion-pcm--pattern->regex
which pass non-nil GROUP.  This provides a substantial
performance improvement in various edge cases.

* lisp/minibuffer.el (completion-pcm--pattern->segments)
(completion-pcm--segments->regex): Add.  (bug#79693)
(completion-pcm--pattern->regex)
(completion-pcm--merge-completions): Call pattern->segments and
segments->regex.
(completion-pcm--pattern-point-idx): Delete.
(completion-pcm--segments-point-idx): Add.
(completion-pcm--hilit-commonality): Call
completion-pcm--segments-point-idx to find the submatch
containing point.
* test/lisp/minibuffer-tests.el (completion-pcm-test-5): Add
more tests of highlighting the first difference.
(completion-pcm-test-pattern->regex): Add tests showing the
regex form of PCM patterns.
2025-10-30 19:24:51 +02:00
Eli Zaretskii
1f00179df9 ; Document how to search for raw bytes
* doc/emacs/search.texi (Regexps):
* doc/lispref/searching.texi (Regexp Special): Document how to
search for raw bytes.  (Bug#79724)
2025-10-30 16:39:43 +02:00
Mattias Engdegård
aeac24349a ; * lisp/subr.el (version-to-list): Completely wrong indentation. 2025-10-30 13:29:32 +01:00
Mattias Engdegård
8da4072344 * lisp/emacs-lisp/range.el (range-add-list): Don't mutate argument.
It's clear from the doc strings that this function isn't meant
to mutate its arguments.
2025-10-30 12:12:35 +01:00
Mattias Engdegård
676ee88eea Faster constant pool string searching
* lisp/emacs-lisp/bytecomp.el (byte-compile-get-constant):
No reason not to use 'assoc' to search for strings as well.
Previously we kept searching even after having found the string!
2025-10-30 12:12:35 +01:00
Mattias Engdegård
305744fdfc Define compiler macros for /=, atom and nlistp
Calls to these functions were previously rewritten in terms of other
functions both in the optimiser and during codegen, for no good reason.

This also resulted in poor diagnostics: wrong-arity calls to 'atom' and
'nlistp' produced doubled but slightly-different warnings, and no
warnings at all for '/='.

Using compiler macros fixes the problems.  The generated code is the same.

* lisp/emacs-lisp/bytecomp.el (byte-compile-negated)
(byte-compile-negation-optimizer): Replace with...
(bytecomp--define-negated): ...this compiler macro defining macro.
2025-10-30 12:12:35 +01:00
Mattias Engdegård
85e1a64943 Fix numeric comparison bug when optimisation is disabled
* lisp/emacs-lisp/bytecomp.el (byte-compile-cmp):
Don't assume that N-ary comparisons have been normalised, which is done
in the optimiser.  Reported by Pip Cet.
2025-10-30 12:12:35 +01:00
Mattias Engdegård
0fb8ed8c71 Remove unused byte-compile-eval-before-compile
* lisp/emacs-lisp/bytecomp.el (byte-compile-eval-before-compile):
This function has been unused since 2012 (e703069f9c).
2025-10-30 12:12:35 +01:00
Eli Zaretskii
cb3962138f ; Fix typos and wording of recently-modified doc strings
* lisp/treesit.el (treesit-query-range-by-language)
(treesit-range-rules): Doc fixes.
2025-10-30 08:35:29 +02:00
Protesilaos Stavrou
06b3f11cb8
Make 'link' not inherit 'button' in modus-themes.el (bug#79672)
* etc/themes/modus-themes.el (modus-themes-faces): Apply the
  font attributes directly.
2025-10-30 07:51:19 +02:00
Yuan Fu
9e8557fe85
Skip unknown language for code block in markdown-ts-mode (bug#79670)
* lisp/textmodes/markdown-ts-mode.el:
(markdown-ts--convert-code-block-language): Return nil if the
langauge doesn't have a corresponding major mode in
markdown-ts-code-block-source-mode-map.
2025-10-29 21:25:23 -07:00
Yuan Fu
9f468fd6eb
Tree-sitter range language function can return nil (bug#79670)
* lisp/treesit.el (treesit-query-range-by-language): Allow
LANGUAGE-FN to return nil.
(treesit-range-rules): Update docstring.
2025-10-29 21:09:46 -07:00
Yuan Fu
e28ec76271
Use cached compiled tree-sitter queries for range settings
* lisp/treesit.el (treesit-range-rules): Use
treesit--compile-query-with-cache.
2025-10-29 21:09:32 -07:00
Stefan Monnier
905f3d0a8a lisp/custom.el (custom-set-minor-mode): Load the mode more lazily 2025-10-29 14:35:24 -04:00
Eli Zaretskii
96cde6cdd4 Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs 2025-10-29 19:27:37 +02:00
Eli Zaretskii
1472f8241d ; * src/xfaces.c (face_inheritance_cycle): More defensive code. 2025-10-29 19:26:40 +02:00
Eshel Yaron
330aa07f00
; elisp-scope.el: Improve face specification handling.
Replace the use of 'elisp-scope-face(-1)' for analyzing face
specifications with 'elisp-scope-1' calls with an
appropriate OUTSPEC argument.  This allows us to analyze
face specifications even when they are not passed directly
to relevant functions, but rather appear in a tail position
of a form that evaluates to a face specification.

* lisp/emacs-lisp/elisp-scope.el
(elisp-scope--match-spec-to-arg): Add new 'face' spec.
Use it instead of...
(elisp-scope-face, elisp-scope-face-1): ...these functions.
Remove them, no longer used.

* test/lisp/progmodes/elisp-mode-resources/semantic-highlighting.el:
Add test.
2025-10-29 17:20:03 +01:00
Eshel Yaron
b9aa420bc4
; elisp-scope.el: Simplify 'custom-declare-face' analyzer. 2025-10-29 16:32:14 +01:00
Michael Albinus
8c7b4391a5 Adapt `tramp-test49-external-backend-function'
* test/lisp/net/tramp-tests.el (tramp-test49-external-backend-function):
Extend test.
2025-10-29 09:19:58 +01:00
Michael R. Mauger
f0f6fa3b68 lisp/comint.el: Fix `comint-write-input-ring' context
(comint-write-input-ring): Use `comint-input-ring-separator' in the
context of the caller, not the output buffer
2025-10-28 23:44:44 -04:00
F. Jason Park
44cdb65cf3 Fix regression involving erc-channel-user accessors
* etc/ERC-NEWS: New section for ERC 5.6.2 and new entry mentioning
slight change in `erc-channel-user' accessor behavior.
* lisp/erc/erc-common.el (erc-channel-user): Change type for status slot
to natnum from integer.
* lisp/erc/erc.el (erc-channel-user-signal-if-status-unknown): New
variable.
(erc--define-channel-user-status-compat-getter): Only use fallback in
Non-ERC buffers because "obviously" a status flag is unusable if the
server doesn't advertise it or, rather, advertises nonsupport via its
absence.  This regression was introduced in ERC 5.6.
(erc-channel-begin-receiving-names): Sharp-quote function name.
(erc--get-prefix-flag): Mention in doc that a return value of nil can
also mean the status flag is not supported by the server.
* test/lisp/erc/erc-tests.el (erc--parsed-prefix): Show that it returns
nil in a non-ERC buffer.
(erc-tests--make-combinations)
(erc-tests--with-channel-user-status-accessors): New functions.
(erc-channel-user/status-accessors/solo/default)
(erc-channel-user/status-accessors/solo/ov)
(erc-channel-user/status-accessors/multi/default)
(erc-channel-user/status-accessors/multi/ov): New tests.
(Bug#67220)
2025-10-27 19:29:44 -07:00
F. Jason Park
2fa768dd4b Change ERC version to 5.6.2-git
* doc/misc/erc.texi: Change ERCVER to 5.6.2.
* lisp/erc/erc.el (erc-version): Change working version to 5.6.2-git.
Do the same for the package Version header and the
`customize-package-emacs-version-alist' mapping.
2025-10-27 19:28:43 -07:00
Sean Whitton
3dc022a023 New delete-revision VC backend API function (bug#79408)
* lisp/vc/vc-git.el (vc-git--assert-revision-on-branch): New
function, factored out.
(vc-git-revision-published-p): Use it.
(vc-git-delete-revision):
* lisp/vc/vc-hg.el (vc-hg-delete-revision): New functions.
* lisp/vc/vc.el: Specify delete-revision backend API function
(bug#79408).
2025-10-27 21:12:56 +00:00
Sean Whitton
bf02d7e19b vc-log-incoming, vc-log-outgoing: Pass nil UPSTREAM-LOCATION
This should have been updated along with the recent change to
make the UPSTREAM-LOCATION argument to the incoming-revision
backend API function optional.

* lisp/vc/vc.el (vc-log-incoming, vc-log-outgoing): Pass nil,
not the empty string, as the default UPSTREAM-LOCATION.
2025-10-27 18:20:58 +00:00
Eli Zaretskii
23d8633579 Avoid face inheritance cycles
* src/xfaces.c (face_inheritance_cycle): New function.
(Finternal_set_lisp_face_attribute): Signal an error if the
':inherit' attribute of a face is modified in a way that will
cause it to inherit from itself.  (Bug#79672)

* test/src/xfaces-tests.el (xfaces-test-circular-inheritance): New
test.

* etc/NEWS: Announce the incompatible change.
2025-10-27 15:54:10 +02:00
Sean Whitton
42dab7e785 ; * lisp/emacs-lisp/inline.el (define-inline): Improve wording. 2025-10-26 20:30:23 +00:00
Eshel Yaron
9d95d831fd
; (elisp-fontify-symbol): Put less text props when possible
* lisp/progmodes/elisp-mode.el (elisp-fontify-symbol):
Only put 'cursor-sensor-functions' property when
'cursor-sensor-mode' is enabled, and only put 'mouse-face'
property when 'elisp-add-help-echo' is non-nil.
Also add a docstring.
2025-10-26 17:39:10 +01:00
Eshel Yaron
cc824195bf
; (elisp-scope--symbol): Add a docstring. 2025-10-26 17:36:39 +01:00
Sean Whitton
97c000de0f ; * lisp/vc/vc-hg.el (vc-hg-revision-published-p): Simplify. 2025-10-26 14:53:20 +00:00
Sean Whitton
bb5a03592f ; * lisp/emacs-lisp/inline.el (define-inline): Fix line length. 2025-10-26 14:36:48 +00:00
Sean Whitton
ab5e64aa95 New revision-published-p VC backend API function (bug#79408)
* lisp/vc/vc-git.el (vc-git-revision-published-p): New function.
(vc-git--assert-allowed-rewrite): Use it.
* lisp/vc/vc-hg.el (vc-hg-revision-published-p): New function.
* lisp/vc/vc.el: Specify revision-published-p backend API
function (bug#79408).
2025-10-26 14:35:59 +00:00
Stefan Monnier
ac835686b5 (cl-defstruct): Use define-inline
* lisp/emacs-lisp/inline.el (define-inline): Add `noinline` declaration.
* doc/lispref/functions.texi (Inline Functions): Mention it.

* lisp/emacs-lisp/cl-macs.el (cl--do-arglist): Avoid %s for lists in
format string.
(cl-dolist, cl-dotimes): Remove obsolete optimization.
(cl-defstruct): Use `define-inline` instead of `cl-defsubst` for accessors.
2025-10-26 10:22:12 -04:00
Eshel Yaron
90afc7aaa3
; elisp-scope.el: Cease handling 'let-alist' specially.
This removes the bespoke analyzer for 'let-alist'.  It
required special accommodations in 'elisp-scope--symbol'
(which is otherwise very generic), and didn't bring any
concrete benefit for semantic highlighting purposes.
Instead, we rely on 'elisp-scope-1' macro-expanding
'let-alist' forms and analyzing the result.

* lisp/emacs-lisp/elisp-scope.el: Delete bespoke analyzer
definition for 'let-alist'.
(elisp-scope--current-let-alist-form): Remove, no longer used.
(elisp-scope--symbol, elisp-scope--handle-quoted): Simplify.
2025-10-26 15:05:08 +01:00
Michael Albinus
035c43c46b Fix tramp-add-external-operation
* lisp/net/tramp.el (tramp-add-external-operation): Check
`default-directory' if `(car args)' is a relative file name, or nil.
2025-10-26 12:44:29 +01:00
Stefan Monnier
515bbb8598 elisp-scope.el: Require cl-lib
* lisp/emacs-lisp/elisp-scope.el: Require `cl-lib`.
[ We could instead replace the `cl-case`s with `pcase`.  ]
(elisp-scope-cl-lambda-rest, elisp-scope-cl-lambda-key): Simplify.
2025-10-25 12:36:48 -04:00
Amin Bandali
bbabc1db25 ; * doc/lispref/os.texi (Startup Summary): Fix typo. 2025-10-25 10:55:00 -04:00
Mattias Engdegård
0db56a335c * lisp/emacs-lisp/byte-opt.el (byte-optimize-lapcode): Fix mistake 2025-10-25 15:41:13 +02:00
Stephen Berman
e561d14900 Fix Tramp support of GVFS built without FUSE
* lisp/net/tramp-gvfs.el (tramp-gvfs-enabled): Add check for
running process "gvsd", since GVFS may be built without FUSE.
2025-10-25 13:06:13 +02:00
Eli Zaretskii
42ac31133e ; Remove unintended hunks from last changeset. 2025-10-25 13:06:42 +03:00
Eli Zaretskii
f20eed46f9 ; Fix last change (bug#79629)
* lisp/calendar/holidays.el (holiday-general-holidays)
(holiday-oriental-holidays, holiday-local-holidays)
(holiday-other-holidays, holiday-hebrew-holidays)
(holiday-christian-holidays, holiday-islamic-holidays)
(holiday-bahai-holidays, holiday-solar-holidays): Doc fixes.
2025-10-25 10:38:07 +03:00
Amin Bandali
500a2d0cc5 Recompute calendar-holidays when its components are set (bug#79629)
* lisp/calendar/holidays.el (holidays--set-calendar-holidays):
New function for recomputing the 'calendar-holidays' user option
for use as the :set function of the following user options,
using 'custom-reevaluate-setting' to avoid overwriting the
user's customization of 'calendar-holidays'.
(holiday-general-holidays, holiday-oriental-holidays)
(holiday-local-holidays, holiday-other-holidays)
(holiday-hebrew-holidays, holiday-christian-holidays)
(holiday-islamic-holidays, holiday-bahai-holidays)
(holiday-solar-holidays): Use 'holidays--set-calendar-holidays'
as the :set function to recompute 'calendar-holidays' as needed.
2025-10-25 10:32:10 +03:00
Sean Whitton
b5303715cc * lisp/vc/vc-git.el (vc-git-branches): Use 'git for-each-ref'. 2025-10-24 21:17:36 +01:00
Sean Whitton
d0bcbc7ada Make UPSTREAM-LOCATION argument to incoming-revision optional
Using an empty string to mean the location from which vc-update
would pull was inherited from the old incoming/outgoing
functions, but we have opportunity to simplify things for this
new one.

* lisp/vc/vc-bzr.el (vc-bzr-incoming-revision):
* lisp/vc/vc-git.el (vc-git-incoming-revision):
* lisp/vc/vc-hg.el (vc-hg-incoming-revision):
* lisp/vc/vc.el (vc-diff-incoming, vc-diff-outgoing)
(vc-diff-outgoing-base, vc--incoming-revision): Make
UPSTREAM-LOCATION parameter optional.  Use nil, rather than an
empty string, to mean the default.
2025-10-24 20:55:19 +01:00
Sean Whitton
68e07ef8b2 ; * lisp/custom.el (custom-initialize-after-file-load): Fix docs. 2025-10-24 20:53:25 +01:00
Mattias Engdegård
8ad494fc76 Fix peephole optimiser bug for symbolp
* lisp/emacs-lisp/byte-opt.el (byte-optimize-lapcode):
Don't sink 'symbolp' past 'unbind'; it's unsafe.
2025-10-24 17:33:03 +02:00
Mattias Engdegård
0ccc246465 Move some constants into the peephole optimiser
* lisp/emacs-lisp/byte-opt.el (byte-tagref-ops, byte-conditional-ops)
(byte-after-unbind-ops, byte-compile-side-effect-and-error-free-ops)
(byte-compile-side-effect-free-ops):
Move into the constant pool...
* lisp/emacs-lisp/byte-opt.el (byte-optimize-lapcode): ...here,
bringing comments up to date.
2025-10-24 16:34:49 +02:00
Yuan Fu
2ed5179179
Remove cached font-lock settings in java-ts-mode
After the changes made in bug#79363, we don't need the cache anymore.

* lisp/progmodes/java-ts-mode.el:
(java-ts-mode--font-lock-settings-cached): Remove variable.
(java-ts-mode--font-lock-settings): Remove use of the variable.
2025-10-23 23:41:31 -07:00
Yuan Fu
fa9d22d719
Fix field access fontification in java-ts-mode (bug#79625)
* lisp/progmodes/java-ts-mode.el (java-ts-mode--font-lock-settings):
Remove the field_access rule.
2025-10-23 23:35:32 -07:00