Juri Linkov [Wed, 9 Jul 2025 06:28:05 +0000 (09:28 +0300)]
Fix tab-bar-format-align-right to not call tab-bar-format-global twice
* lisp/tab-bar.el (tab-bar-format-align-right): Add optional arg 'rest'
to handle it specially in 'tab-bar-format-list'. Use the value from 'rest'
instead of calling format functions twice by 'tab-bar-format-list'.
(tab-bar-format-list): When 'format-list' contains the item
'tab-bar-format-align-right', collect the rest of formatted items
and call 'tab-bar-format-align-right' explicitly with the collected
list (bug#78953).
Abstract the buffering in the reader with a struct and plain functions
instead of rather unhygienic preprocessor macros.
* src/lread.c (READ_AND_BUFFER, INVALID_SYNTAX_WITH_BUFFER):
Removed, replaced with...
(readbuf_t, readbuf_grow, add_char_to_buffer, read_and_buffer)
(invalid_syntax_with_buffer): ...these new functions and struct.
(read0): Use new code instead of old preprocessor macros.
Sean Whitton [Mon, 7 Jul 2025 14:44:34 +0000 (15:44 +0100)]
Resolve FIXME regarding running vc-checkin-hook
Running vc-checkin-hook needs to be delayed in the case of an
async checkin. As a quick fix we had been relying on the
backend checkin functions to run the hook in the async case.
This restores handling running the hook in generic code even for
the async case.
* lisp/vc/vc.el (vc-checkin): Always pass vc-checkin-hook to
vc-start-logentry. Return the result of calling the backend
'checkin-patch' or 'checkin' function to vc-finish-logentry.
* lisp/vc/vc-dispatcher.el (vc-finish-logentry): If the log
operation returns a cons of the form (async . #<process ...>),
use vc-exec-after to delay vc-resynch-buffer and hooks until the
async process completes. Approach suggested by Dmitry Gutov.
* lisp/vc/vc-git.el (vc-git-checkin):
* lisp/vc/vc-hg.el (vc-hg-checkin): For an async checkin, return
a cons (async . #<process ...>) containing the async checkin
process. No longer run vc-checkin-hook.
* lisp/vc/vc.el (with-vc-properties): Return the result of
evaluating FORM.
* lisp/vc/vc-dispatcher.el (vc-exec-after): Change to PROC's
buffer before calling vc-set-mode-line-busy-indicator.
Turn compiler macro defalias messages into warnings
* lisp/emacs-lisp/bytecomp.el (byte-compile-file-form-defalias):
Turn messages into warnings to make them more visible to the user and
provide a source location (bug#78792).
Jim Porter [Wed, 25 Jun 2025 05:50:22 +0000 (22:50 -0700)]
Use short revisions by default when navigating to revisions
* lisp/vc/vc-annotate.el (vc-annotate-revision-previous-to-line)
(vc-annotate-show-diff-revision-at-line-internal)
(vc-annotate-warp-revision): Let-bind 'vc-use-short-revision'
around calls to 'previous-revision' and 'next-revision'.
Jim Porter [Fri, 4 Jul 2025 23:23:45 +0000 (16:23 -0700)]
Show "readable" status in the EWW mode line
* lisp/net/eww.el (eww-display-html): Check whether a readable form of
the document exists; if not, don't set ':readable' to t.
(eww-readable): Check whether a readable form of the document exists; if
not, warn the user and don't add to history.
(eww-readable-dom): Return nil if no readable form exists.
(eww-mode): Check the ':readable' property of 'eww-data' to show
"readable" state in the mode line.
* test/lisp/net/eww-tests.el
(eww-test/readable/default-readable/non-readable-page): New test
(bug#78958).
Sean Whitton [Sun, 6 Jul 2025 12:43:24 +0000 (13:43 +0100)]
vc-checkin: Check whether the fileset or patches have changed
* lisp/vc/vc-dispatcher.el (vc-finish-logentry): Delay popping
to vc-parent-buffer until after calling the log operation.
That way if the log operation exits early, the current buffer
remains *vc-log*.
(vc-dir-marked-files, dired-get-marked-files): Declare.
(vc-dispatcher--explicit-marks-p): New function.
* lisp/vc/vc.el (vc-checkin): Check the user isn't likely to be
surprised by what is included in the checkin. Specifically,
check whether the fileset or patches implied by vc-parent-buffer
are unchanged.
* doc/emacs/maintaining.texi (VC With A Merging VCS): Explain
how the fileset or patch string is fixed once *vc-log* pops up.
Michael Albinus [Sun, 6 Jul 2025 12:41:02 +0000 (14:41 +0200)]
Adapt filenotify-tests.el for Emba
* test/infra/gitlab-ci.yml (.filenotify-gio-template): Enable also
for scheduled jobs.
* test/lisp/filenotify-tests.el (file-notify--test-cleanup):
Fix docstring.
(file-notify--deftest-remote): Use `file-notify--test-cleanup'.
(file-notify-test03-events, file-notify-test05-file-validity)
(file-notify-test06-dir-validity)
(file-notify-test07-many-events)
(file-notify-test09-watched-file-in-watched-dir): Adapt tests.
(file-notify-test03-events-remote)
(file-notify-test04-autorevert-remote)
(file-notify-test07-many-events-remote)
(file-notify-test09-watched-file-in-watched-dir-remote): Do not
tag as :unstable.
Michael Albinus [Sat, 5 Jul 2025 17:21:48 +0000 (19:21 +0200)]
Add file notification handler for Tramp's "smb" method.
* etc/NEWS: Mention new file notification handler for Tramp "smb".
* lisp/filenotify.el (file-notify--expand-file-name): Fix the
remote case.
(file-notify-callback): Extend for "smb-notify".
(file-notify--call-handler): Fix debug message.
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch):
* lisp/net/tramp-sh.el (tramp-sh-gio-monitor-process-filter):
Use connection property "file-monitor".
* lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist):
Use `tramp-smb-handle-file-notify-add-watch'.
(tramp-smb-handle-delete-directory): Do not error if there is a
pending deletion of a directory under file-watch.
(tramp-smb-handle-file-notify-add-watch)
(tramp-smb-notify-process-filter): New defuns.
(tramp-smb-send-command): New optional argument NOOUTPUT.
(tramp-smb-wait-for-output): Improve debug message.
* lisp/net/tramp.el (tramp-directory-watched): New defun.
(tramp-accept-process-output, tramp-wait-for-regexp):
Improve debug message.
* test/lisp/filenotify-tests.el (top): Filter also for
"smb-notify". Set some other Tramp related variables.
(file-notify--test-wait-for-events)
(file-notify--test-with-actions-check)
(file-notify--test-with-actions): Add debug message.
(file-notify--test-cleanup, file-notify--deftest-remote):
Keep Tramp debugs buffer.
(file-notify--test-monitor): Check for "smb-notify".
(file-notify--deftest-remote): Call `file-notify-rm-all-watches'.
(file-notify--test-make-temp-name): Use a better name for parent
directory.
(file-notify--test-event-handler): Use `string-match-p'.
(file-notify--test-with-actions): Check also for the `stopped'
event as limit.
(file-notify-test03-events, file-notify-test04-autorevert)
(file-notify-test05-file-validity)
(file-notify-test07-many-events, file-notify-test08-backup)
(file-notify-test09-watched-file-in-watched-dir): Adapt tests for
"smb-notify".
(file-notify-test12-unmount): Skip for "smb-notify".
Stefan Monnier [Sat, 5 Jul 2025 15:17:51 +0000 (11:17 -0400)]
(eieio--validate-slot-value): Don't break on struct objects
Nowadays `eieio-oset` applies to more than just EIEIO objects.
The old code tended to work OK but only because `eieio--class-slots`
is usually compiled/inlined without checks.
* lisp/emacs-lisp/eieio-core.el (eieio--validate-slot-value):
Don't assume CLASS is an EIEIO class.
Sean Whitton [Sat, 5 Jul 2025 08:49:13 +0000 (09:49 +0100)]
Don't call vc-buffer-sync-fileset when committing a patch
* lisp/vc/vc-dispatcher.el (vc-finish-logentry): Move call to
vc-buffer-sync-fileset from here ...
* lisp/vc/vc.el (vc-checkin): ... to here, and conditionalize so
as not to call when committing a patch. Also fix comment.
Eli Zaretskii [Sat, 5 Jul 2025 08:07:29 +0000 (11:07 +0300)]
Fix 'ediff-before-setup-hook'
* lisp/vc/ediff-util.el
(ediff-clone-buffer-for-region-comparison): Wrap body in
'save-window-excursion', to make sure original window
configuration is restored after quitting 'ediff-regions-linewise'.
Suggested by Aaron Zeng <azeng@janestreet.com>. (Bug#78897)
* lisp/vc/vc.el (vc-find-revision-no-save): After setting
buffer-read-only to non-nil, also run read-only-mode-hook,
and if view-read-only is non-nil, call view-mode-enter.
Sean Whitton [Fri, 4 Jul 2025 11:39:11 +0000 (12:39 +0100)]
VC: New incoming & outgoing diff commands (bug#62940)
* lisp/vc/vc-hooks.el (vc-incoming-prefix-map)
(vc-outgoing-prefix-map): New keymaps.
(vc-use-incoming-outgoing-prefixes): New user option.
* lisp/vc/vc.el (vc-root-diff-incoming, vc-root-diff-outgoing):
New commands (bug#62940).
* doc/emacs/maintaining.texi (VC Change Log):
* etc/NEWS: Document the new commands and option.
Steven Allen [Wed, 2 Jul 2025 21:32:28 +0000 (14:32 -0700)]
Retain the <base> tag when making a page in EWW document readable
The base tag is necessary to correctly resolve relative links.
* lisp/net/eww.el (eww-readable-dom): Retain the base tag in addition to
the title/link tags. (Bug#78948)
* test/lisp/net/eww-tests.el (eww-test--wordy-page): Add a base tag.
(eww-test/readable/default-readable): Test that the base tag is retained.
Sean Whitton [Thu, 3 Jul 2025 19:09:14 +0000 (20:09 +0100)]
VC: Make incoming-revision backend function responsible for fetching
* lisp/vc/vc-hg.el (vc-hg-incoming-revision): Pull the incoming
revision if we don't have it.
(vc-hg-mergebase): Don't invoke 'hg pull'.
* lisp/vc/vc.el: Document that the incoming-revision backend
function, for distributed VCS, should fetch the incoming
revision into local storage.
uniquify-get-unique-names: Return a list with propertized strings
* lisp/uniquify.el (uniquify-get-unique-names): Return a list of
strings, and add text property 'uniquify-orig-buffer' to each,
pointing at the corresponding buffers (bug#77312).
* lisp/progmodes/project.el (project--read-project-buffer):
Look up that property's values here and build the alist.
In [1: 77a4c63fda5] "all" code sections were needlessly nested
below the ";;; Code:" section, which I do not like but can live
with. However, a few sections were missed; nest them here too.
Also put the "frontmatter" code, which in my libraries usually
is the only code located in the ";;; Code:" section, into a new
";;;; Frontmatter" sub-section. That way it is possible again
to cycle to the "show all headings but no code" state.
Sean Whitton [Tue, 1 Jul 2025 14:44:12 +0000 (15:44 +0100)]
VC-Hg: Use generic log-incoming & log-outgoing
* lisp/vc/vc-hg.el (vc-hg-print-log): Implement string LIMIT for
this backend. Use a DAG range when 'vc-log-view-type' is
'log-outgoing'. Document differences between -rN:M and -rN::M.
(vc-hg-log-view-mode): Treat 'log-incoming' and 'log-outgoing'
values for 'vc-log-view-type' as short logs too.
(vc-hg-log-incoming, vc-hg-log-outgoing): Delete.
Sean Whitton [Tue, 1 Jul 2025 14:39:39 +0000 (15:39 +0100)]
vc-hg-mergebase: Try a pull if first attempt fails
* lisp/vc/vc-hg.el (vc-hg-mergebase): If the first attempt
fails, execute a pull, then try again.
(vc-hg-incoming-revision): Use 'hg identify' not 'hg incoming'.
Roi Martin [Tue, 17 Jun 2025 17:21:18 +0000 (19:21 +0200)]
Update `fill-region-as-paragraph-semlf' to follow fill.el protocols
Update the `fill-region-as-paragraph-semlf' function to follow the
`fill-region-as-paragraph-function' protocol. This allows us to
reimplement the `fill-paragraph-semlf' function using `fill-paragraph'
and `fill-region-as-paragraph-function'.
* lisp/textmodes/fill.el (fill-region-as-paragraph-semlf): Make this
function compatible with `fill-region-as-paragraph-function'. Avoid
narrowing.
(fill-paragraph-semlf): Reimplement using `fill-paragraph' and
`fill-region-as-paragraph-function'.
* test/lisp/textmodes/fill-tests.el (fill-test-semlf-fill-region): Add
test.
(fill-test-fill-paragraph-semlf-fill-paragraph-function): Remove test.
(fill-test-fill-paragraph-semlf, fill-test-semlf)
(fill-test-fill-paragraph-semlf-justify, fill-test-semlf-justify)
(fill-test-fill-paragraph-semlf-sentence-end-double-space)
(fill-test-semlf-sentence-end-double-space)
(fill-test-fill-paragraph-semlf-fill-column, fill-test-semlf-fill-column)
(fill-test-fill-paragraph-semlf-punctuation-marks)
(fill-test-semlf-punctuation-marks, fill-test-fill-paragraph-semlf-twice)
(fill-test-semlf-twice, fill-test-fill-paragraph-semlf-fill-prefix)
(fill-test-semlf-fill-prefix)
(fill-test-fill-paragraph-semlf-indented-block)
(fill-test-semlf-indented-block, fill-test-fill-paragraph-semlf-revert)
(fill-test-semlf-revert, fill-test-fill-paragraph-semlf-emacs-lisp-mode)
(fill-test-semlf-emacs-lisp-mode, fill-test-fill-paragraph-semlf-c-mode)
(fill-test-semlf-c-mode, fill-test-fill-paragraph-semlf-org-mode)
(fill-test-semlf-org-mode, fill-test-fill-paragraph-semlf-markdown-mode)
(fill-test-semlf-markdown-mode): User shorter function names consistent
with erts file names.
* test/lisp/textmodes/fill-resources/semlf-fill-region.erts: Add test
data.
* test/lisp/textmodes/fill-resources/semlf-fill-paragraph-function.erts:
Delete file.
* test/lisp/textmodes/fill-resources/semlf-emacs-lisp-mode.erts: Remove
newlines around indented block.
* doc/lispref/text.texi (Filling): Highlight that
`fill-region-as-paragraph-function' changes the behavior of
`fill-paragraph'.
Sean Whitton [Sun, 29 Jun 2025 13:53:37 +0000 (14:53 +0100)]
VC: Fix several START-REVISION versus LIMIT issues
* lisp/vc/vc-git.el (vc-git-print-log): When LIMIT and
START-REVISION are both supplied, use START-REVISION as the
newest commit, and LIMIT as a base (problem was introduced in
the commit adding 'vc-diff-mergebase' and 'vc-log-mergebase').
* lisp/vc/vc.el (vc-default-log-incoming)
(vc-default-log-outgoing): Fix order of START-REVISION and LIMIT
arguments passed to 'print-log' backend function.
(vc-log-mergebase): Fix order of START-REVISION and LIMIT
arguments passed to 'vc-print-log-internal'.
Roi Martin [Tue, 17 Jun 2025 08:45:13 +0000 (10:45 +0200)]
Add variable `fill-region-as-paragraph-function'
Add the variable `fill-region-as-paragraph-function' to provide
a way to override how functions like `fill-region' fill text.
* doc/lispref/text.texi (Filling): Document
`fill-region-as-paragraph-function' variable.
* doc/emacs/text.texi (Fill Commands): Reference
`fill-region-as-paragraph-function' variable.
* lisp/textmodes/fill.el (fill-region-as-paragraph-function):
Add variable.
(fill-region-as-paragraph): Convert into
`fill-region-as-paragraph-function' wrapper.
(fill-region-as-paragraph-default): Rename old
`fill-region-as-paragraph' function.
(fill-region-as-paragraph-semlf): Update calls to
`fill-region-as-paragraph-default'.
(fill-region): Add reference to `fill-region-as-paragraph-function'
in doc string.
* test/lisp/textmodes/fill-tests.el (fill-test-fill-region): Add
test case for the `fill-region' function.
* test/lisp/textmodes/fill-resources/fill-region.erts: Add test
data. (Bug#78816)
Pip Cet [Sat, 28 Jun 2025 09:33:01 +0000 (09:33 +0000)]
Avoid extra output in Vprin1_to_string_buffer (bug#78842)
print_error_message can throw after producing some output, so use
unwind-protect to ensure prin1-to-string-buffer is cleared.
* src/print.c (erase_prin1_to_string_buffer): New.
(Ferror_message_string): Use it to catch errors thrown in
'print_error_message'.
* test/src/print-tests.el (error-message-string-circular): Expand
test.
Align the js-ts-mode entry with the javascript-mode entries in the
default auto-mode-alist value in lisp/files.el. Otherwise, js-ts-mode is
not associated with .js files.