1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-13 06:50:39 -08:00
Commit graph

179040 commits

Author SHA1 Message Date
Peder O. Klingenberg
a2d71cecae Emulate more dynamic bindings in request buffers
Many variables were copied from the dynamic environment to the request
buffer, which allowed them to influence the handling of requests and
responses.  But some were not, notably some of the mime-related
variables, and the user-agent and privacy variables.  This made them
unreliable when dynamically bound around a call to `url-retrieve'; they
would have the desired effect when reusing an existing connection, but
not when url-http opened a new connection.  In the case of reused
connections, the request construction happens in the dynamic scope of
`url-http', but in the case where a fresh connection is needed, request
construction happens outside that dynamic scope.

This commit adds the remaining variables used in request construction to
the set of buffer local variables mirroring the dynamic values from
url-http, and adds a comment describing the mechanism used and how avoid
the pitfall of inconsistent handling of dynamic bindings.

* lisp/url/url-http.el (url-http-extensions-header): New internal-ish
variable.
(url-http-create-request): Use the new variable instead of the global
one.
(url-http-idle-sentinel): Debug-log when the connection closes.
(url-http): Set up more buffer-local variants of dynamic variables in
the buffer used for the request, and add comment describing why this
copying is needed.

(Bug#61916)
2025-07-26 12:09:07 +03:00
Baptiste Strazzulla
44bb860796 Simplify code in 'newsticker--buffer-do-insert-text'
* lisp/net/newst-plainview.el (newsticker--buffer-do-insert-text): Use
the already defined 'age' variable.  (Bug#78305)
2025-07-26 12:00:02 +03:00
Yue Yi
9153f1f3bb Fix 'sqlite-mode-delete' with NULL field values
* lisp/sqlite-mode.el (sqlite-mode-delete): Support NULL field
values (bug#79011).
2025-07-26 11:49:19 +03:00
Jim Porter
c5f649441e Improve performance when computing the "readable" form of a page in EWW
The previous version made a lot of string copies, but only needed the
word count of each DOM node.  In this version, we just sum up the word
counts in all the existing nodes, which results in a significant
performance improvement (bug#78902).

* lisp/net/eww.el (eww--string-count-words, eww--dom-count-words): New
functions...
(eww--walk-readability, eww-readable-dom): Use them.
2025-07-25 16:42:31 -07:00
Jim Porter
2e53c7d08b Add new function 'dom-inner-text'
This replaces 'dom-text' and 'dom-texts', and is both more correct and
more efficient than them.

* lisp/dom.el (dom-text, dom-texts): Make obsolete in favor of...
(dom-inner-text--1, dom-inner-text): ... these new functions.  Update
callers.

* doc/lispref/text.texi (Document Object Model): Update documentation to
refer to 'dom-inner-text'.

* etc/NEWS: Announce this change.
2025-07-25 16:42:08 -07:00
Mattias Engdegård
33161e51e5 Check for end-of-file when reading character escapes (bug#79097)
* src/lread.c (read_char_escape): Add check.
* test/src/lread-tests.el (lread-char-escape-eof): New test.
2025-07-25 21:54:59 +02:00
Sean Whitton
50ffb29d0b VC: New support for other working trees
* lisp/vc/vc-git.el (vc-git--read-start-point): New function,
factored out of vc-git-create-tag.
(vc-git-create-tag): Use it.
(vc-git--worktrees, vc-git-known-other-working-trees)
(vc-git-add-working-tree, vc-git-delete-working-tree)
(vc-git-move-working-tree):
* lisp/vc/vc-hg.el (vc-hg-known-other-working-trees)
(vc-hg-add-working-tree, vc-hg--shared-p)
(vc-hg-delete-working-tree, vc-hg-move-working-tree): New
functions.
* lisp/vc/vc.el: Define API for known-other-working-tree,
add-working-tree, delete-working-tree and move-working-tree
backend functions.
(vc-dir-status-files): New function.
(project-current-directory-override): Declare.
(dired-rename-subdir): Autoload.
(vc-add-working-tree, vc-switch-working-tree)
(vc-delete-working-tree, vc-move-working-tree): New commands.
* lisp/vc/vc-hooks.el (vc-prefix-map): Bind them under C-x v.

* doc/emacs/vc1-xtra.texi (Other Working Trees): New node.
* etc/NEWS: Announce the new commands.

* test/lisp/vc/vc-tests/vc-tests.el
(vc-test--other-working-trees): New function.
(vc-test-git07-other-working-trees)
(vc-test-hg07-other-working-trees): New tests.

* lisp/ldefs-boot.el: Regenerate.
2025-07-25 19:34:04 +01:00
Sean Whitton
08ca6caa0a vc-test--version-diff: Bind vc-async-checkin
* test/lisp/vc/vc-tests/vc-tests.el (vc-test--version-diff):
Bind vc-async-checkin to disable async checkins during test.
2025-07-25 19:04:07 +01:00
Sean Whitton
4187320263 ; * doc/emacs/vc-xtra.texi (Advanced VC Usage): Fix menu. 2025-07-25 18:59:46 +01:00
Sean Whitton
09e205fe60 Bind vc-rename-file to C-x v R
* lisp/vc/vc-hooks.el (vc-prefix-map): Bind vc-rename-file to
C-x v R.
* doc/emacs/files.texi (Copying and Naming):
* doc/emacs/vc1-xtra.texi (VC Delete/Rename, Revision Tags):
* etc/NEWS (bindings): Document the new binding.
2025-07-25 18:45:59 +01:00
Eli Zaretskii
2143969580 ; * etc/NEWS: Move 'exec-path' entry to its proper place. 2025-07-25 14:51:12 +03:00
Paul Eggert
c403bc4d51 Streamline init_callproc a bit
* src/callproc.c (init_callproc): Don’t bother testing for the
existence of ../src/ and NEWS if installation-directory is
non-nil, because in that case we will test for ../etc/NEWS anyway.
Simplify by using AUTO_STR.
2025-07-24 22:13:47 -07:00
Paul Eggert
d7e8186080 Refactor to allow nameless auto strings
* src/lisp.h (AUTO_STR, AUTO_STR_WITH_LEN): New macros.
Long ago this sort of thing would have been a no-no
because we needed to GCPRO the strings.
However, GCPRO went away a decade ago.
2025-07-24 22:13:47 -07:00
Paul Eggert
b01b521717 Diagnose load-path only if interactive
* lisp/startup.el (command-line): Warn about dubious
user-emacs-directory and load-path only if interactive, as that’s
where warning helps and the warnings just complicate batch usage
(e.g., -Q).
2025-07-24 22:13:47 -07:00
Paul Eggert
eb9ec79c13 PATH defaults now act more like GNU and POSIX
When PATH is unset or empty, use the system default,
to be consistent with GNU/Linux and with POSIX.
If there is no system default do not default to "."
as that can be dangerous.
* src/callproc.c (init_callproc_1, init_callproc):
Default PATH to the null pointer, not the empty string.
* src/emacs.c (default_PATH): New function.
(find_emacs_executable, decode_env_path): Be consistent with POSIX
and with glibc about what to do when PATH is unset or empty.
2025-07-24 22:13:47 -07:00
Paul Eggert
6a08a9a54d ; Fix file name in "Loading Files" doc. 2025-07-24 22:13:47 -07:00
Paul Eggert
d59fe6dad5 Treat ‘.../emacs’ like ‘emacs’ in realpath startup
* src/emacs.c (find_emacs_executable): If the executable name
contains a slash, use the same optimization for symlink resolution
that we already use when the executable name has no slash.
2025-07-24 22:13:47 -07:00
Paul Eggert
67ea9485a6 Prefer readlink to lstat in find_emacs_executable
* src/emacs.c (find_emacs_executable): Prefer readlink to lstat
when testing whether a file is a symlink.  This avoids EOVERFLOW
issues.
2025-07-24 22:13:47 -07:00
Paul Eggert
670603533c Fix minor memory leak in find_emacs_executable
* src/emacs.c (find_emacs_executable): Free candidate if unused.
2025-07-24 22:13:47 -07:00
Michael Albinus
fdb7397b01 Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs 2025-07-24 18:48:52 +02:00
Michael Albinus
ec96ea30ba ; Revert last change
* lisp/net/tramp-smb.el
(tramp-connection-local-default-system-variables): Add "" to
`exec-suffixes'.  (Bug#78886)
2025-07-24 18:48:26 +02:00
Robert Pluim
5cce567f20 Use macro to reduce repetition in TLS tests
* test/lisp/net/network-stream-tests.el (with-tls-params): New
macro, abstracts most of the boiler plate for TLS tests.
(connect-to-tls-ipv4-wait, connect-to-tls-ipv4-nowait)
(connect-to-tls-ipv6-nowait, open-network-stream-tls-wait)
(open-network-stream-tls-nowait, open-network-stream-tls)
(open-network-stream-tls-nocert)
(open-gnutls-stream-new-api-default)
(open-gnutls-stream-new-api-wait)
open-gnutls-stream-old-api-wait)
(open-gnutls-stream-new-api-nowait)
(open-gnutls-stream-old-api-nowait): Use it.
2025-07-24 18:04:29 +02:00
Michael Albinus
7ade5bd9fb Disable setting connection-local variables in tramp-smb.el
* lisp/net/tramp-smb.el: Disable setting connection-local
variables.  (Bug#78886)
2025-07-24 15:30:13 +02:00
Paul Eggert
e026b57f07 Don’t read before BEG in insert-file-contents
* src/fileio.c (Finsert_file_contents): Don’t sample bytes before BEG.
Give up optimizing if the file size shrinks to less than BEG.
2025-07-23 17:55:15 -07:00
Paul Eggert
4c79154949 Simplify file end finding in insert-file-contents
* src/fileio.c (Finsert_file_contents): Don’t give up finding the
file’s end merely because SEEK_END fails.  Try a small test read
anyway.  This might work in non-POSIX file systems where SEEK_END
is not allowed, and trying is easy and simplifies the code.
2025-07-23 17:55:15 -07:00
Paul Eggert
69af0d4c85 GCC bug 119085 fixed in GCC 16
* configure.ac (emacs_cv_gcc_bug_119085_CFLAGS):
Assume the bug is fixed starting in GCC 16.
2025-07-23 13:05:56 -07:00
Juri Linkov
128e8311be * lisp/repeat.el (repeat-mode): Use 'called-interactively-p'.
This logic is copied from 'define-minor-mode' that displays a message
about mode activation only when called interactively (bug#79081).
2025-07-23 20:56:05 +03:00
Michael Albinus
c142f0d246 Add consistent environment for local process calls in Tramp
* lisp/net/tramp-adb.el (tramp-adb-maybe-open-connection):
* lisp/net/tramp-androidsu.el (tramp-androidsu-maybe-open-connection):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch):
* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band)
(tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory)
(tramp-smb-handle-file-acl)
(tramp-smb-handle-file-notify-add-watch)
(tramp-smb-handle-set-file-acl, tramp-smb-maybe-open-connection):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-send-command):
Use `tramp-start-process'.  Do not call	`tramp-post-process-creation'.

* lisp/net/tramp.el (with-tramp-local-environment): New defmacro.
(tramp-start-process): New defun.
(tramp-call-process, tramp-call-process-region)
(tramp-process-lines): Use `with-tramp-local-environment'.
2025-07-23 16:22:26 +02:00
Gerd Möllmann
2d1d1f31df NS: Fix build with NSTRACE_ENABLED
* src/nsterm.h (NSTRACE_MSG_NO_DASHES): Use
nstrace_enabled_global.
* src/nsterm.m: ([EmacsView performDragOperation:]): Don't use
an NSString.
2025-07-23 11:59:23 +02:00
Jim Porter
0d752f15b8 Handle Eshell prompts where stickiness properties are 't'
Previously, this signaled an error, breaking the prompt (bug#79059).

* lisp/eshell/em-prompt.el (eshell--append-text-property): Don't append
to non-list property values.

* test/lisp/eshell/em-prompt-tests.el
(em-prompt-test/field-properties/merge-stickiness): Adapt test.
2025-07-22 22:24:15 -07:00
Gerd Möllmann
f177537f70 NS: Use different window collection behavior for tooltips (bug#73037)
* src/nsterm.m ([EmacsView updateCollectionBehavior]):
Use NSWindowCollectionBehaviorFullScreenAuxiliary for non-native
tooltips which are not child frames.
2025-07-23 06:26:45 +02:00
Michael Albinus
5a7a12d792 Add function exec-suffixes
* doc/lispref/processes.texi (Subprocess Creation):
Add function exec-suffixes.

* etc/NEWS: New function 'exec-suffixes'.
Presentational fixes and improvements.

* lisp/files-x.el (exec-suffixes): New defun.  (Bug#78886)

* lisp/files.el (executable-find): Use function `exec-suffixes'.

* lisp/net/tramp-integration.el
(tramp-connection-local-default-system-variables): Add also
`exec-suffixes'.

* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection): Use
default values of `path-separator', `null-device' and
`exec-suffixes'.
(tramp-smb-connection-local-default-system-variables):
New defconst.  Add it to connection-local profiles.
2025-07-22 17:47:38 +02:00
Mattias Engdegård
b7f2d994c6 * lisp/custom.el (defcustom): Remove empty doc string.
It is no longer needed because (lambda () "hello") has no doc string.
2025-07-22 14:30:58 +02:00
Sean Whitton
d381a7e799 * lisp/vc/vc-git.el (vc-git-diff): Don't pass --textconv.
This reverts this change:

    Author:     Sean Whitton <spwhitton@spwhitton.name>
    AuthorDate: Mon Jul 21 09:26:59 2025 +0100

      * lisp/vc/vc-git.el (vc-git-diff): Pass --textconv (bug#79050).
2025-07-22 11:34:44 +01:00
Paul Eggert
eb488e1bba insert-file-contents respect END better
This fixes some longstanding bugs, along with bugs recently
introduced as part of fixes for Bug#77315.
* src/fileio.c (Finsert_file_contents): Arrange for END_OFFSET
to never be less than BEG_OFFSET, to simplify the code.
Do not go past END_OFFSET when sampling or optimizing reading.
Avoid a few unnecessary lseeks.
2025-07-21 16:23:18 -07:00
Paul Eggert
8393e469e7 insert-file-contents shrinking Solaris file fix
This is related to recent fixes for Bug#77315.
* src/fileio.c (Finsert_file_contents): Defend against
a file shrinking to be smaller than its initial offset.
This can happen only on platforms like Solaris where
the initial offset can be positive.
2025-07-21 16:23:18 -07:00
Paul Eggert
e879533f4b Refactor insert-file-contents overlap check
* src/fileio.c (Finsert_file_contents):
Simplify and clarify file overlap check.
2025-07-21 16:23:18 -07:00
Paul Eggert
adbae4f92f insert-file-contents refactor xlseek
* src/fileio.c (xlseek): New arg WHENCE.  All uses changed.
This generalizes xlseek and should simplify future changes.
2025-07-21 16:23:18 -07:00
Paul Eggert
d04182d52a Say why quit is captured in insert-file-contents
* src/fileio.c (Finsert_file_contents): Add comment.
2025-07-21 16:23:18 -07:00
Paul Eggert
a8e46f11a8 insert-file-contents read size increase
This increases the max read size from 0.25 to 1 MiB, which is a
bit better for Emacs in my measurements.  The old value was taken
from coreutils, but was for a different purpose.
* src/fileio.c (INSERT_READ_SIZE_MAX): New constant, replacing
IO_BUFSIZE.  All uses changed.
(Finsert_file_contents): Do not use a read buffer that is larger
than INSERT_READ_SIZE_MAX.
2025-07-21 16:23:18 -07:00
Paul Eggert
27e0f0f79b Fix insert-file-contents infloop with unlucky END
This partially reverts 55f41ca3aa,
which was a partial fix for Bug#77315.
* src/fileio.c (Finsert_file_contents): Go back to accepting
partial reads when doing the optimized way when code conversion is
not needed.  This avoids an unlikely bug when END happens to lie
at a buffer boundary, causing an infloop.  For consistency, do the
same when doing code conversion (though there’s no bug in then),
as there’s not a real need for emacs_full_read there either.
2025-07-21 16:23:18 -07:00
Paul Eggert
46314aef87 Refactor by coalescing MAX_RW_COUNT definitions
* src/emacs.c (read_full):
Simplify by assuming MAX_RW_COUNT is defined.
* src/lisp.h (MAX_RW_COUNT): Move here from src/sysdep.c.
* src/pdumper.c (dump_read_all):
Use MAX_RW_COUNT rather than defining our own equivalent.
2025-07-21 16:23:18 -07:00
Paul Eggert
aaf9c5213f insert-file-contents from seekable non-regular
* src/fileio.c (Finsert_file_contents): Be more conservative
when reading from seekable non-regular files when END is given.
The code assumed that in this case, reads would succeed or fail
quickly so there was no need to call internal_condition_case_1.
However, in some cases, e.g., /dev/random, it could take a while.
This fixes a glitch introduced in commit
cb4579ed6b dated 2022-06-11.
2025-07-21 16:23:18 -07:00
Paul Eggert
49ca3a2151 insert-file-contents beware buffer relocation
This fixes a potential (albeit quite unlikely) bug
introduced during recent fixes to Bug#77315.
* src/fileio.c (union read_non_regular.s.inserted):
Bring back this member.
(read_non_regular, Finsert_file_contents): Work in the unlikely
case when internal_condition_case_1 relocates the buffer before
calling read_non_regular.
2025-07-21 16:23:18 -07:00
Paul Eggert
2903b0b92c insert-file-contents 1 KiB seek fix
This improves on recent fixes to Bug#77315.
When sampling the first 1 KiB and last 3 KiB, do not seek before
BEG if given.  Instead, sample starting at BEG, to be consistent
with the non-optimized version.
* src/fileio.c (xlseek): Return POS, for convenience.
(Finsert_file_contents): Sample the first 1 KiB correctly when BEG.
In a CURPOS local, keep track of the input file offset, or for
nonseekable files the number of bytes read, while this value is
important.  This lets us avoid some unnecessary seeks.  Report an
error earlier if the file is not seekable and BEG is nonzero,
to save work and simplify the code.  When sampling, discard less
data, as this is simpler and there’s little point to discarding it.
2025-07-21 16:23:18 -07:00
Paul Eggert
ffe6d33ef4 insert-file-contents seek refactoring
* src/fileio.c (xlseek): New function.
(Finsert_file_contents): Use it instead of doing things by hand.
(write_region): Match diagnostic wording to xlseek’s.
2025-07-21 16:23:17 -07:00
Paul Eggert
5f4b71b0c4 Fix insert-file-contents optimization glitch
This improves on recent fixes to Bug#77315.
* src/fileio.c (Finsert_file_contents): When optimizing
do not seek to 0 if the initial file offset is positive,
as that causes the optimized code to behave differently
from the nonoptimized.
2025-07-21 16:23:17 -07:00
Paul Eggert
1b517a4fe0 insert-file-contents SEEK_END optimization
This improves on recent fixes to Bug#77315.
* src/fileio.c (Finsert_file_contents):
Do not give up on seeking merely because SEEK_END fails.
On some files (/proc/cpuinfo, say) SEEK_END can fail
even though SEEK_SET and SEEK_CUR succeed, and the
code still works in this case.
2025-07-21 16:23:17 -07:00
Paul Eggert
8d83402edc insert-file-contents st_size cleanup
* src/fileio.c (Finsert_file_contents): Store st_size,
not file_size_hint, into current_buffer->modtime_size,
since modtime_size is compared to a later st_size, not
to the actual file size.  Simplify buffer overflow detection
from file size, since this occurred only on regular files.
2025-07-21 16:23:17 -07:00
Eli Zaretskii
5485bda523 Improve documentation of 'quit-window'
* lisp/window.el (quit-window): Mention 'quit-window-kill-buffer'.
(quit-window): Doc fix.

* doc/lispref/windows.texi (Quitting Windows):
* etc/NEWS: Improve documentation of 'quit-window-kill-buffer'.
2025-07-21 15:35:36 +03:00