1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-11 22:11:21 -08:00
Commit graph

178895 commits

Author SHA1 Message Date
Paul Eggert
6a9dbed40c Improve inserted file coding system finding
* src/fileio.c (Finsert_file_contents): When inserting a file into
a nonempty buffer, improve the heuristic for determining the
file’s coding system by not trusting lseek+SEEK_END, which is
unreliable in /proc or when the file is mutating.
2025-07-13 21:09:39 -07:00
Paul Eggert
6d09a339ce Improve insert-file-contents on non-regular files
This is part of a fix for Bug#77315,
and improves on the fix for Bug#71258.
* src/fileio.c (Finsert_file_contents): Do not pretend that
directories are regular files.  Instead, signal an error when
attempting to read from them in the usual case where the OS
prohibits that; and otherwise read from them.  However, when
visiting a directory report an error right away rather than
waiting until later, as this function is documented to not allow
visiting non-regular files.  Nest the struct stat into a small
code block, to keep the code simpler and so that the compiler can
see what parts are used and can issue better diagnostics if
uninitialized storage is accessed.  Be more skeptical of st_size,
when the file is not regular.
2025-07-13 21:09:39 -07:00
Paul Eggert
b911029f96 Fix (find-file "/dev/null")
* lisp/files.el (find-file-noselect-1): When the file exists,
propagate any errors signaled by insert-file-contents,
instead of propagating them only when the file is unreadable.
This way, (find-file "/dev/null") gives a sensible diagnostic
"not a regular file" instead of the nonsense
"Maximum buffer size exceeded".
2025-07-13 21:09:39 -07:00
Paul Eggert
0a3c8a4df3 Don’t trust st_size when scanning file head+tail
* src/fileio.c (Finsert_file_contents): Do not look at st_size
when scanning the file’s head and tail for a coding system comment.
Instead, just use read and SEEK_END and don’t worry if the latter fails.
st_size and lseek might not work in a /proc file system.
2025-07-13 21:09:38 -07:00
Paul Eggert
ffd65be227 copy-file no longer trusts st_size
In copy-file, do not trust st_size, since it might change as we run,
or we might be in a /proc system where it is unreliable anyway.
Also, fix some other unlikely copy-file bugs while we’re here.
* src/fileio.c (Fcopy_file): Use O_TRUNC when opening a
destination that already exists.  This saves us the trouble
of having to call ftruncate with a possibly-bogus st_size;
the old motivation for using ftruncate is no longer compelling.
Do not assume ptrdiff_t is as wide as ssize_t; although this is
true on all known platforms, it’s easy to not assume it.
Don’t trust st_size.  Prefer SSIZE_MAX to TYPE_MAXIMUM (ssize_t).
Always read+write, regardless of whether copy_file_range failed.
2025-07-13 21:09:38 -07:00
Paul Eggert
ae30a61c74 READ_BUF_SIZE → sizeof read_buf
* src/fileio.c (Finsert_file_contents): Minor refactoring.
This should help future patches which distinguish read_buf’s size
from other uses of READ_BUF_SIZE which may change.
2025-07-13 21:09:38 -07:00
Paul Eggert
490311f86a insert-file-contents errno confusion
* src/fileio.c (read_non_regular): Return negation of
errno on failure, instead of -1.
(Finsert_file_contents): Signal with correct errno when a read fails.
2025-07-13 21:09:38 -07:00
Stefan Monnier
3998242664 org-persist.el: Silence fewer warnings and fix found warning
* lisp/org/org-persist.el: Minor cleanup.
(org-persist-directory, org-persist-remote-files)
(org-persist-default-expiry): Remove redundant `:group` arg.
(org-persist-collection-let): Document lack of hygiene.
Remove `with-no-warnings`.
(org-persist--find-index): Reindent, and simplify initialization of `r`.
(org-persist-associated-files:generic): Move before first use.
2025-07-13 23:14:53 -04:00
Paul Eggert
f3d3a5803e Work around GCC bug 121030
* configure.ac: Disable -Wanalyzer-use-of-uninitialized-value.
2025-07-13 15:26:46 -07:00
Alan Mackenzie
c44903b011 Preserve source position of macro calls in macro expansions
This allows the byte compiler to give correct positions, those
of the invoking forms, when an error or warning is caused by
the innards of the invoked macros.

This fixes bug#73725 and bug#73746.

* lisp/emacs-lisp/macroexp.el (macroexp--posify-form-1)
(macroexp--posify-form): New functions.
(macroexp-preserve-posification): New macro.
(macroexp--compiler-macro, macroexp-macroexpand): Use the new
macro to preserve a calling form's position.

* lisp/emacs-lisp/byte-opt.el (byte-optimize-form): Use the new
macro to preserve source positions.

* test/lisp/emacs-lisp/bytecomp-resources/bad-error-position.el
* test/lisp/emacs-lisp/bytecomp-resources/bad-error-position-2.el:
New test files.
* test/lisp/emacs-lisp/bytecomp-tests.el: Two new tests using
the new test files.
2025-07-13 20:28:51 +00:00
Eli Zaretskii
1e3d76af5a ; Fix documentation of a recent change
* doc/emacs/vc1-xtra.texi (VC Auto-Reverting): Fix wording and
cross-references.
* doc/emacs/emacs.texi (Top): Update @detailmenu.
2025-07-13 19:51:23 +03:00
Sean Whitton
85159f1dd0 ; Fixes to last change. 2025-07-13 15:24:55 +01:00
Michael Albinus
f1aa9482d1 tramp-file-name-with-method can be set connection-local
* doc/misc/tramp.texi (Ad-hoc multi-hops):
tramp-file-name-with-method can be set connection-local.

* etc/NEWS: tramp-file-name-with-method can be set connection-local.
Presentational fixes and improvements.

* lisp/net/tramp-cmds.el (tramp-get-file-name-with-method): New defun.
(with-tramp-file-name-with-method, tramp-file-name-with-sudo): Use it.
(tramp-dired-find-file-with-sudo): Fix docstring.
2025-07-13 15:48:54 +02:00
Sean Whitton
9d750c7e80 New global minor mode vc-auto-revert-mode
* lisp/vc/vc-hooks.el (auto-revert-mode): Declare.
(vc-auto-revert-mode): New global minor mode.
(vc-turn-on-auto-revert-mode-for-tracked-files): New function.
* lisp/vc/vc-dispatcher.el (auto-revert-mode)
(auto-revert-buffers): Declare.
(vc-resynch-window): Don't call vc-revert-buffer-internal when
auto-revert-mode will revert the buffer.  Call
auto-revert-buffers to ensure that this reversion happens in a
timely manner.
* lisp/vc/vc.el (vc-register): Apply vc-auto-revert-mode to
buffers visiting newly registered files.
* lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode):
Improve the generated docstring.
* doc/emacs/vc1-xtra.texi (VC Auto-Reverting):
* etc/NEWS: Document the new minor mode.
2025-07-13 12:51:04 +01:00
Sean Whitton
24bd93b35b vc-register: Fix setting backup-inhibited
* lisp/vc/vc.el (vc-register): Delete unreachable code trying to
use 'buffer-file-name' as one of the file names.  Properly set
'backup-inhibited' in any file-visiting buffers.
2025-07-13 12:51:04 +01:00
Sean Whitton
0c97e6aeca ; * etc/NEWS (log-edit-maybe-show-diff): Undo recent change.
'log-edit-maybe-show-diff' is one of the options presented for
the 'log-edit-hook' user option.  The use of "option" does not
mean that 'log-edit-maybe-show-diff' is itself a user option.
2025-07-13 12:51:04 +01:00
Sean Whitton
ce3d4cd6b3 ; * etc/NEWS: Grammar fixes. 2025-07-13 12:51:04 +01:00
Eli Zaretskii
6418099ad9 ; * lisp/dired-aux.el (dired-vc-deduce-fileset): Fix last change. 2025-07-13 10:53:21 +03:00
Drew Adams
1abc54ffe1 Allow duplicate menu entries in Imenu
* lisp/imenu.el (imenu-allow-duplicate-menu-items): New user
option.
(imenu--create-keymap): Allow duplicate imenu items if
'imenu-allow-duplicate-menu-items' is non-nil.

* etc/NEWS: Announce the change.
(Bug#78935)
2025-07-13 08:41:38 +03:00
Stephen Berman
d63746d519 ; Fix spurious email address in ChangeLog
* ChangeLog.3: Replace spurious email address.
2025-07-12 17:11:28 +02:00
Sean Whitton
423c6a4dc0 ; Delete unnecessary global autoload from last change. 2025-07-12 14:07:58 +01:00
Stephen Berman
b406c44c82 dired-vc-deduce-fileset: Call vc-backend-for-registration
* lisp/vc/vc.el (vc-backend-for-registration):
* lisp/dired-aux.el (vc-backend-for-registration): Autoload.
(dired-vc-deduce-fileset): Call vc-backend-for-registration when
vc-responsible-backend returns nil (bug#78987).
2025-07-12 11:34:31 +01:00
Pip Cet
fce86c7e95 Avoid crashes when profiling multi-threaded Lisp (bug#76970)
* src/eval.c (backtrace_p): Check 'current_thread' before
dereferencing it.
2025-07-12 10:24:11 +00:00
Eli Zaretskii
c6c64d6da3 Merge from origin/emacs-30
6dd8266bc4 ; * doc/emacs/custom.texi (Init File): Mention "M-x custo...
723cb4da47 ; Fix indexing in Emacs user manual
2025-07-12 05:25:03 -04:00
Eli Zaretskii
d7c2cd63ce ; Merge from origin/emacs-30
The following commit was skipped:

05ecb2b8f0 Nativecomp don't error with undeclared types (bug#6573) (...
2025-07-12 05:25:03 -04:00
Eli Zaretskii
4bff1dfe1f Merge from origin/emacs-30
ebb65d4163 ; Fix typos
2025-07-12 05:25:02 -04:00
Eli Zaretskii
6729e314c2 ; Merge from origin/emacs-30
The following commit was skipped:

b4b7ddb603 Fix 'kill-ring-deindent-mode'
2025-07-12 05:25:02 -04:00
Eli Zaretskii
6dd8266bc4 ; * doc/emacs/custom.texi (Init File): Mention "M-x customize". 2025-07-12 12:01:05 +03:00
Liu Hui
e0270c563a Add option 'ffap-prefer-remote-file' (bug#78925)
This option only affects absolute filenames that are found by
ffap-file-at-point in buffers with remote default directory.

The handling of relative filenames in above buffers remains
unchanged: ffap-file-at-point returns the relative filename,
which can be converted to a remote absolute filename by
subsequent callers (e.g. ffap) using expand-file-name.

* lisp/ffap.el (ffap-prefer-remote-file): New user option.
(ffap-file-exists-string): Add an optional argument to allow the
check of existence of absolute filename on the remote host.
(ffap-file-at-point): Always find remote files in remote context
if the new option is non-nil.
* test/lisp/ffap-tests.el (ffap-test-remote): Add a test.
* etc/NEWS: Announce the change.
2025-07-12 11:48:52 +03:00
Eli Zaretskii
c6ce81c15d Revert "Add option 'ffap-prefer-remote-file' (bug#78925)"
This reverts commit ae46edff68.
I mistakenly installed the wrong version of the patch for
bug#78925.
2025-07-12 11:48:03 +03:00
Liu Hui
ae46edff68 Add option 'ffap-prefer-remote-file' (bug#78925)
This option only affects absolute filenames that are found by
ffap-file-at-point in buffers with remote default directory.

The handling of relative filenames in above buffers remains
unchanged: ffap-file-at-point returns the relative filename,
which can be converted to a remote absolute filename by
subsequent callers (e.g. ffap) using expand-file-name.

* lisp/ffap.el (ffap-prefer-remote-file): New user option.
(ffap-file-exists-string): Add an optional argument to allow the
check of existence of absolute filename on the remote host.
(ffap-file-at-point): Always find remote files in remote context
if the new option is non-nil.
* test/lisp/ffap-tests.el (ffap-test-remote): Add a test.
* etc/NEWS: Announce the change.
2025-07-12 11:38:27 +03:00
Elías Gabriel Pérez
f746762e74 New command 'mode-line-invisible-mode'
This new command allows hide the mode line in the current
buffer.  (Bug#78881)

* doc/emacs/display.texi (Optional Mode Line): Document feature.
* etc/NEWS: Announce changes.
* lisp/simple.el (mode-line-invisible--buf-state): New buffer
local variable.
(mode-line-invisible-mode): New minor mode.
2025-07-12 10:50:22 +03:00
Eli Zaretskii
a8b0f5adfa ; Fix documentation of last change (bug#78844)
* doc/lispref/elisp.texi (Top):
* doc/lispref/package.texi (Packaging): Fix menus.
(Package Information): Fix wording, indexing and markup.
2025-07-12 10:11:09 +03:00
Xiyue Deng
5c75ec6ae5 Add public interfaces for accessing builtin package info (Bug#78844)
* lisp/emacs-lisp/package.el (package-builtin-packages)
(package-builtin-package-version): New functions.
* doc/lispref/package.texi: Add a section 'Package Information' with
documentation for the new functions.
* etc/NEWS: Add entry for 'package-versioned-builtin-packages' and
'package-builtin-package-version'.
2025-07-12 10:03:50 +03:00
Mattias Engdegård
52b96d3a7e * src/fns.c (Flength): Fix char table length off-by-one bug. 2025-07-11 16:36:27 +02:00
Sean Whitton
8ff6e7fe58 ; vc-git-find-revision: Fix last change to this function. 2025-07-11 11:08:10 +01:00
Sean Whitton
10024cc065 VC: Fix displaying the async command buffer during async checkins
* lisp/vc/vc-dispatcher.el (vc--display-async-command-buffer):
New function, factored out of vc-do-async-command.
(vc-do-async-command): Use it.
(vc-finish-logentry): Bind vc--inhibit-async-window when running
the log operation, then call vc--display-async-command-buffer
again ourselves after performing other window changes.
2025-07-11 09:58:20 +01:00
Sean Whitton
5d048521e2 Apply vc-use-incoming-outgoing-prefixes to vc-dir-mode-map too
* lisp/vc/vc-dir.el (vc-use-incoming-outgoing-prefixes):
* lisp/vc/vc-hooks.el: Apply vc-use-incoming-outgoing-prefixes
to the corresponding bindings in vc-dir-mode-map, too.
2025-07-11 09:30:19 +01:00
Sean Whitton
0814a93a04 ; Improve manual docs for incoming and outgoing diff commands 2025-07-11 09:29:12 +01:00
Sean Whitton
191109e25e vc-git-find-revision: Pass --filters to git-cat-file
* lisp/vc/vc-git.el (vc-git-find-revision): Pass --filters to
git-cat-file.  Problem reported and fix suggested by Oscar
Fuentes <ofv@wanadoo.es>.
2025-07-11 09:13:47 +01:00
Eli Zaretskii
723cb4da47 ; Fix indexing in Emacs user manual
* doc/emacs/frames.texi (Creating Frames):
* doc/emacs/windows.texi (Pop Up Window): Fix indexing and
wording.  (Bug#78945)
2025-07-11 09:24:50 +03:00
Alan Third
2e3ee3e448 Update documentation and NEWS with SVG changes (bug#77841)
* doc/lispref/display.texi (SVG Images):
* etc/NEWS: Document changes to SVG foreground color handling.
2025-07-10 17:54:33 +01:00
Alan Third
9f5d17cd72 Move CSS into the SVG wrapper
This allows CSS to be used with librsvg < 2.48.

* src/image.c (svg_load_image): Move CSS construction and include
"color".  Also append the CSS passed in by the user rather than
replacing it.
2025-07-10 17:54:33 +01:00
Alan Third
8b200c0419 Use css to set SVG foreground in docview
* lisp/doc-view.el (doc-view-insert-image): Use CSS to set the fill
attribute to the desired foreground color.
2025-07-10 17:54:33 +01:00
Alan Third
4d145d08da Change foreground color handling for SVG files (bug#77841)
* etc/images/checkbox-mixed.svg:
* etc/images/checked.svg:
* etc/images/conceal.svg:
* etc/images/down.svg:
* etc/images/gnus/gnus-pointer.svg:
* etc/images/left.svg:
* etc/images/outline-close.svg:
* etc/images/outline-open.svg:
* etc/images/radio-checked.svg:
* etc/images/radio-mixed.svg:
* etc/images/radio.svg:
* etc/images/reveal.svg:
* etc/images/right.svg:
* etc/images/symbols/check-mark_16.svg:
* etc/images/symbols/chevron_down_16.svg:
* etc/images/symbols/chevron_left_16.svg:
* etc/images/symbols/chevron_right_16.svg:
* etc/images/symbols/chevron_up_16.svg:
* etc/images/symbols/cross_16.svg:
* etc/images/symbols/cross_circle_16.svg:
* etc/images/symbols/cross_circle_fill_16.svg:
* etc/images/symbols/dot_large_16.svg:
* etc/images/symbols/dot_medium_16.svg:
* etc/images/symbols/dot_small_16.svg:
* etc/images/symbols/heart_16.svg:
* etc/images/symbols/heart_fill_16.svg:
* etc/images/symbols/heart_half_16.svg:
* etc/images/symbols/menu_16.svg:
* etc/images/symbols/minus_16.svg:
* etc/images/symbols/minus_circle_16.svg:
* etc/images/symbols/minus_circle_fill_16.svg:
* etc/images/symbols/plus_16.svg:
* etc/images/symbols/plus_circle_16.svg:
* etc/images/symbols/plus_circle_fill_16.svg:
* etc/images/symbols/star_16.svg:
* etc/images/symbols/star_fill_16.svg:
* etc/images/symbols/star_half_16.svg:
* etc/images/unchecked.svg:
* etc/images/up.svg: Set 'fill' color to 'currentcolor'.
* etc/images/symbols/README: Add explanation of change to instructions.
* src/image.c: Remove setting of the 'fill' color in the default SVG
stylesheet.
2025-07-10 17:54:33 +01:00
Michael Albinus
6d0812e57a Fix browse-url-tests-delete-temp-file
* test/lisp/net/browse-url-tests.el (browse-url-tests-delete-temp-file):
Fix test.
2025-07-10 18:44:52 +02:00
Michael Albinus
9f82300bb0 Fix handling of `browse-url-temp-file-name'
* lisp/net/browse-url.el (browse-url--temp-file-setup):
Add `browse-url-delete-temp-file' to `write-file-functions'.
(browse-url-of-file, browse-url-delete-temp-file): Fix handling of
`browse-url-temp-file-name'.  (Bug#78830)
2025-07-10 17:25:56 +02:00
Michael Albinus
18ff84df0c * admin/notes/jargon: Add TIL. 2025-07-10 17:25:11 +02:00
Eli Zaretskii
b51b01f682 ; * src/fileio.c: Remove version from commentary (bug#78983). 2025-07-10 16:08:29 +03:00
Mattias Engdegård
b83f2d16fb Unintern Qget_file_char and Qget_emacs_mule_file_char
These symbols are used in the reader as special constants and can't be
passed from Lisp (Emacs would crash).

* src/lread.c (syms_of_lread): Unintern.
(init_source): Use BASE_EQ.
2025-07-10 13:45:50 +02:00