Lin Sun [Mon, 20 May 2024 06:55:31 +0000 (06:55 +0000)]
Enhance 'python-shell-send-block' for convenience
* lisp/progmodes/python.el (python-shell-send-block):
'python-shell-send-block' will now send block without header
by default.
* test/lisp/progmodes/python-tests.el
(python-test--shell-send-block): Update the test case.
(Bug#71083)
Dmitry Gutov [Sat, 25 May 2024 21:58:57 +0000 (00:58 +0300)]
xref-revert-buffer: Make inhibit-modification-hooks binding a bit safer
* lisp/progmodes/xref.el (xref-revert-buffer): Make sure that the
inhibit-modification-hooks binding does not cover xref--fetcher
funcall. Only the printing step (issue mentioned in bug#53749).
Eli Zaretskii [Sat, 25 May 2024 11:23:43 +0000 (14:23 +0300)]
Avoid assertion violations in displaying under 'outline-minor-mode'
* src/xdisp.c (init_from_display_pos): Initialize BYTEPOS
correctly, since 'init_iterator' no longer computes it from
CHARPOS as needed. This fixes a change made on Mar 13, 2013.
(Bug#71194)
Eli Zaretskii [Sat, 25 May 2024 10:22:45 +0000 (13:22 +0300)]
Improve documentation of 'no-special-glyphs' frame parameter
* doc/lispref/frames.texi (Layout Parameters): Document
limitations of support for 'no-special-glyphs' frame parameter.
(Bug#71163)
* doc/lispref/display.texi (Truncation): Update for when
'fringe-mode' is off.
Eli Zaretskii [Sat, 25 May 2024 06:12:42 +0000 (09:12 +0300)]
Fix encoding of text when saving a gpg-encoded file
* lisp/epa-file.el (epa-file-write-region): Revert inadvertent
change from July 15, 2020 which broke selection of a correct
encoding for stuff sent to 'gpg'. (Bug#71080)
Robin Joy [Fri, 24 May 2024 12:26:39 +0000 (14:26 +0200)]
Erase existing duplicates in eshell-history-ring
Erase all existing duplicates instead of just the last duplicate entry
when 'eshell-hist-ignoredups' is set to 'erase'. Multiple duplicates
can exist in case 'eshell-hist-ignoredups' was set to something else
than 'erase' in the past or if the history file contains duplicates
(bug#71107).
* lisp/eshell/em-hist.el (eshell-add-input-to-history): Remove all
duplicates from history ring.
* test/lisp/eshell/em-hist-tests.el
(em-hist-test/add-to-history/erase-existing-dups): New test.
Spencer Baugh [Wed, 22 May 2024 12:28:07 +0000 (08:28 -0400)]
Fix usage of cons cells in grep-find-ignored-files
grep-find-ignored-files is documented to also include cons
cells, not just globs, but there were two places outside grep.el
where we were using it as if it was only a string list.
To fix this, add a helper function named grep-find-ignored-files
which handles grep-find-ignored-files properly and returns the
list of globs, and use it everywhere.
* lisp/progmodes/grep.el (grep--filter-list-by-dir)
(grep-find-ignored-files): New functions.
(rgrep-find-ignored-directories): Use grep--filter-list-by-dir.
(lgrep, rgrep-default-command):
Use grep-find-ignored-files function.
* lisp/dired-aux.el (dired-do-find-regexp):
Use grep-find-ignored-files function.
* lisp/progmodes/project.el (project-ignores):
Use grep-find-ignored-files function, if bound. (bug#71115)
Tassilo Horn [Fri, 24 May 2024 19:52:34 +0000 (21:52 +0200)]
bug-reference: signal fontified bounds back to jit-lock (bug#70796)
* lisp/progmodes/bug-reference.el (bug-reference-fontify): Signal
fontified bounds back to jit-lock in order to allow for redisplay
optimizations (bug#70796).
* lisp/dired.el (dired-guess-shell-alist-user):
* lisp/dired-aux.el (dired-do-shell-command):
Add dired-guess-shell-alist-optional to docstring.
(dired-guess-shell-alist-default): Move media commands to
'dired-guess-shell-alist-optional'.
(dired-guess-shell-alist-optional): New variable.
(dired-guess-default): Add 'dired-guess-shell-alist-optional'
to the end after 'dired-guess-shell-alist-user'
and 'dired-guess-shell-alist-default'.
(shell-command-guess-functions): Add more options.
(shell-command-guess-dired): Remove function.
(shell-command-guess-dired-user)
(shell-command-guess-dired-default)
(shell-command-guess-dired-optional): New functions.
kobarity [Fri, 24 May 2024 13:50:12 +0000 (22:50 +0900)]
Fix Python font lock of chained assignment statement
* lisp/progmodes/python.el
(python-font-lock-keywords-maximum-decoration): Allow chaining
of single assignment statements.
* test/lisp/progmodes/python-tests.el
(python-font-lock-assignment-statement-20): New test.
(Bug#71093)
Improve 'key-translate' to support removing translations
This patch enhances the key-translate function to allow removing
keyboard translations by passing nil as the second argument (TO).
If TO is nil, any existing translation for the FROM key will be
removed. The compiler macro is updated to only check TO when it
is non-nil. This change makes key-translate more consistent with
the behavior of 'keyboard-translate', providing a way to remove
translations without having to specify the same key for both FROM
and TO.
The documentation string is updated to reflect the new behavior.
* lisp/keymap.el (key-translate): Support removing translations
by passing nil as the second argument (TO). Also signal an error
if multiple items are passed. (Bug#70139)
Lin Sun [Fri, 3 May 2024 06:52:22 +0000 (06:52 +0000)]
Enhance python-tests to adapt different Python interpreters (bug#70815)
* test/lisp/progmodes/python-tests.el
(python-tests-get-shell-interpreter): New function to get Python
interpreter for testing; and also introduce new env variable
EMACS_PYTHON_INTERPRETER to support customer Python interpreter.
Eli Zaretskii [Thu, 23 May 2024 09:51:19 +0000 (12:51 +0300)]
Fix uncompressing a .tar.gz archive whose files have no leading dir
* lisp/dired-aux.el (dired-compress): Handle the case when
NEW-FILE is not produced in the current directory by uncompressing
a compressed file. (Bug#47058)
Po Lu [Thu, 23 May 2024 07:19:46 +0000 (15:19 +0800)]
Restore specbound keyboard-locals in the correct KBOARD
* doc/lispref/variables.texi (Intro to Buffer-Local): Fix typo
in documentation.
* src/data.c (KBOARD_OBJFWDP): Move to lisp.h.
(kboard_for_bindings): New variable.
(do_symval_forwarding, store_symval_forwarding): Call
kboard_for_bindings rather than retrieving this value directly.
(set_default_internal): New argument WHERE; if valcontents be a
Lisp_Kboard_Objfwd and WHERE be specified, save the binding
there. All callers changed.
* src/eval.c (specpdl_where): Adjust for changes in structure
layout.
(specpdl_kboard): New function.
(do_specbind): Clear let->where.kbd in ordinary SPECPDL_LETs,
and set it to the kboard where the binding will be installed if
binding keyboard forwards.
(specbind, do_one_unbind, specpdl_unrewind): Provide
specpdl_kboard in invocation of set_default_internal.
* src/keyboard.c (delete_kboard): Clean thread specpdls of
references to kboards.
* src/keyboard.h (KBOARD_OBJFWDP): Move from data.c.
* src/lisp.h (union specbinding) <let.where>: Convert into
union of KBOARD and Lisp_Object.
`rm lisp/emacs-lisp/cl-preloaded.elc src/bootstrap-emacs`
followed by `make` ended up loading right after defining
`built-in-class-p` but before actually defining the
built-in-classes so the computation of bitsets failed.
Po Lu [Wed, 22 May 2024 14:00:02 +0000 (22:00 +0800)]
Improve compatibility with Android's default text editor
* java/org/gnu/emacs/EmacsView.java (showOnScreenKeyboard):
Request a selection update if `inputConnection' has been
established, to more closely emulate the OS text editing widget.
(onCreateInputConnection) [EmacsService.DEBUG_IC]: Print current
selection values before reporting them.
Juri Linkov [Tue, 21 May 2024 17:22:31 +0000 (20:22 +0300)]
Use read-from-minibuffer instead of read-string for dired-do-touch
* lisp/dired-aux.el (dired-mark-read-string): Use read-from-minibuffer
instead of read-string when op-symbol is 'touch', since it's more clear
when read-from-minibuffer returns an empty string for RET,
and it was used in dired-mark-read-string initially (bug#70725).
Michael Albinus [Tue, 21 May 2024 16:13:40 +0000 (18:13 +0200)]
Fix some Tramp oddities
* lisp/net/tramp-container.el: Move connection-local settings
where they belong to.
* lisp/net/tramp-sshfs.el (tramp-connection-properties): Do not
set connection property "direct-async-process".
(tramp-direct-async-process): Set connection-local value.
* test/lisp/net/tramp-tests.el (comp-warn-primitives): Declare.
(tramp-test18-file-attributes): Use it.
Stephen Berman [Tue, 21 May 2024 13:04:43 +0000 (15:04 +0200)]
; Avoid byte-compiler warning in todo-mode.el differently
* lisp/calendar/todo-mode.el (todo-mode-map): Define it without a
value before its use in 'todo-insert-item--next-param' to pacify
the byte-compiler.
(todo-insert-item--next-param): Move back to its previous location
to keep it under the outline heading with related code.
Eli Zaretskii [Tue, 21 May 2024 11:17:24 +0000 (14:17 +0300)]
; Avoid byte-compiler warning in todo-mode.el
* lisp/calendar/todo-mode.el (todo-insert-item--next-param): Move
to after the definition of 'todo-mode-map', which this function
uses. This avoids byte-compiler warning.
Stephen Berman [Tue, 21 May 2024 09:04:17 +0000 (11:04 +0200)]
Fix todo-mode item insertion bug (bug#70937)
* lisp/calendar/todo-mode.el (todo-insert-item--next-param):
Initially assign each key in todo-mode-map a function identifying
it as invalid for item insertion, thus preventing mistakenly
pressing a key from executing an unwanted different todo-mode
command; the actual item insertion keys are redefined when looping
over the item insertion parameters.
Juri Linkov [Tue, 21 May 2024 06:16:18 +0000 (09:16 +0300)]
Fix for 'vc-default-patch-addressee' recently added to .dir-locals.el
* lisp/vc/vc.el: Add autoloaded setting of 'safe-local-variable' property
for 'vc-default-patch-addressee' exactly like it's already done
for 'vc-prepare-patches-separately'.
Jared Finder [Tue, 21 May 2024 02:21:29 +0000 (19:21 -0700)]
Do not message for repeated enable/disable of tab-line-mode
tab-line-mode should not inform the user of an unexpected change
when enabling the mode if already enabled. For example, when
running (tab-line-mode 1) repeatedly (bug#68765).
* lisp/tab-line.el (tab-line-mode): Modify case when user is informed.
Jim Porter [Mon, 20 May 2024 19:37:22 +0000 (12:37 -0700)]
Improve implementation of 'forward-thing' using custom providers
Now, call all the custom providers for each step, using the provider
that moves point the smallest non-zero amount. This allows multiple
providers for a given "thing" to work nicely together.
* lisp/thingatpt.el (forward-thing-provider-alist): Update docstring.
(forward-thing): New implementation to call each provider N times.
(forward-thing-for-text-property): Take BACKWARD instead of N. Update
callers.
* test/lisp/thingatpt-tests.el (thing-at-point-providers)
(forward-thing-providers): Add more checks.
(consecutive-things-at-point): New test.
Michael Albinus [Mon, 20 May 2024 14:22:17 +0000 (16:22 +0200)]
Tramp code cleanup
* lisp/net/tramp-sh.el (tramp-find-shell, tramp-find-inline-compress)
(tramp-get-remote-path):
* lisp/net/tramp-smb.el (tramp-smb-handle-process-file):
Use `tramp-warning'.
* test/lisp/net/tramp-tests.el (tramp--test-container-p):
Add "kubernetes", "run0" and "nspawn".
(tramp--test-toolbox-p): New defun.
(tramp-test45-asynchronous-requests): Use it.
(tramp--test-check-files): Adapt regexp.
Eli Zaretskii [Mon, 20 May 2024 12:29:39 +0000 (15:29 +0300)]
Fix visiting zip archives inside tar archives
* lisp/tar-mode.el (tar-archive-from-tar): New local variable.
(tar-extract): Set it non-nil for an extracted member that happens
to be arc-mode archive.
* lisp/arc-mode.el (tar-archive-from-tar): Defvar it.
(archive-unique-fname): Make sure FNAME can be created in DIR,
even if FNAME is provided as an absolute file name (this happens
if the archive is a member of a Tar archive, for example).
(archive-extract): Set 'archive-remote' for archives that were
extracted from Tar archives. (Bug#70987)
Juri Linkov [Mon, 20 May 2024 06:22:10 +0000 (09:22 +0300)]
New tests for nested archives (bug#70987)
* test/lisp/tar-mode-tests.el (tar-mode-test-tar-extract-zip-and-gz):
* test/lisp/arc-mode-tests.el (arc-mode-test-zip-extract-tar-and-gz):
New tests.
* test/data/decompress/tzg.tar.gz:
* test/data/decompress/ztg.zip:
New data files to test decompressing of different combinations
of nested tar and zip archives.
Jim Porter [Sat, 11 May 2024 18:41:11 +0000 (11:41 -0700)]
Tell direction in prompts for '(previous|next)-matching-history-element'
Previously, this always said "Previous" for
'previous-matching-history-element' (likewise "Next"). Now, the prompt
accounts for a negative prefix argument changing the search direction
(bug#70882).
* lisp/simple.el (previous-matching-history-element)
(next-matching-history-element): Consult numeric prefix argument to
determine the prompt string.
Jim Porter [Mon, 29 Apr 2024 04:19:53 +0000 (21:19 -0700)]
Allow defining custom providers for more "thingatpt" functions
This also fixes an issue in EWW and bug-reference-mode where
(thing-at-point 'url) at the end of a URL would return nil.
See <https://lists.gnu.org/archive/html/emacs-devel/2024-02/msg00200.html>.
* lisp/thingatpt.el (forward-thing-provider-alist)
(bounds-of-thing-at-point-provider-alist): New variables...
(forward-thing, bounds-of-thing-at-point): ... use them.
(text-property-search-forward, text-property-search-backward)
(prop-match-beginning, prop-match-end): Declare.
(thing-at-point-for-text-property, forward-thing-for-text-property)
(bounds-of-thing-at-point-for-text-property): New functions.
* lisp/net/eww.el (eww--url-at-point): Use
'thing-at-point-for-text-property'.
(eww--bounds-of-url-at-point, eww--forward-url): New functions...
(eww-mode): ... use them.
* lisp/progmodes/bug-reference.el (bug-reference--url-at-point): Use
'thing-at-point-for-text-property'.
(bug-reference--bounds-of-url-at-point, bug-reference--forward-url): New
functions...
(bug-reference--init): ... use them.
* test/lisp/thingatpt-tests.el (thing-at-point-providers)
(forward-thing-providers, bounds-of-thing-at-point-providers): New
tests.
Paul Eggert [Sun, 19 May 2024 15:48:52 +0000 (08:48 -0700)]
Tweak STORE_NUMBER arg type
* src/regex-emacs.c (STORE_NUMBER): Make the arg int, not int16_t.
There’s no need for the caller to convert to int16_t, and using
int makes the machine code a bit smaller (and presumably a bit
faster) on x86-64 with GCC 14.
Paul Eggert [Sun, 19 May 2024 15:42:57 +0000 (08:42 -0700)]
Port knuth_hash to odd platforms
* src/lisp.h (hash_hash_t, knuth_hash): Use unsigned int and
unsigned long long int rather than uint32_t and uint64_t, as POSIX
does not guarantee the presence of uint64_t, and uint32_t and
uint64_t both in theory have problems with undefined behavior on
integer overflow. This doesn’t affect behavior (or even machine
code) on typical platforms.
Paul Eggert [Sat, 18 May 2024 20:18:32 +0000 (13:18 -0700)]
Pacify -Wanalyzer-null-dereference in sfnt.c
* src/sfnt.c (sfnt_map_table, sfnt_read_table)
(sfnt_read_cvar_table): Pacify GCC -Wanalyzer-null-dereference.
The change to sfnt_read_cvar_table fixes what appears to be
an actual null-dereference bug.
When PIXELWISE is nil, we still calculate width in pixels and
then convert it to columns. However, part of the calculation
was using columns where it should have used pixels. (Bug#70894)
Po Lu [Sun, 19 May 2024 01:46:26 +0000 (09:46 +0800)]
Fix the DJGPP build
* config.bat: Generate stdbit.in-h from stdbit.in.h.
* msdos/sedlibmk.inp (GL_STDC_...): Enable generation
of ISO C2x features.
(STDBIT_H): Define to stdbit.h.
(GL_GENERATE_STDBIT_H_CONDITION): Define to 1.
F. Jason Park [Thu, 9 May 2024 02:03:58 +0000 (19:03 -0700)]
Reconcile erc-stamp--date-stamps when merging buffers
* etc/ERC-NEWS: Mention new face `erc-information'.
* lisp/erc/erc-button.el (erc-button-add-buttons): Skip buttonization
when the "msg prop" `erc--skip' is present and contains the symbol
`button'. Set `alist' to nil in the same guard condition as a
roundabout way of suppressing further processing.
* lisp/erc/erc-networks.el (erc--insert-admin-message): Forward
declaration.
(erc-networks--insert-transplanted-content)
(erc-networks--transplant-buffer-content): Replace former with latter.
Change signature to take source and destination buffers as parameters.
(erc-networks--transplant-target-buffer-function): New function-valued
variable.
(erc-networks--target-transplant-in-progress-p): New variable, a flag
for downstream code to detect when a transplant is underway.
(erc-networks--reclaim-orphaned-target-buffers): Defer to
`erc-networks--transplant-target-buffer-function' to handle the actual
transplant business. Crucially, kill the buffer afterwards instead of
beforehand. If new buffer-association bugs emerge related to the
combining of old or renamed target buffers, this reordering may be at
fault.
(erc-networks--copy-over-server-buffer-contents): Pass old and new
buffers to `erc-networks--insert-transplanted-content'.
* lisp/erc/erc-stamp.el
(erc-stamp--defer-date-insertion-on-post-modify): Set `fn' slot of
`erc-stamp--date' instance to `ignore' when running the actual
callback in order to conserve a little space.
(erc-stamp--date-mode): Add and remove hook members for
`erc-networks--copy-server-buffer-functions' and
`erc-networks--transplant-target-buffer-function'.
(erc-insert-timestamp-left-and-right): Always clear
`erc-timestamp-last-inserted-right' to ensure a right stamp
accompanies every date stamp.
(erc-stamp--dedupe-date-stamps)
(erc-stamp--dedupe-date-stamps-from-buffer)
(erc-stamp--dedupe-date-stamps-from-target-buffer): New functions.
Date stamp behavior was revamped as part of bug#60936.
* lisp/erc/erc.el (erc-informational): New face.
(erc--insert-admin-message): New function to hide some "msg prop"
complexity from "upstream" libraries, like `erc-networks', and thus
avoid more forward-declarations. A less smelly approach would be to
devise a general interface owned by such libraries, or erc-common,
that `erc-mode' could then hook into on init.
(erc-display-message-highlight): Make face matching more limber to
accommodate the convention of face names lacking a "-face" suffix.
(erc-message-english-graft): New variable.
(erc-kill-channel): Inhibit execution of hook when
`erc-networks--target-transplant-in-progress-p' is non-nil.
* test/lisp/erc/erc-networks-tests.el
(erc-networks--rename-server-buffer--no-existing--orphan)
(erc-networks--rename-server-buffer--existing--reuse)
(erc-networks--rename-server-buffer--local-match)
(erc-networks--rename-server-buffer--local-nomatch): Use helper to
initialize markers.
* test/lisp/erc/erc-stamp-tests.el (erc-stamp--dedupe-date-stamps):
New test. (Bug#70928)
F. Jason Park [Wed, 15 May 2024 04:09:55 +0000 (21:09 -0700)]
Don't kill server buffer with erc-kill-buffer-on-part
* etc/ERC-NEWS: Mention new flag `erc-killing-buffer-on-part-p' and
the renaming of `erc-kill-channel'.
* lisp/erc/erc-backend.el (erc-server-PART): Only kill a buffer on
behalf of `erc-kill-buffer-on-part' when the buffer hasn't already
been killed, and bind `erc-killing-buffer-on-part-p' to t when doing
so.
* lisp/erc/erc-log.el (erc-conditional-save-buffer): Don't save logs
when the buffer parameter is nil because that causes the server buffer
to be saved out. It's possible that user code relying on this
longstanding bug will be affected, however, by default, the server
buffer will also be saved out independently at designated junctures.
* lisp/erc/erc.el (erc-part-hook): Redo doc string.
(erc-killing-buffer-on-part-p): New variable, a flag to prevent
redundant execution of `erc-kill-channel-hook' members concerned with
parted channels.
(erc-kill-buffer-on-part): Tweak doc string.
(erc-kill-channel-hook): Use new name for `erc-kill-channel',
`erc-part-channel-on-kill'.
(erc-kill-channel, erc-part-channel-on-kill): Rename former to latter,
and inhibit execution when `erc-killing-buffer-on-part-p' is non-nil.
* test/lisp/erc/erc-scenarios-base-kill-on-part.el: New file.
(Bug#70840)