Sean Whitton [Mon, 7 Apr 2025 03:28:13 +0000 (11:28 +0800)]
Add bindings for vc-git-stash-delete-at-point, vc-git-stash-delete
* lisp/vc/vc-git.el (vc-git-stash-map): Bind "D" to
vc-git-stash-delete-at-point.
(vc-dir-git-mode-map): Bind "z d" to vc-git-stash-delete.
* etc/NEWS: Announce the new bindings.
Sean Whitton [Mon, 7 Apr 2025 02:03:46 +0000 (10:03 +0800)]
vc-git-checkin: Don't relativize names of temporary files
* lisp/vc/vc-git.el (vc-git-checkin)
(vc-git--stash-staged-changes): Don't relativize names of
temporary files passed to 'git apply --cached'. More generally,
these are not files managed by the underlying VCS, so they
shouldn't go in the FILE-OR-LIST argument to vc-git-command.
Sean Whitton [Sun, 6 Apr 2025 03:18:57 +0000 (11:18 +0800)]
Teach VC-Dir to automatically add and remove marks on other lines
* lisp/vc/vc-dir.el (vc-dir-allow-mass-mark-changes): New option.
(vc-dir-parent-marked-p): Replace with ...
(vc-dir--parent): ... this.
(vc-dir-children-marked-p): Replace with ...
(vc-dir--children): ... this.
(vc-dir-mark-file): Unmark subitems before marking a directory.
Offer to unmark a directory before marking a subitem.
(vc-dir-unmark-file): For an implicitly marked item, offer to
unmark it by marking everything else that's implicitly marked.
For an unmarked directory with marked subitems, offer to unmark
them all.
* etc/NEWS: Document the changes.
Sean Whitton [Sun, 6 Apr 2025 03:09:22 +0000 (11:09 +0800)]
Fix dired-vc-next-action generating inconsistent marks
* lisp/vc/vc-dir.el (vc-dir-mark-files): Document that
directories passed to this function must have trailing slashes.
Don't mark both a directory and also items under it (bug#76769).
* lisp/dired-aux.el (dired-vc-next-action): Update docstring.
Sean Whitton [Sun, 6 Apr 2025 01:09:32 +0000 (09:09 +0800)]
vc-dir-mark-file: Consistently don't allow marking a subdirectory
* lisp/vc/vc-dir.el (vc-dir-mark-file): Don't allow marking a
subdirectory if its parent is already marked. This fixes an
inconsistency whereby if a subdirectory was already marked then
its parent could not be marked, but not vice-versa (bug #76769).
Eli Zaretskii [Sat, 5 Apr 2025 10:24:22 +0000 (13:24 +0300)]
Teach 'current-column' to account for images
* src/indent.c (check_display_width): Handle 'image' and 'slice'
display specs, instead of using the width of the underlying text.
Accept 2 additional arguments: WINDOW and SCAN_BYTE. (Bug#76107)
Fix mouse highlighting for compact mode lines (bug#77336)
When 'mode-line-compact' is non-nil, the mode line string is
displayed as a whole. That confuses the computation of ranges
of mouse highlighting on the mode line because all the glyphs
have the same Lisp object source. As such, in this commit we
instead split the mode line string by sources, and display those
elements one by one, so the boundaries of each element could be
correctly detected for the purpose of mouse highlighting.
* src/xdisp.c (display_mode_line): Display mode line elements
one by one when 'mode-line-compact' is non-nil.
(display_mode_element): Record source element number of the
stored string via a text property.
(Fformat_mode_line): Initialize 'mode_line_elt_no' to 0.
(syms_of_xdisp): New symbol for the text property.
Paul Nelson [Mon, 31 Mar 2025 13:37:14 +0000 (15:37 +0200)]
Restrict symbol prettification to displayable glyphs
* lisp/international/mule.el (char-displayable-on-frame-p): New
function used to determine whether a character can be
meaningfully displayed on a given frame.
* doc/lispref/display.texi (Fontsets): Document it.
* lisp/progmodes/prog-mode.el
(prettify-symbols--composition-displayable-p): New function used
to restrict to displayable prettification symbols. This
prevents issues with missing characters appearing as boxes.
(prettify-symbols--make-keywords): Use it. (Bug#77381)
Allow display (optionally) function docstring in eldoc. (Bug#77124)
* etc/NEWS: Document changes.
* lisp/progmodes/elisp-mode.el
(elisp-eldoc-funcall-with-docstring-length): New user option.
(elisp-eldoc-funcall-with-docstring): New function.
Visuwesh [Sun, 23 Mar 2025 05:58:16 +0000 (11:28 +0530)]
Improve formatting of 'setopt' suggestion in *Help* buffer
* lisp/help-fns.el (help--recommend-setopt): Remove function,
and...
(help-fns--customize-variable): ... move the relevant code here
to keep related code in the same place. Change the formatting
to also include the :set function if it is set to a named
function. (Bug#77173)
Stefan Monnier [Sat, 5 Apr 2025 03:53:10 +0000 (23:53 -0400)]
perl-mode.el: Avoid obsolete font-lock face vars
* lisp/progmodes/perl-mode.el (perl-mode-abbrev-table): Merge defvar
into the definition.
(perl-font-lock-keywords-1, perl-font-lock-keywords-2): Avoid obsolete
font-lock face vars.
Paul D. Nelson [Mon, 31 Mar 2025 07:07:07 +0000 (09:07 +0200)]
ediff-current-file: New optional startup-hooks arg
* lisp/vc/ediff.el (ediff-current-file): Add optional
startup-hooks argument, so that the user can write wrapper
commands with more finely customized behavior (bug#77323).
Stefan Monnier [Fri, 4 Apr 2025 20:17:36 +0000 (16:17 -0400)]
Handle `TeX-master` holding a buffer
Cleanup initialization of the syntax tables, while we're at it.
* lisp/textmodes/reftex.el (reftex-syntax-table)
(reftex-syntax-table-for-bib): Move initialization into the declaration.
(reftex--prepare-syntax-tables): Delete function.
(reftex-mode): Delete call to it.
(reftex-TeX-master-file): Handle the case where `TeX-master` holds
a buffer (e.g. because of `reftex-find-duplicate-labels`).
Consolidate the two cases where we prompt the user.
Paul Nelson [Wed, 2 Apr 2025 19:38:48 +0000 (21:38 +0200)]
Add RefTeX support for non-file buffers
* lisp/textmodes/reftex.el (reftex--get-buffer-identifier)
(reftex--get-directory, reftex--abbreviate-name)
(reftex--get-basename, reftex--get-truename): New helper
functions that handle both files and buffer objects.
(reftex--remove-buffer-from-master-index): New helper function.
(reftex-tie-multifile-symbols): Support non-file buffers, using
the above.
(reftex-TeX-master-file): Return current buffer when no file.
(reftex-access-scan-info): Remove check requiring file buffers.
(reftex-access-parse-file, reftex-check-parse-consistency): Skip
for non-file buffers.
(reftex-select-external-document): Use new helper function.
(reftex-locate-file): Return buffer objects directly.
(reftex-get-file-buffer-force): Handle buffer objects and
special 'buffer:' strings.
* lisp/textmodes/reftex-global.el (reftex-create-tags-file): Add
error handling for non-file buffers. Leave TAGS unsupported in
non-file buffers.
(reftex-find-duplicate-labels)
(reftex-isearch-switch-to-next-file): Use new helper functions
that handle both files and buffer objects.
(reftex-isearch-switch-to-next-file): Use equal rather than
string= to compare strings/buffers.
* lisp/textmodes/reftex-index.el (reftex-display-index)
(reftex-index-change-entry): Use new helper functions.
(reftex-index-visit-phrases-buffer): Add error handling for
non-file buffers. Leave phrases unsupported in non-file
buffers.
* lisp/textmodes/reftex-parse.el (reftex-do-parse)
(reftex-parse-from-file): Add support for non-file buffers.
(reftex-all-document-files, reftex-where-am-I)
(reftex-notice-new): Use new helper functions.
* lisp/textmodes/reftex-ref.el (reftex-label-info-update):
Support non-file buffers.
(reftex-label-info, reftex-replace-prefix-escapes, reftex-label)
(reftex-replace-prefix-escapes, reftex-offer-label-menu): Use
new helper functions.
* lisp/textmodes/reftex-sel.el (reftex-insert-docstruct): Use
new helper function.
* lisp/textmodes/reftex-toc.el (reftex-toc)
(reftex-recenter-toc-when-idle): Support non-file buffers.
* lisp/textmodes/reftex-cite.el (reftex-bib-or-thebib)
(reftex-get-bibfile-list): Use new helper functions.
* lisp/textmodes/reftex-global.el
(reftex-save-all-document-buffers, reftex-ensure-write-access):
Ignore non-file buffers.
* lisp/textmodes/reftex-parse.el (reftex-all-document-files):
For non-file objects, do not apply relative path transformation.
* test/lisp/textmodes/reftex-tests.el
(reftex-all-used-citation-keys-buffer)
(reftex-renumber-simple-labels-buffer): New tests for operations
on non-file buffers.
RefTeX historically assumed that the buffers it operates on
visit files. To handle non-file buffers:
Modify reftex-TeX-master-file so that it returns the buffer
object itself (as suggested by Stefan Monnier). Modify each
caller to handle buffer objects, aided by some helper functions
added to reftex.el. Replace 'string=' by 'equal' in places.
Use buffer-base-buffer, where appropriate, to handle indirect
buffers (file and non-file).
TAGS files and phrases buffers remain unsupported for non-file
buffers.
* lisp/textmodes/html-ts-mode.el
(html-ts-mode): Avoid the warning if the html language library is not
installed.
Avoids warning if html language library is not installed
when trying to associate mode with filename patterns.
* lisp/textmodes/html-ts-mode.el: Revert the last changes.
Avoids warning if any of the html, javascript, css language libraries
are not installed when attempting to associate mode with filename
templates.
Michael Albinus [Fri, 4 Apr 2025 12:29:00 +0000 (14:29 +0200)]
Fix Tramp problem with loooongish file names
* lisp/net/tramp-sh.el (tramp-readlink-file-truename): New defconst.
(tramp-bundle-read-file-names): Use new %m and %q format specifiers.
(tramp-sh-handle-file-truename): Use `tramp-readlink-file-truename'.
(tramp-bundle-read-file-names, tramp-get-remote-readlink): Simplify.
(tramp-expand-script): Add format specifiers %m and %q for test
commands. Addapt readlink call.
Reported by Stacey Marshall <stacey.marshall@gmail.com>.
Stephen Berman [Thu, 3 Apr 2025 14:53:35 +0000 (16:53 +0200)]
Fix obsolete documentation of desktop library
* doc/emacs/misc.texi (Saving Emacs Sessions): Replace
documentation of the long-deleted user option
'desktop-clear-preserve-buffers-regexp' with documentation of
'desktop-clear-preserve-buffers'.
Michael Albinus [Tue, 1 Apr 2025 13:24:44 +0000 (15:24 +0200)]
Fix Tramp's file-attributes cache
* lisp/net/tramp-adb.el (tramp-adb-handle-file-executable-p):
Check also for sticky bit.
(tramp-adb-handle-file-readable-p): Simplify.
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-executable-p):
Check also for sticky bit. Force `file-attributes' check.
* lisp/net/tramp-sh.el (tramp-sh-handle-file-executable-p):
Check also for sticky bit.
(tramp-sh-handle-file-readable-p)
(tramp-sh-handle-file-writable-p): Simplify.
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-file-executable-p):
Check also for sticky bit.
(tramp-sudoedit-handle-file-readable-p)
(tramp-sudoedit-handle-file-writable-p): Simplify.
* lisp/net/tramp.el (tramp-use-file-attributes): Fix docstring.
(tramp-handle-file-readable-p, tramp-handle-file-writable-p):
Force `file-attributes' check. Use `file-truename' for symbolic links.
(tramp-check-cached-permissions): New optional argument FORCE.
Fix symlink check. Check also for sticky bit. (Bug#77402)
* test/lisp/net/tramp-tests.el
(tramp-test20-file-modes-without-file-attributes)
(tramp-test21-file-links-without-file-attributes): New tests.
Paul Eggert [Wed, 2 Apr 2025 20:52:30 +0000 (13:52 -0700)]
Pacify gcc -Wclobbered in Freplace_region_contents
* src/editfns.c (Freplace_region_contents): Redo slightly to
pacify gcc -Wclobbered, by hoisting the eassume out of SCHARS and
into the caller later, where it’ll do more good anyway.
Stefan Monnier [Wed, 2 Apr 2025 19:05:02 +0000 (15:05 -0400)]
cl-macs.el: Fix minor merge snafu (bug#77348)
* lisp/emacs-lisp/cl-macs.el (cl-flet, cl-labels): Recover the changes
made in commit 476426168106 and accidentally undone by a later merge of
commit 63adf9dcf53a.
Eli Zaretskii [Wed, 2 Apr 2025 17:25:09 +0000 (20:25 +0300)]
Fix display of wide characters in display margins on TTY frames
* src/xdisp.c (display_line): Remove incomplete glyph sequence of
the last multi-column character, if not all of its glyphs fit in
the marginal area. (Bug#77452)
Eli Zaretskii [Wed, 2 Apr 2025 13:12:03 +0000 (16:12 +0300)]
More thorough fix for image slices on mode/header-line
* src/xdisp.c (note_mode_line_or_margin_highlight): Remove
correction of DX and DY due to image slices, as this is now done
in 'mode_line_string'.
* src/dispnew.c (mode_line_string): Make DX and DY account for
image slices. (Bug#77429)
Stefan Monnier [Tue, 1 Apr 2025 22:06:31 +0000 (18:06 -0400)]
(custom--standard-value-p): New function
* lisp/cus-edit.el (custom-variable-state)
(custom-variable-mark-to-reset-standard): Use `custom--standard-value-p`.
* lisp/custom.el (custom--standard-value-p): New function.
(customize-mark-to-save, custom-push-theme, enable-theme): Use it.
* lisp/help-fns.el (describe-variable): Use `custom--standard-value`.
Extracted from `customize-mark-to-save` by with `ignore-errors`
replaced by `with-demoted-errors`.
Stefan Kangas [Tue, 1 Apr 2025 19:25:33 +0000 (21:25 +0200)]
function-put: signal error with non-symbol
* lisp/subr.el (function-get): Signal an error if given a non-symbol
for consistency with 'get'.
* test/lisp/subr-tests.el (subr-butlast): Test for the above.
Juri Linkov [Tue, 1 Apr 2025 17:17:17 +0000 (20:17 +0300)]
New treesit generic mode 'liquid-generic-ts-mode' (bug#77255)
* lisp/treesit.el (treesit-replace-font-lock-feature-settings):
Check the query language in addition to checking the feature.
(treesit-font-lock-fontify-region): Use treesit-font-lock-setting-*
accessors.
* lisp/treesit-x.el (treesit-generic-mode-setup): Append new
font-lock rules to an existing treesit-font-lock-settings
possibly inherited from the parent.
(treesit-generic-mode-setup): Use treesit-merge-font-lock-feature-list
to merge with an existing feature list inherited from the parent.
(liquid-generic-ts-mode): New treesit generic mode.
(alpinejs-generic-ts-setup): New treesit generic setup.
Since vc-resolve-conflicts is referenced in backend files, which only
require vc at runtime, move it to vc-hooks to avoid a void
variable error. (Bug#3860)
Eli Zaretskii [Tue, 1 Apr 2025 15:40:59 +0000 (18:40 +0300)]
Fix :map property on sliced images on mode line and header line
* src/xdisp.c (note_mode_line_or_margin_highlight): Fix coordinates
for image slices wrt ':map' keyword when the image is on the mode
line or header line. (Bug#77429)
Vincenzo Pupillo [Mon, 31 Mar 2025 19:49:36 +0000 (21:49 +0200)]
Added a check to see if the 'speedbar-buffer' is still alive
Fix suggested by Rudi Schlatte <rudi@constantly.at>.
* lisp/speedbar.el (speedbar-frame-or-window): Added an additional check
to see if 'speedbar-buffer' is still alive (bug#77405).
Ikumi Keita [Fri, 28 Mar 2025 13:18:42 +0000 (22:18 +0900)]
Suppress error in non-file buffer
* lisp/textmodes/reftex.el (reftex--suppress-nonfile-error): New
variable.
(reftex-TeX-master-file): Don't signal error in non-file buffer.
(AUCTeX bug#76615)
Earl Hyatt [Thu, 13 Mar 2025 03:01:49 +0000 (23:01 -0400)]
Add cl-with-accessors
* lisp/emacs-lisp/cl-macs.el (cl-with-accessors): New macro.
* doc/misc/cl.texi (Structures): Mention the new macro.
* test/lisp/emacs-lisp/cl-macs-tests.el (cl-lib-struct-with-accessors):
New Test.
* etc/NEWS (New macro 'cl-with-accessors'.): Mention the macro.
This macro is useful when making repeated use of a structures accessor
functions, such as reading from a slot and then writing to a slot. It
is similar to 'with-slots' from EIEIO, but uses accessor functions
instead of slot names.
Juri Linkov [Mon, 31 Mar 2025 17:40:17 +0000 (20:40 +0300)]
Improve logic of tab handling when quitting windows (bug#71386)
* lisp/window.el (window-deletable-p): Add tab logic that returns
the symbol 'tab' for a set of predefined conditions.
(window--delete): Call 'tab-bar-close-tab' when 'window-deletable-p'
returns the symbol 'tab'.
(quit-restore-window): Remove tab logic and merge it with frame logic.
* test/lisp/tab-bar-tests.el (tab-bar-tests-close-other-tabs-default)
(tab-bar-tests-close-other-tabs-with-arg): Clean up tabs afterwards.
(tab-bar-tests-quit-restore-window): New test.
Eli Zaretskii [Mon, 31 Mar 2025 13:55:49 +0000 (16:55 +0300)]
Fix replace-region in japan-util.el
* lisp/language/japan-util.el (japanese-replace-region): Allow
STRING to be a character in addition to a string. Un-obsolete
it.
(japanese-katakana-region, japanese-hiragana-region)
(japanese-hankaku-region, japanese-zenkaku-region): Call
'japanese-replace-region' instead of 'replace-region-contents'.
(Bug#77397)
Pip Cet [Fri, 28 Mar 2025 02:33:19 +0000 (02:33 +0000)]
Respect narrowed buffers when parsing JSON (bug#77325)
* src/json.c (Fjson_insert): Simplify 'memcpy' argument.
(Fjson_parse_buffer): Only read to ZV, not all the way to Z.
* test/src/json-tests.el (with-all-gap-positions-in-temp-buffer):
New macro.
(json-parse-buffer/restricted): New test.
Eli Zaretskii [Sun, 30 Mar 2025 07:29:57 +0000 (10:29 +0300)]
Fix display of overlay arrow immediately after invisible text
* src/xdisp.c (overlay_arrow_at_row): Allow the overlay arrow's
marker position to be anywhere between the row's start and end
charpos. This keeps the overlay arrow on display even when the
preceding text is invisible. (Bug#54843)