Sean Whitton [Fri, 4 Oct 2024 00:19:40 +0000 (08:19 +0800)]
icomplete-completions: Revise computation of prospects-len
* lisp/icomplete.el (icomplete-completions): Revise computation of
prospects-len (i) to avoid calling string-width on the entire
buffer-string, which could be slow; and (ii) to better handle minibuffer
prompts with embedded newlines (bug#72826).
Eli Zaretskii [Fri, 4 Oct 2024 13:32:13 +0000 (16:32 +0300)]
Expand email abbrevs in X-Debbugs-Cc header.
* lisp/mail/mailabbrev.el (mail-abbrev-mode-regexp):
* lisp/mail/mailalias.el (mail-address-field-regexp)
(mail-complete-alist): Add "X-Debbugs-Cc" to headers where email
aliases should be expanded, for compatibility with emacsbug.el.
Eli Zaretskii [Fri, 4 Oct 2024 11:39:50 +0000 (14:39 +0300)]
Fix 'list-tags' when invoked from a non-file buffer
This use case was broken by the improvement that attempts to
offer the current buffer's file name as the default file whose
tags to list.
* lisp/progmodes/etags.el
(tags--get-current-buffer-name-in-tags-file): Doc fix. Return nil
if no file is associated with the current buffer, and avoid
signaling an error if 'buffer-file-name' returns nil. (Bug#37611)
(list-tags): Doc fix. Signal an error if the user specifies no
file name at the prompt.
* doc/emacs/maintaining.texi (List Identifiers): Fix wording of
the documentation of 'list-tags'.
Sean Whitton [Fri, 4 Oct 2024 09:28:38 +0000 (17:28 +0800)]
count-windows: Fix reference to walk-windows
* lisp/window.el (count-windows): Refer to walk-windows for the
precise meaning of both the MINIBUF and ALL-FRAMES arguments,
not just the ALL-FRAMES argument. In both functions, these
arguments are both passed through to window-list-1.
john muhl [Sat, 13 Jul 2024 23:36:38 +0000 (18:36 -0500)]
Tag interactive commands in 'lua-ts-mode'
* lisp/progmodes/lua-ts-mode.el (lua-ts-send-buffer)
(lua-ts-send-file, lua-ts-send-region): Mark inferior interaction
commands that are only relevant in Lua buffers. (Bug#73586)
Stefan Kangas [Mon, 30 Sep 2024 22:15:08 +0000 (00:15 +0200)]
Change :group of 'eglot' defgroup to 'tools'
In 'M-x customize', Eglot fits in better in "Programming -> Tools", with
the likes of Flymake and Gud, than it does in "Applications", with ERC
and Newsticker.
* lisp/progmodes/eglot.el (eglot): Change :group of defgroup to 'tools'.
Stefan Kangas [Mon, 30 Sep 2024 18:37:27 +0000 (20:37 +0200)]
Remove out-of-date documentation from python.el
* lisp/progmodes/python.el: Remove out-of-date documentation about
automatic indentation; 'electric-indent-mode' is enabled by default in
Emacs 24.4 or later, so this is no longer an issue.
Visuwesh [Wed, 2 Oct 2024 08:18:25 +0000 (13:48 +0530)]
Add imenu index function for DjVu files in doc-view
* lisp/doc-view.el (doc-view-pdfdraw-program): Prefer mutool
over other names.
(doc-view-imenu-enabled): Tweak the default value to check for
'djvused', and make it obsolete.
(doc-view--djvu-outline, doc-view--parse-djvu-outline): Add new
functions to return imenu index for a Djvu file.
(doc-view--outline): Add new function to create the imenu index
depending on the file type.
(doc-view--outline): Document new possible variable value.
(doc-view-imenu-index): Use the above function instead.
(doc-view-imenu-setup): Try to create the imenu index
unconditionally.
* doc/emacs/misc.texi (DocView Navigation): Mention index
creation using 'djvused' too.
* etc/NEWS: Announce the change. (Bug#73530)
Dmitry Gutov [Thu, 3 Oct 2024 19:03:09 +0000 (22:03 +0300)]
xref-location-marker: Use find-file-noselect to ensure uptodateness
* lisp/progmodes/xref.el (xref-location-marker):
Always call 'find-file-noselect' rather than 'get-file-buffer' to
go through the visited-file-modtime verification every time.
Stefan Monnier [Thu, 3 Oct 2024 18:32:09 +0000 (14:32 -0400)]
track-changes.el: Improve error tracing to help debugging
Add a new `trace` setting for `track-changes-record-errors` to
record more information in order to try and help find the root
cause of errors.
* lisp/emacs-lisp/track-changes.el (track-changes--trace): New var.
(track-changes-record-errors): Document new `trace` setting.
(track-change--backtrace, track-changes--trace): New functions.
(track-changes--recover-from-error): Use them.
(track-changes--error-log): Document new format.
(track-changes-register, track-changes-unregister)
(track-changes-fetch, track-changes--before, track-changes--after):
Call `track-changes--trace`.
Stefan Monnier [Thu, 3 Oct 2024 15:55:58 +0000 (11:55 -0400)]
(key-translate-select): Minor tweaks
* lisp/keymap.el (key-translate-select): Rename from
`key-select-translation` so as to stick to the `key-translate-` prefix.
Silence compilation warning.
Hugo Heagren [Sun, 4 Aug 2024 11:54:27 +0000 (12:54 +0100)]
Add commands to interactively set/unset keyboard translations
* lisp/keymap.el (key-translate): Add an interactive form, prompting for
keys to translate, and update docstring to reflect this.
(key-translate-selection-function): New custom option.
(key-select-translation): New function, default value of above option.
(key-translate-remove): New command, for removing entries from
`keyboard-translate-table'.
Sean Whitton [Thu, 3 Oct 2024 10:36:45 +0000 (18:36 +0800)]
New M-~ entry in save-some-buffers-action-alist
* lisp/files.el (save-some-buffers-action-alist): New M-~ entry.
(save-some-buffers):
* doc/emacs/files.texi (Save Commands):
* etc/NEWS: Document the new M-~ binding during C-x s.
Eli Zaretskii [Thu, 3 Oct 2024 10:32:10 +0000 (13:32 +0300)]
Avoid assertion violations due to wrong 'min-width' property
* src/xdisp.c (display_min_width): Ignore 'min-width' display
specs which produce stretch glyphs wider than the window when
lines are truncated. (Bug#73600)
Teach term the difference between an unset foreground or
background color and a color that happens to match an existing
color. This way, when we insert text after a color
reset:(e.g. from an SGR0), we insert it without :foreground or
:background (whichever we've reset) face properties, allowing
that inserted text to inherit the colors of the underlying face.
This way, if we change, e.g., the background color of a buffer,
the background color of already-inserted text from the term
child changes along with that of the buffer instead of being
"locked" to whatever the background color of the buffer was at
the time the text was inserted.
This change aligns term.el with other terminal emulators.
Dmitry Gutov [Thu, 3 Oct 2024 01:17:35 +0000 (04:17 +0300)]
Make xref-find-references work in Help buffers outside of projects
* lisp/help-fns.el (xref-backend-references):
New context-dependent override. Don't call project-current and
use elisp-load-path-roots directly (bug#69462).
(help-fns--setup-xref-backend): No need to set
project-vc-external-roots-function then.
Sean Whitton [Wed, 2 Oct 2024 07:23:06 +0000 (15:23 +0800)]
New function shell-command-do-open
* lisp/dired-aux.el (shell-command-do-open): Factor out of
dired-do-open.
(dired-do-open): Call shell-command-do-open.
* etc/NEWS: Announce the new function.
Sean Whitton [Wed, 2 Oct 2024 01:22:52 +0000 (09:22 +0800)]
Move error check from vc-next-action to diff-vc-deduce-fileset
* lisp/vc/diff-mode.el (diff-vc-deduce-fileset): Signal
user-error when the buffer is narrowed.
* lisp/vc/vc.el (vc-next-action): Remove code signalling a
user-error when the buffer is narrowed.
Stefan Kangas [Wed, 2 Oct 2024 00:28:52 +0000 (02:28 +0200)]
Warn about bad defcustom :local keyword at compile time
* lisp/emacs-lisp/bytecomp.el (bytecomp--custom-declare): Warn about
invalid values for the defcustom :local keyword.
* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp-test-defcustom-local): New test.
Stefan Kangas [Tue, 1 Oct 2024 23:03:08 +0000 (01:03 +0200)]
New value 'permanent-only' for defcustom :local keyword
* lisp/custom.el (custom-declare-variable): Make the :local keyword
accept the symbol 'permanent-local', meaning that the variable is
permanent but not marked as automatically buffer-local.
(defcustom):
* doc/lispref/customize.texi (Variable Definitions): Document the
above change.
* test/lisp/custom-tests.el
(custom-tests-defcustom-:local-keyword): New test.
Stefan Monnier [Tue, 1 Oct 2024 18:46:06 +0000 (14:46 -0400)]
* lisp/emacs-lisp/package.el (package-isolate): Use `package-activate-all`
`package-initialize` is used to initialize the whole machinery needed
to list/download/install/remove packages, whereas here we only need to use
the installed packages.
Sean Whitton [Mon, 30 Sep 2024 13:08:38 +0000 (21:08 +0800)]
New command diff-delete-other-hunks
* lisp/vc/diff-mode.el (diff-delete-other-hunks): New
command (bug#73387).
(diff-mode-map): Bind the new command to C-c RET n.
(diff-mode-menu): New entry for the new command.
(vc-next-action): Stop, and warn, if the user attempts to commit
a patch from a narrowed buffer (bug#73387).
* doc/emacs/files.texi (Diff Mode):
* etc/NEWS: Document the new command.
oscar [Mon, 23 Sep 2024 21:04:36 +0000 (23:04 +0200)]
Fix redirection of read when _FORTIFY_SOURCE is defined
When _FORTIFY_SOURCE is defined mingw-w64 provides an inline definition
of read in io.h. This makes our previous redirection to sys_read
ineffective. The prototype of sys_read is now required because we don't
touch the prototype of read.
* nt/inc/ms-w32.h (read): Move the redirection after io.h. Add prototype
for sys_read (Bug#73444)
F. Jason Park [Sun, 29 Sep 2024 18:02:48 +0000 (11:02 -0700)]
Remove erc-fill binding for cycling visual movement
* etc/ERC-NEWS: Announce removal of troublesome key binding first
introduced in ERC 5.6 as part of the `erc-fill-wrap' module.
* lisp/erc/erc-fill.el (erc-fill-wrap-mode-map): Remove key binding for
`erc-fill-wrap-cycle-visual-movement'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-wrap-visual-keys--body)
(erc-fill-wrap-visual-keys--prompt): Replace "C-c a" key simulations.
(Bug#73553)
F. Jason Park [Mon, 23 Sep 2024 20:48:19 +0000 (13:48 -0700)]
Skip indentation when gathering faces in erc-track
* lisp/erc/erc-nicks.el (erc-nicks-mode, erc-nicks-enable)
(erc-nicks-disable): Use correct name for `track' module hook.
(erc-nicks--check-normals): Remove falsity from doc string.
* lisp/erc/erc-track.el (erc-make-mode-line-buffer-name): Don't error
when optional COUNT is nil.
(erc-track-modified-channels): Use new name for preferred face-finding
function.
(erc-track--get-faces-in-current-message, erc-track--collect-faces-in):
Rename former to latter to better reflect expanded utility, which now
includes spanning gaps, including newlines and indentation that may be
lacking in face-related properties.
* test/lisp/erc/erc-track-tests.el (erc-track--collect-faces-in): New
test. (Bug#73443)
F. Jason Park [Mon, 9 Sep 2024 22:23:46 +0000 (15:23 -0700)]
Make erc-keep-place-indicator aware of erc-truncate
* etc/ERC-NEWS: Entry mentioning `erc-keep-place-indicator-truncation'.
* lisp/erc/erc-goodies.el (erc-keep-place-indicator-truncation): New
option. Something like this should have accompanied the module's
introduction.
(erc-keep-place-indicator-mode, erc-keep-place-indicator-enable)
(erc-keep-place-indicator-disable): Arrange to take necessary measures
to avoid losing the indicator on `erc--clear-function'. This module was
first introduced by bug#59943.
(erc--keep-place-move-hook): New variable.
(erc--keep-place-indicator-adjust-on-clear): New function.
(erc-keep-place-move): Try to ensure the overlay resides at the
beginning of a message. Run hook `erc--keep-place-move-hook'.
* test/lisp/erc/erc-scenarios-keep-place-indicator-trunc.el: New file.
* test/lisp/erc/erc-scenarios-keep-place-indicator.el
(erc-scenarios-keep-place-indicator--follow): Fix missing test
description. (Bug#72736)
F. Jason Park [Tue, 27 Aug 2024 08:00:04 +0000 (01:00 -0700)]
Redo ERC truncation and /CLEAR hook mechanism
* etc/ERC-NEWS: Mention option `erc-truncate-padding-size'.
* lisp/erc/erc-fill.el (erc-fill-wrap-mode, erc-fill-wrap-enable)
(erc-fill-wrap-disable): Manage membership in the `erc--clear-function'
advice stack for own function that massages a buffer's oldest inserted
message, post truncation.
(erc-fill--wrap-massage-initial-message-post-clear): New function.
* lisp/erc/erc-log.el (erc-log-mode, erc-log-enable): Don't add
`erc-save-buffer-in-logs' to `erc--pre-clear-functions'. Use local
advice around common interface variable instead, as noted below.
(erc-log-disable): Likewise, don't remove `erc-save-buffer-in-logs' from
`erc--pre-clear-functions'.
(erc-log-setup-logging): Add `erc-log--save-on-clear' to
`erc--clear-function'.
(erc-log-disable-logging): Remove `erc-log--save-on-clear' to
`erc-clear-function'.
(erc-save-buffer-in-logs): Abort when `erc--insert-marker' is non-nil.
(erc-log--save-on-clear): New function, a thin wrapper around
`erc-save-buffer-in-logs', adapting it to the `erc--clear-function'
advice interface.
* lisp/erc/erc-stamp.el (erc-stamp-mode, erc-stamp-enable): Don't
add `erc-stamp--reset-on-clear' to `erc--pre-clear-functions'.
(erc-stamp-disable): Don't remove `erc-stamp--reset-on-clear' from
`erc--pre-clear-functions'.
(erc-stamp--find-insertion-point): Account for initial position being
`bobp'.
(erc-stamp--defer-date-insertion-on-post-modify): Accommodate the rare
non-list `erc-insert-post-hook' when shadowing.
(erc-stamp--setup): Add and remove `erc-stamp--reset-on-clear' to and
from `erc--clear-function' advice stack.
(erc-stamp--redo-right-stamp-post-clear): New function.
(erc-stamp--update-saved-position): Remove unused function. This was
originally added along with `erc-stamp--reset-on-clear' as part of
bug#60936.
(erc-stamp--reset-on-clear): Expect end of truncation boundary to be at
`erc-insert-marker'. Rework to use new `erc--clear-function' interface
and run on `erc-timer-hook' instead of `erc-insert-done-hook'.
* lisp/erc/erc-truncate.el (erc-truncate-padding-size): New option to
help tamp down on disruptions when reading scroll back caused by overly
frequent truncation.
(erc-truncate-enable, erc-truncate-disable): Add and remove
`erc-truncate--setup' to and from `erc-mode-hook', and run it when
needed.
(erc-truncate--buffer-size): New variable.
(erc-truncate--setup): New function.
(erc-truncate-buffer-to-size): Guard execution with
`erc-truncate--padding-size' and `erc--inhibit-clear-p'. Reflow for
readability, removing obsolete comments. Call hooks with marker instead
of buffer position, as per the new `erc--clear-function' interface.
(erc-truncate-buffer): Defer execution to `erc-timer-hook' when running
post-insertion via a response handler.
(erc-truncate--inhibit-when-local-and-interactive): New function.
* lisp/erc/erc.el (erc-mode): Add `erc--skip-past-headroom-on-clear'
to `erc--clear-function' in all ERC buffers.
(erc--with-spliced-insertion): Account for marker being `bobp'.
(erc--insert-before-markers-transplanting-hidden): Make more robust by
accommodating initial `point' possibly being `bobp'.
(erc--clear-function): New variable, a function-valued local-advice
interface to replace `erc--pre-clear-functions'.
(erc--pre-clear-functions): Remove unused variable.
(erc--skip-past-headroom-on-clear): New function.
(erc--inhibit-clear-p): New variable.
(erc-cmd-CLEAR): Call hooks with markers instead of position. Signal
`user-error' when `erc--inhbiit-clear-p' is non-nil.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp)
(erc-scenarios-log--cmd-clear/date-stamps): Rename former to latter,
update assertions, and use common helper.
(erc-scenarios-log--cmd-clear/left-stamps): New test.
(erc-scenarios-log--truncate): Move body to function of the same name,
and update assertions.
(erc-scenarios-log--truncate/left-stamps): New test. (Bug#72736)