Don't try to pretty-print non-lists as binding list
* lisp/emacs-lisp/pp.el (pp--format-definition): Ensure that what we try
to print as a list of bindings has an appropriate format. This avoids
raising an error for SEXPs like (let X Y) inside `pcase' forms where our
heuristic expects a binding list in the X position.
Stefan Kangas [Mon, 27 May 2024 08:51:54 +0000 (10:51 +0200)]
Make `idle-update-delay` obsolete
This user option was introduced in 2003, and was advertised as a general
variable for a "delay before updating various things on the screen".
But this has never been true: it was only used by 'which-function-mode',
and, to make matters worse, users of that mode would basically never
know that this user option existed without reading the code.
Conversely, users that did find the user option would be surprised to
see that it only took effect in 'which-func-mode'.
The lack of other users of 'idle-update-delay' reveals that it has not
been considered generally useful. Thus, it makes more sense to
introduce a new mode specific user option `which-func-update-delay`, and
to mark the old one obsolete.
* lisp/simple.el (idle-update-delay): Make obsolete.
* lisp/progmodes/which-func.el (which-func-update-delay): New defcustom.
(which-function-mode): Use above new defcustom instead of
'idle-update-delay'.
Naofumi Yasufuku [Sun, 26 May 2024 08:53:42 +0000 (17:53 +0900)]
Fix --enable-checking build with macOS clang 15.0.0
search.c:3428:7: error: call to undeclared library function 'free' ...
configure:9131: checking for C compiler version
configure:9140: gcc --version >&5
Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: arm64-apple-darwin23.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
* src/search.c: Include stdlib.h for free(), and stdio.h for
open_memstream(), fclose().
Complete some unfinished work from the elimination of lazy bytecode
loading in 9bcc9690a8: remove code which became unreachable by that
reform. This simplifies some of the lower-level parts of the reader
which helps performance somewhat.
* src/doc.c (read_bytecode_pointer, read_bytecode_char)
(read_doc_string): Remove.
(get_doc_string): Remove last argument, all callers adapted. Simplify.
* src/lread.c (readbyte_for_lambda, readbyte_from_string)
(readbyte_for_lambda, readbyte_from_string): Remove.
(readchar, unreadchar): Remove unused code paths for Qlambda and cons
arguments.
(bytecode_from_rev_list): Remove last use of a quirky code path,
decoding force-loaded lazy bytecode explicitly.
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.