'xwidget-open' wrongly assumed the the text-property at
min-position is an xwidget, if it exists; the fix is just
returning nil if the text-property isn't an xwidget.
* lisp/xwidget.el (xwidget-at): Use 'ignore-errors'. (Bug#72848)
Eli Zaretskii [Thu, 29 Aug 2024 09:56:27 +0000 (12:56 +0300)]
Fix rare segfaults due to freed fontsets
* src/xfaces.c (recompute_basic_faces): Force complete
recalculation of non-ASCII faces and their fontsets if any
non-ASCII faces are in the frame's face cache. (Bug#72692)
This binding dates back at least to 2004 (where we bound
`after-change-functions` instead). Maybe it had a real impact in the past,
but nowadays I can't see any effect other than maybe a negligible
performance improvement at the cost at breaking some uses of
`before-after-change-functions`.
Yuan Fu [Tue, 27 Aug 2024 02:43:00 +0000 (19:43 -0700)]
More consistent treesit-forward-sexp around comments (bug#72525)
* lisp/treesit.el (treesit-forward-sexp): Check if point is strictly
inside a comment or string, only then use the default forward-sexp
function; otherwise use tree-sitter's forward-sexp routine.
Yuan Fu [Mon, 26 Aug 2024 00:59:51 +0000 (17:59 -0700)]
Fix tree-sitter local parser overlay cleanup routine
Sorry for sneaking in a sizable commit so late. But I just found out
about this bug and it has to be fixed. Before this change, we weren't
properly cleaning up overlays that store local parsers. And in the case
of doxygen local parser in C files, the doxygen local parser overlay
sometimes bleeds out of comments and into other code, and interferes
with font-lock and indentation.
This commit adds a cleanup function that'll cleanup any overlays that
aren't being used. I tested with doxygen in C files and everything
works smoothly now, including tricky tests like removing the ending "*/"
of a doxygen comment and adding it back.
The idea is simple, at the end of each call to (treesit-update-ranges
BEG END), we remove any overlay within BEG and END that wasn't touched
by the range setting code.
* lisp/treesit.el (treesit--cleanup-local-range-overlays): New function.
(treesit--update-ranges-local): Remove code for cleaning up zero-length
overlays since we have the cleanup function now.
(treesit-update-ranges): Wrap the function body inside a let form, which
defines modified-tick; and add a call to
treesit--cleanup-local-range-overlays at the very end.
Stefan Monnier [Mon, 26 Aug 2024 15:26:11 +0000 (11:26 -0400)]
(pp): Indent lines right when starting in col > 0
This refines the fix for bug#72561: commit 0a500193087e fixes
the bug by changing `ert--pp-with-indentation-and-newline`,
but it turns out that `pp` was inconsistent (it sometimes
indented the subsequent lines correctly and sometimes not,
depending on the current-buffer's major mode).
So the fix really should be in `pp`, which is what this patch does.
* lisp/emacs-lisp/pp.el (pp): Appropriately indent subsequent lines
if the first line is not inserted in column 0 (tho only when
printing into a buffer since otherwise it's somewhere between
ill-defined and impossible to implement).
* lisp/emacs-lisp/ert.el (ert--pp-with-indentation-and-newline):
Remove the indentation code after `pp` which was just working
around the bug in `pp`. Also remove the redundant addition of
`\n` since `pp` always does it nowadays.
* test/lisp/help-mode-tests.el (help-mode-tests-xref-on-pp):
Fix thinko.
Eli Zaretskii [Sun, 25 Aug 2024 18:43:59 +0000 (21:43 +0300)]
Revert a recent change that caused redisplay slowdown
* src/xfaces.c (recompute_basic_faces): Revert the change which
caused recalculation of all the faces, as it made cursor motion
too slow. Reported by Juri Linkov <juri@linkov.net> (bug#72692).
Jim Porter [Fri, 23 Aug 2024 22:11:24 +0000 (15:11 -0700)]
Improve computation of indent depth in SHR and 'visual-wrap-prefix-mode'
Now, we get the average-width of the current font using
'string-pixel-width' and a specified space display spec, which doesn't
require the buffer to be displayed in a window (bug#72771).
* lisp/net/shr.el (shr-indent):
* lisp/visual-wrap.el (visual-wrap--content-prefix): Fix getting the
font when the buffer isn't displayed in a window.
(visual-wrap-fill-context-prefix): Fix indentation.
F. Jason Park [Fri, 9 Aug 2024 23:49:28 +0000 (16:49 -0700)]
Indent ERT failure explanations rigidly
This also affects the listing of `should' forms produced by hitting
the L key on a test button in an ERT buffer.
* lisp/emacs-lisp/ert.el (ert--pp-with-indentation-and-newline):
Indent the pretty-printed result to match the caller's current column
as a reference indentation.
* test/lisp/emacs-lisp/ert-tests.el
(ert--pp-with-indentation-and-newline): New test. (Bug#72561)
Dmitry Gutov [Sun, 25 Aug 2024 15:23:51 +0000 (18:23 +0300)]
[Eglot] Stricter "expand common" behavior
* lisp/progmodes/eglot.el (eglot--dumb-tryc): Check that the
expanded string matches every completion strictly (bug#72705).
And in the fallback case, check whether the table matches the
original prefix at all. Return nil otherwise.
Dmitry Gutov [Sun, 25 Aug 2024 15:05:28 +0000 (18:05 +0300)]
eglot-tests.el: New tests for existing completion behavior
* test/lisp/progmodes/eglot-tests.el
(eglot-test-common-prefix-completion)
(eglot-test-try-completion-inside-symbol)
(eglot-test-rust-completion-exit-function): New tests.
(eglot--wait-for-rust-analyzer): New function.
Eli Zaretskii [Sun, 25 Aug 2024 07:24:35 +0000 (10:24 +0300)]
Fix handling of 'min-width' display property
* src/xdisp.c (get_display_property, display_min_width): Rename
BUFPOS to CHARPOS, to avoid confusion (it is not necessarily a
buffer position). Suggested by Jim Porter <jporterbugs@gmail.com>.
(get_display_property): Call 'Fget_char_property' to support
'min-width' properties of overlays as well.
(display_min_width): Handle the buffer and string cases more
accurately, without relying only on the values of positions.
(handle_display_prop, handle_single_display_spec): Pass correct
position to 'display_min_width', when iterating over a string.
(handle_display_prop): When OBJECT is a window, pass it to
display_min_width.
(set_iterator_to_next): Call 'display_min_width' when at end of a
display or overlay string. (Bug#72721)
Yuan Fu [Sat, 24 Aug 2024 22:25:48 +0000 (15:25 -0700)]
Fix Ftreesit_parser_create
* src/treesit.c (Ftreesit_parser_create): We recently changed something
such that base buffer and indirect buffer appears to use separate
parser-lists. Therefore, creating a parser in one of the buffer
shouldn't reuse the parser in another buffer.
Björn Bidar [Thu, 8 Aug 2024 14:36:01 +0000 (17:36 +0300)]
Forward user to auth-source inside url-basic-auth
* lisp/url/url-auth.el (url-basic-auth): Forward the user if
provided by the url or found by 'auth-source' when searching
for secrets. Supplying 'auth-source' with the user when
matching secrets allows for more accurate retrieval and fixes
instances where the user enters an url that already contains
the user such as "user@host.de". (Bug#72526)
Michael Albinus [Sat, 24 Aug 2024 10:49:32 +0000 (12:49 +0200)]
Optimize Tramp's copy-directory
* lisp/net/tramp-sh.el (tramp-sh-handle-copy-directory):
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory):
Don't check existence of DIRNAME, this is done in
`tramp-skeleton-copy-directory' already.
* lisp/net/tramp-sh.el (tramp-sh-handle-copy-directory):
Apply `tramp-do-copy-or-rename-file-directly' if possible.
Björn Bidar [Thu, 8 Aug 2024 14:31:20 +0000 (17:31 +0300)]
Fix secret search with basic auth with a port in URL
* lisp/url/url-auth.el (url-basic-auth): Fix retrieving of
secrets when the URL contains a port. Amending the port to
server breaks 'auth-source-search' matching for :host which
is redundant as it already specified in :port. (Bug#72526)
Martin Rudalics [Fri, 23 Aug 2024 08:27:12 +0000 (10:27 +0200)]
Avoid putting a dead buffer in the minibuffer window (Bug#72487)
* src/minibuf.c (minibuffer_unwind): Make sure that the buffer
referenced by the first element of the list of previous buffers
of the minibuffer window is live before assigning it to the
minibuffer window (Bug#72487).
* src/window.c (set_window_buffer): Assert that BUFFER is live.
Robert Pluim [Fri, 23 Aug 2024 08:16:29 +0000 (10:16 +0200)]
Create blessmail at build time instead of install time
blessmail is built via the install target, which means it ends up owned
by the user doing the install. It's not installed, so build it at build
time instead.
Reported by Michael Heerdegen <michael_heerdegen@web.de> in
<https://lists.gnu.org/archive/html/help-gnu-emacs/2024-08/msg00270.html>
* Makefile.in (install): Move blessmail target from install to actual-all.
Eli Zaretskii [Thu, 22 Aug 2024 14:29:46 +0000 (17:29 +0300)]
Fix C-n/C-p under both 'line-prefix' and 'visual-line-mode'
* lisp/simple.el (line-move-finish): Use
'truncated-partial-width-window-p' to query whether partial-width
lines are actually truncated on display. (Bug#72420)
Eshel Yaron [Fri, 23 Aug 2024 15:15:32 +0000 (17:15 +0200)]
; Fix infloop in checkdoc-next-docstring
* lisp/emacs-lisp/checkdoc.el (checkdoc-next-docstring): Use
'beginning-of-defun-raw' instead of 'beginning-of-defun', as the latter
always moves back to beginning of line and thus is not guaranteed to
advance point when 'open-paren-in-column-0-is-defun-start' is non-nil.
(Bug#72759)
Stefan Kangas [Tue, 23 Jul 2024 22:09:49 +0000 (00:09 +0200)]
Prefer static_assert to verify
Although static_assert is C11-specific, and Emacs remains on C99, it
has been backported to older compilers by Gnulib. Gnulib has already
changed to prefer static_assert, and we can do the same.
Martin Rudalics [Wed, 21 Aug 2024 08:54:53 +0000 (10:54 +0200)]
Fix two issues with 'window-deletable-p'
* lisp/window.el (window-deletable-functions): Clarify
doc-string.
(window-deletable-p): Handle check whether WINDOW's frame can be
deleted via new function 'frame-deletable-p' (a comparison with
the frame returned by 'next-frame' fails in too many cases). Do
not try to run 'window-deletable-functions' in WINDOW's buffer
when WINDOW is internal.
* lisp/frame.el (frame-deletable-p): New function.
* doc/lispref/frames.texi (Deleting Frames): Describe new
function 'frame-deletable-p'.
* etc/NEWS: Mention 'frame-deletable-p'.
* lisp/net/tramp.el (tramp-file-name-handler): Flush connection
properties "process-name" and "process-buffer".
* test/lisp/net/tramp-tests.el
(tramp--test-deftest-direct-async-process): Skip when underlying
TEST has taken too much time.
(tramp--test-with-proper-process-name-and-buffer): Remove.
(tramp-test45-asynchronous-requests): Remove callees.
* doc/misc/modus-themes.org (COPYING): Update the version headers.
(Option to extend the palette): Document new user options.
(Full support for packages or face groups): Document more
packages that are explicitly supported by the themes.
(Acknowledgements): Update the list of people who have
contributed to the project in one way or another.
* etc/themes/modus-operandi-deuteranopia-theme.el:
* etc/themes/modus-operandi-deuteranopia-theme.el:
* etc/themes/modus-operandi-tinted-theme.el:
* etc/themes/modus-operandi-tritanopia-theme.el:
* etc/themes/modus-vivendi-deuteranopia-theme.el:
* etc/themes/modus-vivendi-theme.el:
* etc/themes/modus-vivendi-tinted-theme.el:
* etc/themes/modus-vivendi-tritanopia-theme.el: Update the
palette of each theme and include the new user option to extend
its palette.
* etc/themes/modus-themes.el: Cover more faces and include user
option for common extension to all theme palettes.
Kévin Le Gouguec [Wed, 21 Aug 2024 06:45:00 +0000 (08:45 +0200)]
Restore vc-git helper function (bug#68183)
* lisp/vc/vc-git.el (vc-git--cmds-in-progress): Restore; it was removed
in a previous refactoring patch, but we may still find use for it.
(vc-git-dir--in-progress-headers): Use it.
Split vc-git-dir-extra-headers into more manageable chunks
The current code requires a lot of eyeballing back-and-forth
to:
- check where variables are actually used, what impact changing
them can have: in actuality, there are three distinct "groups"
of headers we compute, each with their own independent state;
- understand formatting details such as "who's in charge of the
newlines".
To solve both issues, split that function into smaller ones,
each handling a "group" of headers.
The only expected "functional" change is that, by propertizing
"\nHeader: " strings, the original code sometimes applied the
vc-dir-header face to the newline preceding a header; the new
code applies no faces to these newlines.
This change would be visible to users with themes adding an
:extended background to vc-dir-header. In practice, no in-tree
theme is impacted.
For bug#68183.
* lisp/vc/vc-git.el (vc-git-dir--branch-headers): New function
to compute "Branch", "Tracking" and "Remote".
(vc-git--cmds-in-progress): Rename to...
(vc-git-dir--in-progress-headers): ... this, and compute
headers.
(vc-git-dir--stash-headers): New function to compute the
"Stash" header.
(vc-git-dir-extra-headers): Boil down to just setting
default-directory and assembling the headers from these new
helpers.
(vc-git--out-match): New function to call 'git' and capture
specific bits of output.
* test/lisp/vc/vc-git-tests.el
(vc-git-test-dir-track-local-branch): Remove in favor of new
test.
(vc-git-test--start-branch): New helper to get a repository
going.
(vc-git-test--dir-headers): New helper to get a list of headers
in the current vc-dir buffer.
(vc-git-test-dir-branch-headers): New test, exercising the
original bug recipe plus more common scenarios.