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

98926 commits

Author SHA1 Message Date
Elías Gabriel Pérez
e7505ca213 Add option to auto-refresh the lossage buffer. (Bug#79732)
* lisp/help.el (view-lossage-auto-refresh): New user option.
(help--lossage-update): New variable.
(help--lossage-make-recent-keys, help--refresh-lossage-buffer):
New functions.
(view-lossage): Rework.
* doc/emacs/help.texi (Misc Help):
* etc/NEWS: Document change.
2025-11-05 09:17:51 +02:00
Philip Kaludercic
327c16ce14
Add support for 'bind-and*' patterns to 'cond*'
* lisp/emacs-lisp/cond-star.el (cond*): Document 'bind-and*'.
(bind-and*): Add a stub to raise an error if 'bind-and*' is used
outside of 'cond*'.
(cond*-convert-condition): Implement a new type of condition.
2025-11-04 20:45:39 +01:00
Juri Linkov
89f0853f1e Use 'read-char-choice' in 'ask-user-about-lock' (bug#79664)
* lisp/userlock.el (ask-user-about-lock): Use 'read-char-choice'
instead of 'read-char'.

* lisp/subr.el (read-char-choice-with-read-key): Add fallback
cond-branch to show a message with required keys.
2025-11-04 20:03:44 +02:00
Eli Zaretskii
d9ddf0d075 ; Fix documentation of a recent change
* lisp/progmodes/python.el (python-ts-hs-adjust-block-end-fn):
* lisp/progmodes/hideshow.el (hs-modes-alist)
(hs-adjust-block-end, hs-inside-comment-p-func): Doc fixes.
(bug#79671)
2025-11-04 20:00:39 +02:00
Elías Gabriel Pérez
959345f602 hideshow: Rewrite 'hs-special-modes-alist'
Rewrite the format in 'hs-special-modes-alist' to make easier to
exclude some values, add support for settings inheritance
according to current major mode and parents, and support string
hiding for lisp modes.

Bug#79671

* lisp/progmodes/hideshow.el (hs-modes-alist): New variable.
(hs-special-modes-alist): Mark as obsolete.
(hs-forward-sexp-func, hs-adjust-block-beginning)
(hs-find-block-beginning-func, hs-find-next-block-func)
(hs-looking-at-block-start-p-func): Set default values to nil.
(hs-inside-comment-p): Remove function.
(hs-adjust-block-end, hs-treesit-things): New buffer-local
variables.
(hs-block-positions): Minor updates.
(hs--get-mode-value): New function.
(hs-grok-mode-type): Rewrite.
* lisp/progmodes/f90.el (hs-special-modes-alist):
* lisp/progmodes/fortran.el (hs-special-modes-alist):
* lisp/progmodes/icon.el (icon-mode):
* lisp/progmodes/lua-mode.el (lua-mode):
* lisp/progmodes/python.el (python-base-mode):
* lisp/progmodes/verilog-mode.el (verilog-mode):
* lisp/progmodes/vhdl-mode.el (vhdl-hs-minor-mode): Rewrite
settings.
* lisp/progmodes/python.el (python-ts-hs-adjust-block-end-fn):
New function.
* lisp/treesit.el (treesit-hs-block-end)
(treesit-hs-find-block-beginning, treesit-hs-find-next-block)
(treesit-hs-looking-at-block-start-p): Minor updates.
* doc/emacs/programs.texi (Hideshow):
* etc/NEWS: Document changes.
2025-11-04 19:15:10 +02:00
Martin Rudalics
df3706a3c3 Fix thinko in 'delete-other-frames'
* lisp/frame.el (delete-other-frames): In second round make sure
the candidate frame has not been deleted in the first round to
avoid that 'frame-terminal' and friends throw an error.
2025-11-04 10:08:19 +01:00
Mattias Engdegård
f2836a8515 ; Avoid minibuffer.el compilation warning about cl-every 2025-11-03 13:00:59 +01:00
Yuan Fu
68290e1a03
Fix fontification for var in java-ts-mode (bug#79626)
* lisp/progmodes/java-ts-mode.el:
(java-ts-mode--font-lock-settings): Add font-lock rule for "var".
2025-11-02 14:17:23 -08:00
Sean Whitton
0175b7209e ; * lisp/emacs-lisp/cond-star.el (cond*): Fix typo. 2025-11-02 17:38:47 +00:00
Eli Zaretskii
6d36c6b6f9 ; Fix byte-compilation warnings (bug#79664)
* lisp/emacs-lisp/rmc.el (overriding-text-conversion-style):
Defvar it.
* lisp/emacs-lisp/map-ynp.el (cl--map-keymap-recursively): Add
autoload form.
2025-11-02 10:28:25 +02:00
Martin Rudalics
2c4e7a99cc Handle resizing of fullscreen frames more consistently (Bug#79704)
* src/frame.c (adjust_frame_size): Honor new option
'alter-fullscreen-frames'.
(syms_of_frame) <alter-fullscreen-frames>: New option to
maintain consistent state when attempting to resize fullscreen
frames.  Default to 'inhibit' for NS builds because these
resized the frame while leaving the 'fullscreen' parameter alone
(Bug#79704).
(syms_of_frame) <Qinhibit>: Define symbol.
* lisp/cus-start.el (standard): Add customization options for
'alter-fullscreen-frames'
* doc/lispref/frames.texi (Frame Size): Describe new option
'alter-fullscreen-frames'.
* etc/NEWS: Call out new option 'alter-fullscreen-frames'.
2025-11-02 09:24:05 +01:00
Juri Linkov
fae5ced1ac * lisp/simple.el (previous-line-or-history-element): Fix off-by-one error.
(bug#79746)
2025-11-02 09:41:05 +02:00
Philip Kaludercic
2777178dc6
Fix markup toggling in rcirc
(rcirc-markup-attributes): Delete markup codes straight after
processing it, to correctly handle toggling codes.  E.g. when
processing the message "one ^Btwo^B three", we previously
recognised the first interval "^Btwo^B" and moved over the ^B.
Searching for the next range to markup, we would now falsely
recognise "^B three" to be another markup range, instead of it
being the negative toggle.  By removing the processed codes, we
avoid this issue.  This reverts the functionality removed in
946ceca2, and therefore also re-adds the check to make an
exception to removing a ^O as that code can terminate multiple
markup sequences.  (Bug#57383)
2025-11-01 20:52:05 +01:00
Philip Kaludercic
da3e3756c2
; * lisp/emacs-lisp/cond-star.el (match*): Fix ` in docstring 2025-11-01 20:52:05 +01:00
Philip Kaludercic
3dacd8b41a
Check if 'hash-table-contains-p' is available in map.el
* lisp/emacs-lisp/map.el (map-contains-key): Hide old
implementation prior to f60fc128 behind a `fboundp', as the
package is distributed on ELPA and should be backwards
compatible to Emacs 26.  (Bug#79711)
2025-11-01 20:52:05 +01:00
Juri Linkov
2447188a69 'map-y-or-n-p' now uses the minibuffer to read a char (bug#79664)
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): Use the 'read-key'
branch only when the variable 'y-or-n-p-use-read-key' is non-nil.
Add a new cond-branch to read from the minibuffer.
Add a special case when def is nil in a kmacro in batch mode (bug#67836).

* test/lisp/files-tests.el (files-tests--with-buffer-offer-save):
Let-bind 'y-or-n-p-use-read-key' to t.
2025-11-01 20:27:45 +02:00
Juri Linkov
ab4a616b0b 'read-multiple-choice' now uses the minibuffer to read a char (bug#79664)
* doc/lispref/commands.texi (Reading One Event): Mention
'read-char-choice-use-read-key'.

* lisp/emacs-lisp/rmc.el (rmc--show-help): Show non-selected
resized Help window at bottom.  Inhibit useless message.
Remove unnecessary call to 'pop-to-buffer'.
(read-multiple-choice): Call 'read-multiple-choice--from-minibuffer'
when 'read-char-choice-use-read-key' is nil.
(read-multiple-choice--from-minibuffer): New function.

* test/lisp/emacs-lisp/rmc-tests.el (test-rmc--with-minibuffer-setup):
New macro.
(test-read-multiple-choice, test-read-multiple-choice-help):
Test both values of 'read-char-choice-use-read-key'.
2025-11-01 20:21:09 +02:00
Eli Zaretskii
e1b64c8b12 Merge from origin/emacs-30
0974418f2a Improve and correct documentation of 'font-lock-keywords-...
2025-11-01 05:28:54 -04:00
Michael Albinus
a7417c47fa ; Minor Tramp changes
* doc/misc/tramp.texi (Frequently Asked Questions): Don't mention
Windows 7/8, they are obsolete now.  Improve "speed up" item.

* lisp/net/tramp-sh.el (tramp-expand-script): Handle "%%" format
specifier better.
2025-11-01 10:01:43 +01:00
Gautier Ponsinet
126493735f Fix a typo in newst-backend.el
* lisp/net/newst-backend.el (newsticker--parse-text-container): Fix a
typo in the docstring.  (Bug#79747)
2025-11-01 09:25:44 +02:00
Sean Whitton
63ea5e5b3a ; * lisp/vc/vc-hg.el (vc-hg--reset-back-to): Fix docstring. 2025-10-31 18:53:09 +00:00
Sean Whitton
902f4e7166 ; * lisp/vc/vc-hg.el (vc-hg--reset-back-to): Reflow. 2025-10-31 18:50:41 +00:00
Sean Whitton
1fd4d3e070 New *-revisions-from-end VC backend API functions (bug#79408)
* lisp/vc/vc-git.el (vc-git-delete-revisions-from-end)
(vc-git-uncommit-revisions-from-end):
* lisp/vc/vc-hg.el (vc-hg--assert-rev-on-current-branch)
(vc-hg--reset-back-to, vc-hg-delete-revisions-from-end)
(vc-hg-uncommit-revisions-from-end): New functions.
* lisp/vc/vc.el: Specify delete-revisions-from-end and
uncommit-revisions-from-end backend API functions (bug#79408).
2025-10-31 18:49:19 +00:00
David Ponce
1e47f7492a lisp/emacs-lisp/cl-*.el: Minor changes accumulated during new API design
* lisp/emacs-lisp/cl-macs.el (cl-deftype): Support dispatch on
types that take arguments, as long as they can be used without arguments.

* lisp/emacs-lisp/cl-generic.el (cl--generic-derived-mode-specializers):
Rename from `cl--generic-derived-specializers` to clarify it's about
derived modes and not derived types.
(cl--generic-derived-mode-generalizer): Adjust accordingly and rename
from `cl--generic-derived-generalizer` for the same reason.
Ignore additional args in the tagcode function.
(cl-generic-generalizers) <derived-mode>: Adjust accordingly.

* lisp/emacs-lisp/macroexp.el (macroexp--dynamic-variable-p): Simplify.
2025-10-31 13:49:49 -04:00
David Ponce
13ec843352 cl-extra.el: Use the new API to speed up dispatch on derived types
* lisp/emacs-lisp/cl-extra.el (cl--types-of-memo): Delete var.
(cl--derived-type-specializers-memo): New var.
(cl-types-of): Delete function.
(cl--derived-type-specializers): New function.
(cl--derived-type-dispatch-list): Delete var.
(cl--derived-type-generalizer): Use the `:need-specializers` API instead.
(cl--derived-type-generalizers): Don't fill
`cl--derived-type-dispatch-list` any more.

* lisp/emacs-lisp/cl-preloaded.el (cl--derived-type-list): Delete var.
(cl--define-derived-type): Don't add type to `cl--derived-type-list`.

* test/lisp/emacs-lisp/cl-extra-tests.el (cl-types-test): Adjust.
2025-10-31 13:49:14 -04:00
Stefan Monnier
194b10b6ad (cl-generic-define-generalizer): Add new API
Sometimes, the computation of the tag (or the computations of
the list of specializers corresponding to a tag) can be sped up
if we know the set of specializers we're looking for.

So we add a new API for both the TAGCODE-FUNCTION and SPECIALIZERS-FUNCTION
that lets them receive the set of specializers they need to consider (or any
information they can precompute from that), i.e. the set of specializers
handled by the same generalizer currently used by the generic function
for the the specific argument on which we're currently dispatching.

* lisp/emacs-lisp/cl-generic.el (cl-generic-define-generalizer):
Document new API.
(cl--generic-collect-specializers, cl--generic-filter-specializers)
(cl--generic--tagcode-with-specializers): New helper functions.
(cl--generic-get-dispatcher): Use them to support new API.
2025-10-31 13:49:14 -04:00
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
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
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
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 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
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