Commit graph

2377 commits

Author SHA1 Message Date
Eli Zaretskii
131cde2f86 Merge from origin/emacs-30
6299eb0fe5 bug#78901: [PATCH] js-ts-mode: Fix auto-mode-alist regexp
982938363a Merge branch 'emacs-30' of git.sv.gnu.org:/srv/git/emacs ...
e68ad70af6 Fix 'insert-directory' in Turkish language-environment
f805f51373 Fix job control in remote shell
039ad15373 ; * doc/emacs/package.texi (Package Statuses): Clarify "n...
2025-06-28 06:57:19 -04:00
Eli Zaretskii
e68ad70af6 Fix 'insert-directory' in Turkish language-environment
* lisp/files.el (insert-directory-clean, insert-directory): Use
case-sensitive search for "//DIRED//" and similar strings.
(Bug#78894)
2025-06-25 12:17:59 -04:00
Pip Cet
f69b822fb0 Print a message when failing to recover a file
* lisp/files.el (recover-session-finish): Call 'message' rather than
evaluating a string and a variable without using the result.
2025-06-10 14:11:58 +00:00
Eli Zaretskii
6bb3c6f9e1 Merge from origin/emacs-30
cc5b1a01a2 ; * doc/misc/efaq-w32.texi (Location of init file): Fix a...
6c2aaedfce Fix compilation errors in emacsclient.c with MinGW GCC 15
d56e5ba97e ; * etc/DEBUG: Add link to GCC bug #78685.
80cbd1e31c ; Fix key notation in Introduction to Emacs Lisp
1224e5fd96 ; * lisp/files.el (revert-buffer-restore-functions): Doc ...
79e7eeb329 ; Improve documentation of 'format-time-string'
2838b64fc8 ; * lisp/textmodes/text-mode.el (text-mode-variant): Fix ...
9adb05422e ; Improve obsolescence of 'text-mode-variant'
4858d81848 ; * lisp/files.el (revert-buffer-restore-functions): Doc ...
2a8e223b8d ; Mention early-init file in Emacs FAQ for Windows
14c707b42d ; Isearch: Fix key bindings in docstrings
2025-04-30 07:14:23 -04:00
Eli Zaretskii
1224e5fd96 ; * lisp/files.el (revert-buffer-restore-functions): Doc fix (bug#78124). 2025-04-29 21:28:01 +03:00
Eli Zaretskii
4858d81848 ; * lisp/files.el (revert-buffer-restore-functions): Doc fix. 2025-04-29 09:39:34 +03:00
Sean Whitton
d047a89e76 vc-diff: Delete redundant call to vc-maybe-buffer-sync
This call is redundant with the subsequent call to
vc-buffer-sync-fileset.  I believe this call to
vc-maybe-buffer-sync was reintroduced by accident -- the
changeset adding the call to vc-buffer-sync-fileset deleted a
call to vc-sync-fileset in the same place.

* lisp/vc/vc.el (vc-diff): Delete redundant call to
vc-maybe-buffer-sync.
* lisp/files.el (find-buffer-visiting): Note in docstring that
this function only ever returns base buffers.
2025-04-27 11:52:53 +08:00
Eli Zaretskii
e0c7b6e31e Fix warning messages about lexbind cookie in subdirs.el
* lisp/files.el (internal--get-default-lexical-binding): Don't log
a warning message when lexbind warning is disabled, and
'display-warning' is unavailable or signals an error.
2025-04-13 16:35:49 +03:00
Stefan Monnier
7ff674d712 (internal--get-default-lexical-binding): Be more failsafe
* lisp/files.el (internal--get-default-lexical-binding): Try and
avoid signaling an error.  Make it easier to suppress the
warning for a specific file.
2025-04-08 13:10:30 -04:00
Stefan Monnier
19257efbf7 lisp/files.el (internal--get-default-lexical-binding): Buttonize the M-x 2025-04-07 23:24:21 -04:00
Stefan Monnier
9dc6177206 lisp/files.el (internal--get-default-lexical-binding): Handle nested loads 2025-04-07 22:48:01 -04:00
Stefan Monnier
9f25d46568 (Fload, Feval_buffer): Emit a warning when lexbind is unset (bug#74145)
This emits a warning at run-time rather than at compile time.

* src/lread.c (get_lexical_binding): New function.
(Fload, Feval_buffer): Use it.
(syms_of_lread): New var `internal--get-default-lexical-binding-function`.
* lisp/files.el: Set it.
(internal--get-default-lexical-binding): New function.
2025-04-07 21:41:35 -04:00
Stefan Monnier
468c2aebae Replace uses of replace-buffer-contents
* lisp/vc/vc.el (vc-diff-restore-buffer):
* lisp/progmodes/python.el (python--do-isort):
* lisp/progmodes/eglot.el (eglot--apply-text-edits):
* lisp/files.el (revert-buffer-insert-file-contents-delicately):
* lisp/json.el (json-pretty-print): Use `replace-region-contents`.
2025-03-29 17:49:49 -04:00
Eli Zaretskii
cedefabfcf ; Fix last change
* lisp/files.el (auto-mode-alist):
* etc/NEWS: Fix last change.  (Bug#77138)
2025-03-29 13:22:11 +03:00
Konstantin Kharlamov
891f51fe11 Add major mode for highlighting npmrc files (Bug#77138)
* etc/NEWS: mention the new mode.
* lisp/textmodes/conf-mode.el (conf-npmrc-mode-syntax-table): New
variable.
* lisp/textmodes/conf-mode.el (conf-npmrc-mode): New major mode
derived from conf-mode for highlighting .npmrc files.
* lisp/files.el (auto-mode-alist): Associate the new mode with .npmrc
files.
2025-03-29 13:19:04 +03:00
shipmints
81c21d89ed Ensure .dir-locals-2.el behavior as documented (bug#75890)
* lisp/files.el
(dir-locals--all-files): New &optional 'base-el-only' argument.
(dir-locals--base-file): New function.
(dir-locals-find-file): 'locate-dominating-file' only for the base
.dir-locals.el.

* test/lisp/files-tests.el
(files-test-dir-locals-2-solo): New test.
* test/lisp/files-resources/dir-locals-2-solo: New test support.
(files-test-dir-locals-2-paired): New test.
* test/lisp/files-resources/dir-locals-and-2: New test support.
2025-03-22 16:47:27 -04:00
Juri Linkov
7016d1c8e3 * lisp/files.el (save-some-buffers-action-alist): Fix 'view-mode'.
Use 'view-mode-enter' instead of 'view-buffer' to ignore the 'special'
mode-class that prevents some modes from binding 'q' to 'exit-action'
that should call 'exit-recursive-edit' (bug#76745).
2025-03-19 21:09:10 +02:00
Yuan Fu
f2f1fb7fe0
Merge from origin/emacs-30
defc55bb6f Fix treesit-parser-create behavior regarding indirect buf...
20ac26e675 ; Fix with-delayed-message docstring metavars.
04034cd9ce Fix 'dired-movement-style' in Dired when subdirs are shown
f8443dffc1 ; * lisp/register.el (register-use-preview): Doc fix (bug...
f729828bcf ; Add texinfo reference to GNU Coding Standards.
a6abb88fdc ; * lisp/files.el (executable-find): Doc fix.

# Conflicts:
#	src/treesit.c
2025-03-13 20:18:03 -07:00
Eli Zaretskii
a6abb88fdc ; * lisp/files.el (executable-find): Doc fix. 2025-03-12 14:53:03 +02:00
Sean Whitton
22db8a2c2a Merge from origin/emacs-30
2029104605 Correct some outdated docs for hack-local-variables
2025-03-12 10:09:45 +08:00
Sean Whitton
99852fb867 Merge from origin/emacs-30
894b0e3a2f ; Adapt comment in tramp.el
cc87717fa0 Add keyword placeholder to tramp.el
7d0d61d854 Rewrite ERT manual introduction
b2f124f2a8 ; cperl-mode.el: Don't misinterpret exec_fcn as keyword exec
59d1aac49d Document return values of the various read-* functions
2025-03-12 10:09:09 +08:00
Sean Whitton
2029104605 Correct some outdated docs for hack-local-variables
* doc/lispref/variables.texi (File Local Variables):
<hack-local-variables>: Say that it applies directory-local
variables too.  Add a cross-reference.
(Directory Local Variables): Document dir-local-variables-alist.
* lisp/files.el (hack-local-variables): Say that it always puts
into effect directory-local variables.
2025-03-12 10:05:32 +08:00
Stefan Kangas
87db670d04 Make locate-user-emacs-file accept a list too
This can be used to migrate to a new name, while also keeping
backwards-compatible support for an old name.

* lisp/files.el (locate-user-emacs-file): Accept a list as the
NEW-NAME argument.
* test/lisp/files-tests.el (files-test-locate-user-emacs-file): New
test for the above.
2025-03-09 18:24:21 +01:00
Eli Zaretskii
59d1aac49d Document return values of the various read-* functions
* lisp/textmodes/string-edit.el (read-string-from-buffer):
* lisp/simple.el (read-from-kill-ring, read-shell-command)
(read-signal-name):
* lisp/replace.el (read-regexp-case-fold-search):
* lisp/auth-source.el (read-passwd):
* lisp/subr.el (read-key, read-number):
* lisp/minibuffer.el (read-file-name, read-no-blanks-input):
* lisp/international/mule-cmds.el (read-multilingual-string):
* lisp/language/japan-util.el (read-hiragana-string):
* lisp/files-x.el (read-file-local-variable)
(read-file-local-variable-mode, read-file-local-variable-value):
* lisp/faces.el (read-face-font, read-face-name):
* lisp/simple.el (read-extended-command):
* lisp/env.el (read-envvar-name):
* lisp/files.el (read-directory-name):
* lisp/faces.el (read-color):
* lisp/international/mule-diag.el (read-charset):
* lisp/emacs-lisp/map-ynp.el (read-answer):
* src/coding.c (Fread_coding_system)
(Fread_non_nil_coding_system):
* src/minibuf.c (Fread_command, Fread_from_minibuffer):
* src/lread.c (Fread_char, Fread_char_exclusive, Fread_event): Doc
fixes.
2025-03-09 15:02:39 +02:00
Stefan Monnier
504bdce731 (set-auto-mode--find-matching-alist-entry): Fix bug#75961
* lisp/files.el (set-auto-mode--find-matching-alist-entry): Run the
MODE found in (REGEXP MODE t) before we replace it with something else.

* test/lisp/files-tests.el (files-tests--bug75961): New test.
2025-02-16 11:51:22 -05:00
Stefan Monnier
300bae4f7c Fix some uses of %s for non-strings/names
* lisp/files.el (normal-mode, set-auto-mode--apply-alist):
* lisp/gnus/nnimap.el (nnimap-command):
* lisp/emacs-lisp/bytecomp.el (bytecomp--check-cus-type):
Prefer %S over %s for arbitrary sexps and lists.
2025-02-14 11:25:52 -05:00
Stefan Kangas
069c8ff6d5 Improve read-directory-name docstring
* lisp/files.el (read-directory-name): Improve docstring to be more
similar to that of 'read-file-name', and refer back to it where
appropriate.
2025-02-13 08:47:10 +01:00
Joseph Turner
3f1d84d593 Add optional PREDICATE argument to read-directory-name
* lisp/files.el (read-directory-name): Add optional PREDICATE argument.
* doc/lispref/minibuf.texi (Reading File Names): Document above change.
(Bug#66224)
2025-02-13 08:32:28 +01:00
Eli Zaretskii
d58fe6619f Merge from origin/emacs-30
ba27193895 ; * etc/NEWS: Fix wording.
fdc6842a44 Remove bookmark fringe marks when deleting all bookmarks
3bccd04c5c Improve wording in symbols.texi
6441b9ea7a Fix typo in Gnus manual
87be3aa149 eglot: Allow omnisharp binary to be capitalized "OmniSharp"
5485ea6aef Do not set `trusted-content` in major modes
d11488fd6f ; * lisp/subr.el (sit-for): Doc fix.

# Conflicts:
#	etc/NEWS
2025-02-01 07:40:19 -05:00
Stefan Kangas
bf97946d7d Merge branch 'scratch/no-purespace' into 'master' 2025-02-01 04:56:52 +01:00
Stefan Kangas
5485ea6aef Do not set trusted-content in major modes
* lisp/progmodes/elisp-mode.el (lisp-interaction-mode):
* lisp/ielm.el (inferior-emacs-lisp-mode): Do not set `trusted-content.
* lisp/ielm.el (ielm):
* lisp/simple.el (get-scratch-buffer-create): Set `trusted-content` here
instead.
* lisp/files.el (trusted-content): Doc fix; warn against setting this
option to :all in a major or mode mode.
Problem reported by Max Nikulin <manikulin@gmail.com>.
2025-01-31 01:50:22 +01:00
Stefan Monnier
4fada67748 (hack-one-local-variable): Refine last patch (bug#74964)
* lisp/files.el (hack-local-variables--inhibit-eval): Rename from
`hack-local-variables--inhibit`.
(hack-one-local-variable): Skip only those eval forms we're already
in the process of evaluating.
2025-01-17 08:43:50 -05:00
Eli Zaretskii
3d960c16c6 Merge from origin/emacs-30
d66b8d4bec Fix checkbox's child creation
26c5fadf47 Document that 'package-vc' doesn't support built-in packages
ee61b9a050 ; Fix documentation of completion commands
ce43d13593 ; Simplify admin/run-codespell
fa1470d069 ; Remove duplicated word in files.el Commentary
dabaea9746 Improve checkdoc-common-verbs-wrong-voice docstring
6de2ee5663 Document string-as-{unibyte,multibyte} as obsolete in manual
7f76f872eb Fix go-ts-mode var spec indentation (Bug#75362)
01464fc882 Add "text" as a thing in tsx-ts-mode
59c5733792 Improve doc string of 'package-delete'
313a191d04 ; * admin/MAINTAINERS: Remove Kelvin White.
002960ceab Clarify that 'mac' line ending convention is not used on ...
4210e06564 Add language server for Odin
ee1034422b ; Improve documentation of function-type display
1c49edc408 Modernize "Commentary" section of files.el
505c1123e1 * INSTALL: Add advice how to invoke 'make install'.  (Bug...
82e16cae9c Improve the documentation of 'key-valid-p'

# Conflicts:
#	etc/NEWS
#	lisp/progmodes/typescript-ts-mode.el
2025-01-11 07:44:23 -05:00
Stefan Kangas
fa1470d069 ; Remove duplicated word in files.el Commentary 2025-01-11 05:18:51 +01:00
Stefan Kangas
1c49edc408 Modernize "Commentary" section of files.el
* lisp/files.el: Modernize "Commentary" section.  (Bug#75398)
2025-01-07 06:23:24 +01:00
Stefan Monnier
127fc98308 (hack-one-local-variable): Fix bug#74964
* lisp/files.el (hack-local-variables--inhibit): New var.
(hack-one-local-variable): Use it to avoid infinite recursion in a more
targeted manner.
2025-01-05 10:03:40 -05:00
Stefan Kangas
7fa975adbc Update copyright year to 2025
Run "TZ=UTC0 admin/update-copyright".
2025-01-02 18:39:42 +01:00
Paul Eggert
4da38c6321 Update copyright year to 2025
Run "TZ=UTC0 admin/update-copyright".
2025-01-01 07:39:17 +00:00
Stefan Kangas
85f5be491e Improve flag variable names in uniquify
* lisp/uniquify.el (uniquify-after-kill-buffer-flag)
(uniquify-trailing-separator-flag): Rename from
'uniquify-after-kill-buffer-p' and 'uniquify-trailing-separator-p', to
better adhere to our conventions.  Update all users and leave old names
as obsolete variable aliases.
2024-12-26 21:24:59 +01:00
Antero Mejr
78eb102bc3 Allow viewing .dcm images via image-convert
* lisp/files.el (auto-mode-alist): Support the DICOM .dcm image
format.  (Bug#63531)
2024-12-22 04:07:07 +01:00
Antero Mejr
7d41a23ad3 Allow viewing .six images via image-convert
* lisp/files.el (auto-mode-alist): Support the Sixel .six image
format.  (Bug#63531)
* lisp/image.el (imagemagick-enabled-types): Add SIX.
2024-12-22 04:07:07 +01:00
Stefan Kangas
86a8b24bde Match more gdbinit files in auto-mode-alist
* lisp/files.el (auto-mode-alist): Match more gdbinit files,
including XDG, and MS-Windows.  Avoid false positives.
(set-auto-mode--find-matching-alist-entry): Break out function...
(set-auto-mode--apply-alist): ...from here.  (Bug#74946)
* test/lisp/files-tests.el (files-tests--check-mode): New function.
(files-tests-auto-mode-alist): New test.
2024-12-22 03:00:31 +01:00
Eli Zaretskii
3617940f32 Merge from origin/emacs-30
8f8da2d785 ; * ChangeLog.4: Update.
49adcf30b0 ; * etc/AUTHORS: Update.
1381c6f959 * Update authors.el
5c0f3f5826 ; * etc/NEWS: Mark unmarked entries.
8a0c9c234f Document 'trusted-content
c6ce11b2a4 Mention network-interface-list in network-interface-info ...
a7905145f7 ; * lisp/emacs-lisp/re-builder.el (reb-change-syntax): Fi...
cde22c0201 Move NEWS items from unreleased 28.3 to released 29.1
5686bb5b42 Improve browse-url-android-share docstring
92041e15f4 Minor doc fix for url-handler-regexp
9fd96e2ab9 Improve reb-change-syntax docstring
b9dc337ea7 * lisp/files.el (trusted-content-p): Make `:all` work in ...
4b685bc4fc ; * src/process.c (Fnetwork_interface_list): Fix typo.
c14c489571 ; * lisp/net/nsm.el (nsm-trust-local-network): Fix typo.
10f976300d ; Add some tree-sitter thing content to the manual
55303a6bc0 * lisp/org/ox-texinfo.el (org-texinfo-template): Fix Info...
8b6c6cffd1 trusted-content: Adjust the last patch based on prelimina...
69b16e5c63 ; * etc/NEWS: Fix typos.
5c6dbc65f3 ; * doc/lispref/frames.texi (Multiple Terminals): Add ind...
856a58e282 Update documentation of 'etags' regexps some more
4c68846223 Update documentation of 'etags' regexps
b5158bd191 elisp-mode.el: Disable Flymake byte-compile backend in un...

# Conflicts:
#	doc/man/etags.1
#	etc/NEWS
#	lisp/org/ox-texinfo.el
2024-12-21 07:56:08 -05:00
Eli Zaretskii
8a0c9c234f Document 'trusted-content
* doc/emacs/misc.texi (Host Security): Document 'trusted-content'.

* lisp/files.el (trusted-content): Doc fix.

* etc/NEWS: Mark its entry as "documented".
2024-12-18 19:57:13 +02:00
Stefan Monnier
b9dc337ea7 * lisp/files.el (trusted-content-p): Make :all work in non-file buffers 2024-12-16 09:27:01 -05:00
Stefan Monnier
8b6c6cffd1 trusted-content: Adjust the last patch based on preliminary feedback
* lisp/files.el (trusted-content): Rename from `trusted-files`.
Update all references.

* lisp/progmodes/elisp-mode.el (lisp-interaction-mode):
* lisp/ielm.el (inferior-emacs-lisp-mode):
* lisp/simple.el (read--expression): Set `trusted-content` since
these buffers contain code that the user presumably intends to run anyway.
(elisp--safe-macroexpand-all): Make the warning more discreet.
2024-12-15 17:05:55 -05:00
Stefan Kangas
526ef8950a Remove another purecopy call in files.el
* lisp/files.el (save-some-buffers-action-alist): Don't call purecopy.
2024-12-15 19:15:40 +01:00
Stefan Monnier
b5158bd191 elisp-mode.el: Disable Flymake byte-compile backend in untrusted files
To address serious security issues (CVE-2024-53920), disable
`elisp-flymake-byte-compile` except in those files explicitly
specified as "trusted".

For that introduce a new custom var `trusted-files` and new
function `trusted-content-p`.

While at it, similarly skip the implicit macroexpansion done during
completion if the current file is not trusted.

* lisp/files.el (trusted-files): New variable.
(trusted-content-p): New function.

* lisp/progmodes/elisp-mode.el (elisp--safe-macroexpand-all):
New function, extracted from `elisp--local-variables`.
Use `trusted-content-p`.
(elisp--local-variables): Use it.
(elisp-flymake-byte-compile): Disable according to `trusted-content-p`.
2024-12-14 09:48:36 -05:00
Stefan Kangas
020128e9dc Don't use obsolete mode delhpi-mode
* lisp/files.el (auto-mode-alist): Prefer opascal-mode to obsolete
delphi-mode.
2024-12-13 01:13:52 +01:00
Stefan Kangas
538a242898 Remove purecopy calls from files.el
* lisp/files.el (null-device, file-name-invalid-regexp)
(locate-dominating-stop-dir-regexp, auto-mode-alist)
(interpreter-mode-alist, inhibit-local-variables-regexps)
(auto-mode-interpreter-regexp, magic-fallback-mode-alist)
(save-some-buffers-action-alist, list-directory-brief-switches)
(list-directory-verbose-switches, insert-directory-program)
(directory-free-space-program, directory-free-space-args)
(directory-listing-before-filename-regexp)
(file-name-handler-alist): Remove all purecopy calls.
2024-12-12 22:48:16 +01:00