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`.
Stefan Monnier [Sun, 18 May 2025 19:44:35 +0000 (15:44 -0400)]
eww.el: Use `track-changes`
* lisp/net/eww.el: Require `track-changes`.
(eww-display-document): Don't `inhibit-modification-hooks` any more.
Use `track-changes-register` *at the end* instead.
(eww-mode): Don't use `after-change-functions` any more.
(eww--track-changes): New function.
(eww--process-text-input): Rename from `eww-process-text-input`.
Try and be more careful: don't presume `point` is near
the modification. Check for a form both at BEG and at END.
Don't rely on `:start/:end` pointing to the right places.
Use `:length` instead and shrink the field back to its original length
when possible.
(eww-size-text-inputs): Set `:length` rather than `:start/:end`.
Stefan Monnier [Sat, 17 May 2025 18:23:34 +0000 (14:23 -0400)]
editorconfig.el: Fix bug#78097
When there is no `.editorconfig` variable, the
`file-name-directory` call can signal an error, but that can
happen only if `editorconfig-get-local-variables-functions`
added entries "out of thin air". So just skip running that hook
to avoid this corner case.
* lisp/editorconfig.el (editorconfig--get-dir-local-variables):
Don't run `editorconfig-get-local-variables-functions` when we found no
EditorConfig settings.
Po Lu [Sun, 18 May 2025 00:46:27 +0000 (08:46 +0800)]
Prevent double frees in closing fonts provided by the Haiku font driver
* src/haikufont.c (haikufont_close): Clear INFO->metrics,
glyphs, be_font after they are released and do not attempt to
access them if NULL. (bug#77478)
* lisp/net/eww.el (eww--buffer-p): New function.
(eww-switch-to-buffer): Use it. And set `completion-extra-properties`
buffer-locally rather than let-binding it.
Eli Zaretskii [Sat, 17 May 2025 13:46:07 +0000 (16:46 +0300)]
Support 'dired-hide-details-mode' in find-lisp.el
* lisp/find-lisp.el (find-lisp-find-dired-insert-file): Call
'dired-insert-set-properties' to support 'dired-hide-details-mode'
in the resulting Dired display. (Bug#78455)
Eli Zaretskii [Sat, 17 May 2025 09:35:29 +0000 (12:35 +0300)]
; Remove confusing text from ELisp manual
* doc/lispref/variables.texi (Defining Variables): Remove outdated
confusing warning. For the details, see
https://lists.gnu.org/archive/html/emacs-devel/2025-05/msg00332.html.
Buttonize the ellipsis and optionally display in the ellipsis
the total number of hidden lines.
* lisp/progmodes/hideshow.el (hs-display-lines-hidden): New
user option.
(hs-ellipsis): New face.
(hs-make-overlay): Tweak.
(hs--get-ellipsis): New function.
* doc/emacs/programs.texi (Hideshow): Update documentation.
* etc/NEWS: Announce changes.
Richard Lawrence [Sun, 11 May 2025 05:47:42 +0000 (07:47 +0200)]
Fix DTSTART date when exporting `diary-float'
Instead of using current date as DTSTART and then excluding it
when it doesn't match the `diary-float' rule, just use the first
date which matches the rule in `icalendar-recurring-start-year'.
* lisp/calendar/icalendar.el (icalendar--convert-float-to-ical):
Compute the correct date.
* test/lisp/calendar/icalendar-tests.el: Add a test for the
reported test case. (Bug#78085)
New pulse functions for pulse faces and new file for ring bell fns
These new pulse functions allow pulse any defined face briefly.
The new file contains functions intended to be used in
`ring-bell-function' as alternatives to `visible-bell'.
* lisp/pulse.el (pulse-face-duration): New user option.
(pulse-flash-face): New function.
* lisp/ring-bell-fns.el (flash-face-attributes)
(flash-face-faces): New user options.
(flash-face-bell-function, flash-echo-area-bell-function):
New functions. (bug#77715)
* lisp/progmodes/typescript-ts-mode.el:
(typescript-ts-mode--indent-rules): Make sure each new ternary
branch is aligned with the previous one.
* test/lisp/progmodes/typescript-ts-mode-resources/indent.erts:
(Chained ternary expressions): New test.
* src/eval.c (default_toplevel_binding, local_toplevel_binding):
Loop upwards, not downwards, given that we want the earliest
relevant binding present in the stack.
Stephen Berman [Sat, 10 May 2025 14:25:05 +0000 (16:25 +0200)]
Improve Electric Pair mode documentation (bug#78021)
* doc/emacs/programs.texi (Matching): Clarify and improve
documentation of Electric Pair mode.
* lisp/elec-pair.el: Improve description in header line. Add text
and a reference to the Emacs user manual in the Commentary section.
(electric-pair-skip-self, electric-pair-inhibit-predicate)
(electric-pair-preserve-balance)
(electric-pair-delete-adjacent-pairs)
(electric-pair-open-newline-between-pairs)
(electric-pair-skip-whitespace)
(electric-pair-skip-whitespace-function)
(electric-pair-analyze-conversion)
(electric-pair--skip-whitespace)
(electric-pair-text-syntax-table, electric-pair--with-syntax)
(electric-pair-syntax-info, electric-pair--insert)
(electric-pair--syntax-ppss, electric-pair--balance-info)
(electric-pair-inhibit-if-helps-balance)
(electric-pair-skip-if-helps-balance)
(electric-pair-open-newline-between-pairs-psif)
(electric-pair-mode): Clarify and improve doc strings and some comments.
(electric-pair-post-self-insert-function): Restructure doc string
to shorten overlong first line, and reformat overlong lines of code.
Juri Linkov [Wed, 14 May 2025 06:57:40 +0000 (09:57 +0300)]
Use JSX comments on jsx treesit nodes in js-ts-mode and tsx-ts-mode
* lisp/progmodes/js.el (js--treesit-comment-jsx): New internal variable.
(js--treesit-comment-setup): New function.
(js-ts-mode): Set buffer-local 'comment-setup-function' to
'js--treesit-comment-setup'.
* lisp/progmodes/typescript-ts-mode.el (typescript-ts-base-mode):
Set buffer-local 'comment-setup-function' to 'js--treesit-comment-setup'.
Eli Zaretskii [Tue, 13 May 2025 11:45:04 +0000 (14:45 +0300)]
Eglot: Fix parsing file:// URIs on MS-Windows
* lisp/progmodes/eglot.el (eglot-uri-to-path): Remove the leading
slash in MS-Windows file names only if they begin with a slash.
This adjusts the function to the recent fix for bug#76982 in
'url-generic-parse-url', which previously would produce file names
that begin with an extra slash. (Bug#78392)
Stefan Monnier [Mon, 12 May 2025 21:49:02 +0000 (17:49 -0400)]
help.el: Don't abuse `inhibit-modification-hooks`
* lisp/help.el (substitute-command-keys):
Set `inhibit-modification-hooks` locally so it doesn't affect
downstream function.
(help--window-setup): Don't let-bind `inhibit-modification-hooks`.
It was introduced accidentally in commit cd87a5c7a18e.
Stefan Monnier [Mon, 12 May 2025 19:25:05 +0000 (15:25 -0400)]
comint.el: Cosmetic changes
* lisp/comint.el: Prefer #' to quote function names.
(comint-mode): Turn some of the `make-local-variable`s to `setq-local`
or `defval-local`.
(comint-osc-hyperlink): Delete bogus alias.
(comint-replace-by-expanded-history-before-point): Use `looking-at-p`.
(comint-history-isearch-wrap): Share a bit more code.
Juri Linkov [Mon, 12 May 2025 18:23:03 +0000 (21:23 +0300)]
* lisp/treesit.el (treesit--parser-overlay-offset): New variable.
(treesit-parsers-at): Use it (bug#77906).
(treesit-forward-sexp, treesit--forward-list-with-default)
(treesit-up-list): Let-bind 'treesit--parser-overlay-offset'.