Sean Whitton [Wed, 4 Jun 2025 12:11:14 +0000 (13:11 +0100)]
Factor out vc--with-backend-in-rootdir
* lisp/vc/vc.el (vc--with-backend-in-rootdir): New macro.
(vc-root-version-diff, vc-diff-mergebase, vc-root-diff)
(vc-print-root-log, vc-log-mergebase): Use it.
(vc-log-incoming, vc-log-outgoing): Use it here too in order to
prompt for a directory if current buffer is not VCS-controlled.
Juri Linkov [Wed, 4 Jun 2025 06:49:01 +0000 (09:49 +0300)]
* lisp/tab-line.el: Remove unnecessary checks for nil event.
(tab-line-hscroll-right, tab-line-hscroll-left)
(tab-line-switch-to-prev-tab, tab-line-switch-to-next-tab)
(tab-line-close-tab, tab-line-close-other-tabs):
Remove '(consp event)' to use the window returned by
'(posn-window (tab-line-event-start event))' even in case
when 'event' is nil.
Juri Linkov [Tue, 3 Jun 2025 15:41:01 +0000 (18:41 +0300)]
Restore c-ts-common-comment-setup in js-ts-mode and typescript-ts-mode.
* lisp/progmodes/js.el (js-ts-mode):
* lisp/progmodes/typescript-ts-mode.el (typescript-ts-base-mode):
Add 'c-ts-common-comment-setup' back removed in 8bccccedb65a
since it does more than setting comment variables (bug#78680).
shipmints [Tue, 4 Mar 2025 14:56:56 +0000 (09:56 -0500)]
Fix ns_make_monitor_attribute_list (bug#76691)
This is the NS implementation for 'display-monitor-attributes-list'.
Change implementation from IORegistry to direct introspection
of NSScreen.
* src/nsfns.m (ns_make_monitor_attribute_list): Use localizedName
selector on NSScreen. For anonymous displays, synthesize names
of the form ("%dx%d@%d,%d" width height x y).
(ns_get_name_from_ioreg) (ns_screen_name): Removed.
Michael Albinus [Mon, 2 Jun 2025 09:44:43 +0000 (11:44 +0200)]
Tramp: Do not raise an error when not connected (Bug#78572)
* lisp/net/tramp-cmds.el (tramp-cleanup-connection):
Use read syntax #' for `tramp-timeout-session',
* lisp/net/tramp.el (tramp-barf-if-file-missing): Do not raise an error
when not connected. (Bug#78572)
(tramp-file-name-handler): Do not force the backtrace.
(tramp-connectable-p): Check also, whether initial handshake is finished.
(tramp-skeleton-directory-files)
(tramp-skeleton-directory-files-and-attributes)
(tramp-skeleton-set-file-modes-times-uid-gid): Rearrange sending
`file-missing' error.
(tramp-handle-access-file, tramp-handle-unlock-file):
Use `tramp-connectable-p'.
Fontificatiomn improvements for typescrip-ts-mode.el (bug#78594)
- Fontify type-names for static function calls directly on types.
- Special-case "document" and "console" and constants/builtins.
- Fontify variable-use in string-interpolation expressions.
- Fontify variable-use in function-calls.
- Fontify variable-use in member-access expressions.
- Fontify variable-use in JSX-expressions.
- Fontify variable-use when using explicit nullability override.
Sean Whitton [Sun, 1 Jun 2025 10:55:27 +0000 (11:55 +0100)]
New incoming-revision VC backend action
* lisp/vc/vc.el: New incoming-revision backend action (bug#62940).
* lisp/vc/vc-git.el (vc-git--fetch-incoming): New function,
factored out of vc-git-log-incoming.
(vc-git-log-incoming): Use it.
(vc-git-incoming-revision):
* lisp/vc/vc-hg.el (vc-hg-incoming-revision): New functions.
Stefan Monnier [Sat, 31 May 2025 17:29:05 +0000 (13:29 -0400)]
(load-path-filter-cache-directory-files): Filter only for `must-suffix`
Most loads set the `must-suffix` (e.g. `require and
`autoload-do-load`), but some don't (e.g. `load-library`).
This results in two separate entries in
`load-path-filter--cache` with two hash-tables. The entry for
`must-suffix=nil` is larger and much less often used than the
other, so just skip filtering when `must-suffix=nil`.
Reduces the memory size of the cache from ~1MB to ~400kB in my
test case.
* lisp/startup.el (load-path-filter-cache-directory-files):
Don't use a filtering cache when `must-suffix` is nil.
* lisp/net/tramp-smb.el (tramp-smb-errors): Add string.
(tramp-smb-winexe-program): Adapt docstring.
(tramp-smb-handle-copy-directory, tramp-smb-handle-file-acl)
(tramp-smb-handle-set-file-acl, tramp-smb-maybe-open-connection):
Simplify argument handling.
(tramp-smb-handle-process-file): Flush " process-exit-status" property.
(tramp-smb-call-winexe): Set $winsize.Width to 102 only.
* lisp/net/tramp.el (tramp-process-sentinel): Adapt docstring.
Set " process-exit-status" property.
* test/lisp/net/tramp-tests.el (tramp--test-enabled):
Make it more robust.
(tramp-test18-file-attributes)
(tramp-test26-interactive-file-name-completion)
(tramp-test26-file-name-completion-boundaries)
(tramp-test35-remote-path): Adapt tests.
Eli Zaretskii [Sat, 31 May 2025 12:09:42 +0000 (15:09 +0300)]
Remove unused user options in sh-script.el
* lisp/progmodes/sh-script.el (sh-indent-comment)
(sh-first-lines-indent, sh-indent-for-else): Remove variables that
are no longer obeyed.
(sh-var-list): Likewise. (Bug#78592)
Jim Porter [Sat, 31 May 2025 05:21:40 +0000 (22:21 -0700)]
Add more "safe" display specs to 'visual-wrap-prefix-mode'
* lisp/visual-wrap.el (visual-wrap--safe-display-specs): Add
'space-width' and 'min-width'.
(visual-wrap--display-property-safe-p): Use 'member' instead of 'memq'
to more-closely match the behavior of other code that works with display
properties.
Sean Whitton [Fri, 30 May 2025 12:21:07 +0000 (13:21 +0100)]
vc-finish-logentry: Don't run vc-finish-logentry-hook
* lisp/vc/vc-dispatcher.el (vc-finish-logentry): Don't run
undocumented, undeclared 'vc-finish-logentry-hook'. There is
already 'vc-log-after-operation-hook'; it is not clear we need
both.
Dmitry Gutov [Thu, 29 May 2025 19:26:59 +0000 (22:26 +0300)]
project-remember-project: Support calling it interactively
* lisp/progmodes/project.el (project-remember-project):
Support interactive invocation (bug#78099) and react with
appropriate messages when called so, depending on the blacklist.
Juri Linkov [Thu, 29 May 2025 16:52:20 +0000 (19:52 +0300)]
Use 'outline-heading-end-regexp' consistently.
* lisp/outline.el (outline-font-lock-keywords):
For non-nil 'outline-search-function' also search for
'outline-heading-end-regexp' afterwards like there is
'outline-heading-end-regexp' at the end of the regexp counterpart.
(outline-minor-mode-highlight-buffer): Use 'outline-heading-end-regexp'
like in 'outline-font-lock-keywords' instead of "$".
For non-nil 'outline-search-function' also use
'outline-heading-end-regexp' the same way.
Martin Rudalics [Thu, 29 May 2025 09:33:28 +0000 (11:33 +0200)]
Have 'delete-frame' delete initial daemon frame only if FORCE is non-nil
* src/frame.c (delete_frame): Delete initial daemon frame only
if FORCE is non-nil (Bug#78583).
(Fdelete_frame): Rewrite doc-string to mention that it can
delete an initial daemon frame if and only if FORCE is non-nil.
* etc/NEWS:
* doc/lispref/frames.texi (Deleting Frames): Mention that
'delete-frame' can delete an initial daemon frame if and only if
FORCE is non-nil.
Pip Cet [Wed, 28 May 2025 14:11:07 +0000 (14:11 +0000)]
Fix unsafe SDATA usage in print.c (bug#78590)
* src/print.c (print_string_1): Renamed from 'print_string', with an
extra argument to disable nonascii escaping.
(print_string): New function.
(print_object): Use 'print_string_1', not 'strout'.
For non-subregexp case, search for the first match and continue
from its position. This avoids unnecessary scan for all text properties
until the first match. When nothing is found, skip the entire body.
Stephen Berman [Wed, 28 May 2025 15:17:23 +0000 (17:17 +0200)]
Fix bug in 'todo-jump-to-category' (bug#78608)
* lisp/calendar/todo-mode.el (todo-jump-to-category): Eliminate
comparison of the number of Todo categories before and after
specifying the category to jump to and replace it by a check of
whether there are any items in the category, since an existing
category should always have at least one item (perhaps done or
archived).
Juri Linkov [Tue, 27 May 2025 18:11:22 +0000 (21:11 +0300)]
* lisp/tab-line.el: Make tab closing commands work without mouse.
(tab-line--current-tab): New function.
(tab-line-close-tab, tab-line-close-other-tabs): Use it
when the 'event' arg doesn't originate from mouse.
Suggested by pinmacs <pinmacs@cas.cat>.
typescript-ts-mode: Improve function body indentation (bug#78121)
Older code was calculating body indentation depending on function
parameters alignment. This is incorrect, because if parameters are
misaligned, so will the function body. Instead, use offset of the
previous standalone parent.
* lisp/progmodes/typescript-ts-mode.el:
(typescript-ts-mode--indent-rules): Stop depending on function
parameters indentation for calculating body content and the closing
`}'.
* test/lisp/progmodes/typescript-ts-mode-resources/indent.erts:
(Function body with params misindented (bug#78121)): Add new test.
Jim Porter [Fri, 4 Oct 2024 00:24:18 +0000 (17:24 -0700)]
Don't add visual-wrap-prefix properties to unsafe multi-line display specs
This makes sure we don't interfere with other display specs, e.g. for
images displayed in 'image-mode' (bug#73600).
* lisp/visual-wrap.el (visual-wrap--safe-display-specs): New variable.
(visual-wrap--display-property-safe-p): New function.
(visual-wrap--apply-to-line): Use 'pos-eol'; we don't want to respect
field boundaries here.
(visual-wrap-prefix-function): Check for unsafe display properties at
the end of the line and skip past them if present.
Eli Zaretskii [Sat, 24 May 2025 13:25:34 +0000 (16:25 +0300)]
Fix detection of Dired with files whose name ends in a colon
* lisp/dired.el (dired-build-subdir-alist): Use a more general
regexp to detect file entries whose names end in a colon, when
various non-default 'ls' switches are used. (Bug#78493)
Roi Martin [Sun, 20 Apr 2025 06:05:56 +0000 (08:05 +0200)]
Add baseline pass/fail tests for `ert-test-erts-file'
* test/lisp/emacs-lisp/ert-tests.el (ert-test-erts-pass)
(ert-test-erts-fail): Add tests to verify that the
`ert-test-erts-file' function can detect both passing a failing
test cases.
* test/lisp/emacs-lisp/ert-resources/erts-fail.erts:
* test/lisp/emacs-lisp/ert-resources/erts-pass.erts:
Add test data. (Bug#78552)
Lin Sun [Wed, 14 May 2025 06:30:34 +0000 (06:30 +0000)]
Speed up loading modules
* src/lread.c (get-load-suffixes): Don't try loading modules with
suffixes from 'jka-compr-load-suffixes', since loading of
compressed shared libraries is not supported (so attempt to look
for them is just waste of cycles). (Bug#78416.)
Spencer Baugh [Thu, 1 May 2025 18:27:30 +0000 (14:27 -0400)]
Add load-path-filter-function and use it to optimize loading
When there are many directories on load-path, the part of load which
searches load-path can become very slow. By filtering load-path up
front to only contain directories which are likely to contain the
searched-for file, load becomes much faster.
This can be set in early-init.el for maximum effect.
Vincent Belaïche [Fri, 23 May 2025 07:28:56 +0000 (09:28 +0200)]
More SES printer functions.
* lisp/ses.el (ses-standard-printer-functions): add 'ses-left' &
'ses-left-span' to the list.
(ses--align): New helper function, takes most of the code
previously in 'ses-center'
(ses-center): Use 'ses--align'.
(ses--span): New helper function, takes most of the code
previously in 'ses-center-span.
(ses-center-span): Use 'ses--span'.'
(ses-left): New function.
(ses-left-span): New function.
* test/lisp/progmodes/compile-tests.el
(compile-tests--test-regexps-data, compile--test-error-line)
(compile-test-functions): Check the types (error, warning or info) for
most patterns. Use names instead of numbers in the reference.
Yuan Fu [Wed, 21 May 2025 07:23:15 +0000 (00:23 -0700)]
Eglot: always call ElDoc callbacks in correct buffer (bug#78530)
Some minor modes adds their own eldoc display function to
'eldoc-display-functions' hook buffer-locally. So when eldoc
uses 'eldoc-display-functions' to display docs, it should use
the buffer-local value of the hook.
But that's not always the case. In 'eldoc--invoke-strategy', the
code that runs 'eldoc-display-functions' hook is wrapped in a
callback function that eventually gets passed to each
documentation function in 'eldoc-documentation-functions'. So
now it's the documentation functions' responsibility to call the
eldoc callback in the original buffer.
All the eglot documentation functions indeed do that, using
'eglot--when-buffer-window' to switch to the original buffer
when calling the eldoc callback. But
'eglot-code-action-suggestion' is the exception, the callback is
called outside of the 'eglot--when-buffer-window' form.
This patch fixes that.
This bug was originally reported on eldoc-box [1]. The user
found that eldoc-box's display function are rarely called, even
though the minor mode is turned on. This patch fixes the issue.
Paul Eggert [Wed, 21 May 2025 17:07:04 +0000 (10:07 -0700)]
Work around GCC bug 117423
Problem reported by Oliver Reiter and Pip Cet (Emacs bug#78473).
It looks like GCC tree-sra is trouble in general with how Emacs
uses unions, so disable tree-sra until the GCC bug is fixed.
* configure.ac (C_SWITCH_MACHINE): Also work around GCC bug 117423.
Juri Linkov [Wed, 21 May 2025 06:31:45 +0000 (09:31 +0300)]
* lisp/treesit.el: New variables for 'down-list' and 'up-list'.
(treesit-sexp-type-down-list, treesit-sexp-type-up-list):
New buffer-local variables.
(treesit-down-list): Use 'treesit-sexp-type-down-list'.
(treesit-up-list): Use 'treesit-sexp-type-up-list'.
* lisp/progmodes/elixir-ts-mode.el (elixir-ts-mode):
Set 'treesit-sexp-type-down-list' and
'treesit-sexp-type-up-list' to 'list'.
Stephen Berman [Tue, 20 May 2025 13:29:58 +0000 (15:29 +0200)]
Fix todo-mode item insertion bug (bug#78506)
* lisp/calendar/todo-mode.el (todo-insert-item--next-param): Unset
transient keymap on completing default or copy item insertion
command, to ensure that the next Todo mode key is recognized.
Juri Linkov [Tue, 20 May 2025 18:30:38 +0000 (21:30 +0300)]
* lisp/tab-line.el (tab-line-move-tab-forward): New command.
(tab-line-move-tab-backward): New command.
(tab-line-mode-map): Bind 'C-x M-<left>' to
'tab-line-move-tab-backward' and 'C-x M-<right>' to
'tab-line-move-tab-forward'.
(tab-line-switch-repeat-map): Bind 'M-<left>' to
'tab-line-move-tab-backward' and 'M-<right>' to
'tab-line-move-tab-forward'.
Suggested by pinmacs <pinmacs@cas.cat>.
Spencer Baugh [Mon, 19 May 2025 15:35:38 +0000 (11:35 -0400)]
Fix 'completion-ignore-case' with 'completion--file-name-table'
509cbe1c35b3d "Improve env var handling in read-file-name"
caused 'try-completion' and 'all-completion' operations with
'completion--file-name-table' to no longer update the case of
text which was already present in the input string. That is,
completions would be returned ignoring case, but the completions
would have letter-casing which matched the input string rather
than matching the actual file names.
This was caused by unnecessarily replacing text in the returned
file name completions with text from the input string ORIG,
which in turn was caused by the desire to preserve text from
ORIG even after 'substitute-in-file-name' changed it. Fix this
by detecting when ORIG was not substantially changed by
'substitute-in-file-name'; in that case, the returned file name
completions also don't need substantial changes.
* lisp/minibuffer.el (completion--file-name-table): Use text
from the completions, not the input string. (Bug#78323)
* test/lisp/minibuffer-tests.el (completion-table-test-quoting):
Test with 'completion-ignore-case' as well.
Stefan Monnier [Sun, 18 May 2025 19:48:54 +0000 (15:48 -0400)]
eww.el: Misc changes
* lisp/net/eww.el (eww--parse-html-region): Don't decode when it's a no-op.
(eww-display-raw): Simplify.
(eww-mode): Prefer #' to quote function names.
(eww-switch-to-buffer): Use `completion-table-with-metadata` instead of
`completion-extra-properties`. Don't prompt the user when there's only
one choice.
(eww-buffer-list): Use `eww--buffer-p`.