Commit graph

2261 commits

Author SHA1 Message Date
dalanicolai
95d56b92a6 Fix 'locate-dominating-file' when FILE is not a directory.
* lisp/files.el (locate-dominating-file): Handle FILE that is not
a directory.  (Bug#66542)
2023-10-25 16:12:24 +03:00
Jens Schmidt
8d2a04f4c0 Better handle errors when writing r-o files without backup
* lisp/files.el (basic-save-buffer-2): Restore file permissions when
writing read-only files without backup fails.  (Bug#66546)
2023-10-25 15:56:39 +03:00
Eli Zaretskii
484fc70a7a Fix "C-0 C-x C-s" with write-protected files
* lisp/files.el (basic-save-buffer-2): Call 'set-file-modes' to
try to make the file writable, even if
'set-file-extended-attributes' succeeded.  (Bug#66546)
2023-10-16 14:17:57 +03:00
Michael Albinus
1677a65554 Merge from origin/emacs-29
dc8b336d02 * lisp/files.el (file-name-non-special): Handle quoted ti...
2023-10-14 09:38:17 +02:00
Michael Albinus
dc8b336d02 * lisp/files.el (file-name-non-special): Handle quoted tilde.
(Bug#65685)

* test/lisp/files-tests.el
(files-tests-file-name-non-special-expand-file-name-tilde):
New test.
2023-10-14 09:34:40 +02:00
Paul W. Rankin
60f3e9f5c9 Improve find-sibling-rules option type
* lisp/files.el (find-sibling-rules): More helpful rules.
2023-10-05 10:45:31 +03:00
Stefan Kangas
9f91a1c3eb Make insert-directory-program a defcustom; use "gls" on *BSD
* lisp/files.el (insert-directory-program): Change into defcustom.
Default to "gls" on *BSD and macOS.  (Bug#64791)
2023-09-25 11:36:14 +02:00
Eli Zaretskii
6d8801ee73 Merge from origin/emacs-29
476933b235 ; * lisp/simple.el (shell-command-to-string): Fix quotation.
e27ec0e414 Improve remote-file-name-inhibit-cache :type
2023-09-23 09:41:11 -04:00
Basil L. Contovounesios
e27ec0e414 Improve remote-file-name-inhibit-cache :type
* lisp/files.el (remote-file-name-inhibit-cache)
(shell-highlight-undef-remote-file-name-inhibit-cache): Avoid
duplicated :tag string.  Try to clarify wording and
formatting (bug#66150).
* lisp/shell.el (shell--highlight-undef-exec-cache): Reference
correct user option in docstring.
2023-09-22 15:15:36 +02:00
Eli Zaretskii
0273914921 Merge from origin/emacs-29
bc56da92d8 ; Fix error in 'tex-recenter-output-buffer'
d17c5adc05 Fix regexp for recognizing PBM images
9e9f61866e Improve wording in ELisp manual
7427efa033 Fix typo (Bug#65764)
59c6624408 ; * lisp/ido.el (ido-completion-buffer): Fix :type (bug#6...
4ec4b18c2a Fix libgccjit build on Haiku
80bdcf8f35 (regexp-tests-backtrack-optimization): Mark it as failing
8a9e653cc8 ; Add regression test for bug#65726
6fad73d7cc * src/regex-emacs.c (mutually_exclusive_p): Fix inf-loop ...
1d3d419607 ; * lisp/files.el (save-some-buffers-functions): Doc fix ...
42b14c6e5b Bump seq version to 2.24
ff5190a174 Add note on ELPA to admin/notes/bug-triage
f1e4cbe72a ; * etc/PROBLEMS: Minor wording fix.
fd5593c7f2 * etc/PROBLEMS: Mention bug#65432 and its remedy.
dd896ea1e6 Ignore errors when checking for object initializers (bug#...
3550f44c17 ; Fix typos
5b246b9b81 * CONTRIBUTE: Document making ChangeLogs with Magit.
0bd4661941 Doc fixes for obsolete functions and variables
524c0c34f2 ; * lisp/ffap.el (ffap-rfs-regexp): Fix :type (bug#65698).
f48dccc467 Merge branch 'emacs-29' of git.savannah.gnu.org:/srv/git/...
71a85e2266 A revision to the Widget manual
dbbcf4a659 Fix fontification of " in edit-kbd-macro

# Conflicts:
#	test/src/regex-emacs-tests.el
2023-09-09 04:32:45 -04:00
Eli Zaretskii
1d3d419607 ; * lisp/files.el (save-some-buffers-functions): Doc fix (bug#65414). 2023-09-04 19:06:19 +03:00
Po Lu
91830b8bf3 Revise last change to copy-directory
* lisp/files.el (copy-directory): Instead of demoting errors
from set-file-times, refrain from setting them if newname is
located within /contents.
2023-08-26 16:37:31 +08:00
Po Lu
349798a9b8 Demote errors from utimensat copying directories
* lisp/files.el (copy-directory): Wrap set-file-times within
with-demoted-errors.

* src/fileio.c (Fcopy_file): Adjust commentary.
2023-08-26 09:57:32 +08:00
Michael Albinus
e4dc0d6c7e * lisp/files.el (file-remote-p): Simplify. 2023-08-23 11:00:34 +02:00
Eli Zaretskii
e3207b13ce Fix behavior of client frames when 'find-alternate-file' is used
* lisp/files.el (find-alternate-file-dont-kill-client): New var.
(find-alternate-file): Bind it to a special value when invoking
kill-buffer-hook.
* lisp/server.el (server-delete-client): If NOFRAME is
'dont-kill-client', don't kill the client and its terminals.
(server-buffer-done): Pass 'find-alternate-file-dont-kill-client'
to 'server-delete-client'.  (Bug#65277)
2023-08-19 10:34:07 +03:00
Mattias Engdegård
1ad318cf2a ob-tangle.el: fix unintended range in regexp
* lisp/org/ob-tangle.el (org-babel-interpret-file-mode):
Repair parts of regexp that should only match +, - and =.
* lisp/files.el (file-modes-symbolic-to-number):
Fix the same error in a doc string; this seems to be where
the mistake originated.
2023-08-16 16:55:38 +02:00
Eli Zaretskii
b289f0769f Merge from origin/emacs-29
4767f5eaee Better fix for bug#65156
dd1d8414b3 Fix insert-file-contents with pipes and /dev/stdin
50649a6d1a ; * etc/PROBLEMS: Fix wording.
f0dda682ff ; * etc/NEWS.28: Add deletion of levents.el.
f4acae842c Fix bug#65042
e1874c4e8b * configure.ac (HAVE_TREE_SITTER): Set NEED_DYNLIB=yes (b...
ef8838c3a5 * etc/NEWS: Mention tramp-show-ad-hoc-proxies.
495bee253f * test/lisp/net/tramp-tests.el (tramp-test42-utf8): Skip ...
de1effd73b ; Fix last change
7c7966862b * test/lisp/net/tramp-tests.el (tramp-test10-write-region...
16205e8db6 ; Improve help-echo in package.el
a95e700698 ; Filter packages available for upgrade via menu bar
adff72dd1d Fix reverting Rmail buffers
2023-08-12 13:42:14 -04:00
Stefan Kangas
6cc9910227 Make dired-move-to-filename-regexp obsolete
* lisp/dired.el (dired-move-to-filename-regexp): Make Emacs 21
compatibility alias obsolete.
2023-08-12 15:46:17 +02:00
Eli Zaretskii
4fa75771d1 ; * lisp/files.el (delete-file): Add expand-file-name back. 2023-08-11 15:03:48 +03:00
Po Lu
3fb2c174d3 Enable visiting FIFOs as files
* doc/lispref/files.texi (Reading from Files): Document new
`if-regular' value of REPLACE.

* etc/NEWS: Announce the new value.

* lisp/files.el (basic-save-buffer-2): Demote errors saving
backup files, since FIFOs cannot be copied.
(revert-buffer-insert-file-contents--default-function): Supply
`if-regular' instead of t as REPLACE.

* src/fileio.c (selinux_enabled_p): New function.
(Fcopy_file, Ffile_selinux_context, Fset_file_selinux_context):
Call that function to ascertain if SELinux applies to a file.
(read_non_regular): Don't assume `emacs_fd_read' always returns
int.
(Finsert_file_contents): If REPLACE is if-regular and FILENAME
is a special non-seekable file, fall back to erasing the buffer
before inserting the contents of that file.
(syms_of_fileio) <Qif_regular>: New symbol.
2023-08-08 13:37:00 +08:00
Po Lu
072a8a434e Merge remote-tracking branch 'origin/master' into feature/android 2023-08-07 07:56:44 +08:00
Eli Zaretskii
400df210ce Fix last change of 'delete-file'
* src/fileio.c (Fdelete_file_internal): Expand file name here, as
all primitives must.
(internal_delete_file): Adjust to the fact that Fdelete_file was
renamed.

* lisp/files.el (delete-file): Don't expand-file-name here, as
the called primitives already do.  Fix typo in doc string.
2023-08-06 17:03:26 +03:00
Po Lu
7ffc5f86e4 Merge remote-tracking branch 'origin/master' into feature/android 2023-08-06 21:45:44 +08:00
Eric S. Raymond
10a7615b5d Separate filename-deletion mechanism from policy.
src/fileio.c: (delete-file-internal) Renamed from delete-file,
              parallel to delete-directory-internal; policy
	      code moved to Lisp.
src/files.el: (delete-file) New function, holds policy logic.
              calls delete-file-internal.

This is a pure refactoring step, delete-file's behavior is
unchanged. But the C core is a little simpler now.
2023-08-06 09:31:39 -04:00
Eli Zaretskii
adff72dd1d Fix reverting Rmail buffers
This bug happened because rmail.el relied on 'revert-buffer' to
return non-nil when it succeeds to revert, but a recent change
in 'revert-buffer' broke that promise in Emacs 29.1.
* lisp/files.el (revert-buffer--default, revert-buffer): Doc fix.
(revert-buffer): Return whatever 'revert-buffer-function' returns.
(Bug#65071)
2023-08-06 09:33:44 +03:00
Po Lu
53023eba94 Merge remote-tracking branch 'origin/master' into feature/android 2023-07-17 20:44:00 +08:00
Eli Zaretskii
9d332c4993 ; * lisp/files.el (create-file-buffer): Add commentary. 2023-07-17 14:36:44 +03:00
Eli Zaretskii
5b6b95dbf8 ; * lisp/files.el (create-file-buffer): Fix last change (bug#62732). 2023-07-17 14:34:35 +03:00
Po Lu
a65960c5b9 Merge remote-tracking branch 'origin/master' into feature/android 2023-07-14 07:58:49 +08:00
Spencer Baugh
ee4cc106b8 Don't recalculate the buffer basename inside uniquify
Previously, uniquify--create-file-buffer-advice would use the filename
of the buffer to calculate what the buffer's basename should be.  Now
that gets passed in from create-file-buffer, which lets us fix several
bugs:

1. before this patch, if a buffer happened to be named the same thing
as directory in its default-directory, the buffer would get renamed
with a directory separator according to uniquify-trailing-separator-p.

2. buffers with a leading space should get a leading |, as described
by create-file-buffer's docstring; before this patch, uniquify would
remove that leading |.

* lisp/dired.el (dired-internal-noselect): Pass a directory name to
create-file-buffer.
* lisp/files.el (create-file-buffer): Do uniquify-trailing-separator-p
handling if passed a directory filename. (bug#62732)
* lisp/uniquify.el (uniquify-item):
(uniquify-rationalize-file-buffer-names, uniquify-rationalize,
uniquify-get-proposed-name, uniquify-rationalize-conflicting-sublist):
Remove uniquify-trailing-separator-p handling.
(uniquify--create-file-buffer-advice): Take new basename argument and
use it, instead of recalculating the basename from the filename.
2023-07-13 17:50:56 -04:00
Po Lu
dc7ecc6e31 Merge remote-tracking branch 'origin/master' into feature/android 2023-07-11 08:19:32 +08:00
Jim Porter
a6e88dc726 Add support for explicitly-remote commands in Eshell
* lisp/files.el (file-remote-p):
* doc/lispref/files.texi (Magic File Names): Document 'never' for
CONNECTED argument.

* lisp/net/tramp.el (tramp-handle-file-remote-p): Handle CONNECTED
value of 'never'.

* lisp/eshell/esh-ext.el (eshell-explicit-remote-commands): New
option.
(eshell-ext-initialize): Apply 'eshell-handle-remote-command' when
requested.
(eshell-handle-remote-command): New function.
(eshell-remote-command): Reimplement this function and dispatch to
'eshell-external-command', which can handle remote processes on its
own.

* test/lisp/eshell/esh-ext-tests.el
(esh-ext-test/explicitly-remote-command)
(esh-ext-test/explicitly-local-command): New tests.

* doc/misc/eshell.texi (Remote Access): Document explicitly-remote
commands.

* etc/NEWS: Announce this change.
2023-07-10 12:27:09 -07:00
Po Lu
af8232a150 Merge remote-tracking branch 'origin/master' into feature/android 2023-07-06 08:34:26 +08:00
Michael Albinus
2dc7798449 `remote-file-name-access-timeout' being 0 is equal to nil
* doc/lispref/files.texi (Testing Accessibility): Clarify the
value of remote-file-name-access-timeout.

* etc/NEWS: Clarify the value of remote-file-name-access-timeout.

* lisp/files.el (remote-file-name-access-timeout): Adapt docstring.

* lisp/net//tramp.el (with-tramp-timeout): Ensure, that the
timeout is a positive number, or nil.
(tramp-handle-access-file): Simplify code.
2023-07-05 10:05:44 +02:00
Po Lu
79207a055f Merge remote-tracking branch 'origin/master' into feature/android 2023-07-04 08:52:29 +08:00
Michael Albinus
c565a6c62c Add user option remote-file-name-access-timeout
* doc/lispref/files.texi (Testing Accessibility):
Add user option remote-file-name-access-timeout.

* doc/misc/tramp.texi (Frequently Asked Questions):
Explain remote-file-name-access-timeout.

* etc/NEWS: Mention 'remote-file-name-access-timeout'.

* lisp/files.el (remote-file-name-access-timeout): New defcustom.
(remote-file-name-inhibit-auto-save-visited)
(remote-file-name-inhibit-locks, remote-file-name-inhibit-cache)
(remote-file-name-inhibit-delete-by-moving-to-trash):
* lisp/simple.el (remote-file-name-inhibit-auto-save): Add group `tramp'.

* lisp/net/tramp.el (with-tramp-timeout, with-tramp-suspended-timers):
New defmacros.
(tramp-dont-suspend-timers): New defvar.
(tramp-handle-access-file): Implement handling of
`remote-file-name-access-timeout'.  (Bug#64401)
(tramp-action-show-and-confirm-message, tramp-process-actions)
(with-tramp-locked-connection, tramp-wait-for-regexp)
(tramp-read-passwd, tramp-read-passwd-without-cache): Use the macros.

* test/lisp/net/tramp-tests.el (remote-file-name-access-timeout):
Declare.
(tramp-test18-file-attributes): Extend test.
2023-07-03 18:24:11 +02:00
Po Lu
67db3bfdc2 Merge remote-tracking branch 'origin/master' into feature/android 2023-05-13 08:53:57 +08:00
Antero Mejr
0b39e4daee Handle case-insensitivity for safe-local-variable-directories.
* lisp/emacs-lisp/files.el (hack-local-variables-filter): Use
'file-equal-p' when checking 'safe-local-variable-directories'.
* doc/lispref/variables.texi (File Local Variables): Remove sentences
in 'safe-local-variable-directories' description about case-sensitivity
and trailing slash behaviors.
* doc/emacs/custom.texi (Safe File Variables): Remove sentence about
'safe-local-variable-directories' trailing slash behavior.
(Bug#61901)
2023-05-12 13:47:22 +03:00
Po Lu
7ac8bcaacc Merge remote-tracking branch 'origin/master' into feature/android 2023-05-12 10:43:52 +08:00
Eli Zaretskii
1eda3d9dc5 ; Fix last change
* lisp/files.el (safe-local-variable-directories):
* doc/lispref/variables.texi (File Local Variables):
* doc/emacs/custom.texi (Safe File Variables): Fix wording of
documentation in last change.  (Bug#61901)
2023-05-11 16:52:50 +03:00
Antero Mejr
f24ea84f43 Add safe-local-variable-directories variable.
This variable can be set to automatically load risky dir-local
variables from a list of trusted directories.

* lisp/emacs-lisp/files.el (safe-local-variable-directories,
hack-local-variables-filter, hack-local-variables-confirm): New
variable and associated logic.
* test/lisp/files-tests.el
(files-tests-safe-local-variable-directories): Add tests for same.
* doc/emacs/custom.texi (Safe File Variables): Add documentation for
same.
* doc/lispref/variables.texi (File Local Variables): Add documentation
for same.
* etc/NEWS (Lisp Changes in Emacs 30.1): Add news entry for
same.  (Bug#61901)
2023-05-11 16:33:16 +03:00
Po Lu
458c6e5c91 Merge remote-tracking branch 'origin/master' into feature/android 2023-04-05 07:58:05 +08:00
Michael Albinus
b3046c6c1f Display unlock-file warning only when file locks are enabled
* lisp/files.el (remote-file-name-inhibit-locks): Fix docstring.

* lisp/userlock.el (userlock--handle-unlock-error):
Display warning only when `create-lockfiles' is non-nil.  (Bug#62614)

* lisp/net/tramp.el (tramp-handle-unlock-file): Raise a warning
only when `create-lockfiles' is non-nil or
`remote-file-name-inhibit-locks' is nil.
2023-04-04 09:43:09 +02:00
Po Lu
0dbbdd20f4 Merge remote-tracking branch 'origin/master' into feature/android 2023-03-05 19:59:06 +08:00
Stefan Kangas
6fb8a4dff7 Merge from origin/emacs-29
836044f329 Fix c-ts-mode preproc directive indentation
64980a59b6 ; * lisp/files.el (hack-local-variables): Fix typo in the...
a7cd125d49 More robustly unspoof HOME in Eglot tests (bug#61637)
6c66dbd02c Turn on Eglot inlay hints by default
246f5b541c Update ts modes missed in 4c16fd3a51 to use column-0
0bfba49ca7 Robustify Eglot for "transient" projects
ea5fd375bb Fix documentation of 'normal-mode' in buffers that don't ...
4c16fd3a51 Change tree-sitter indent anchor 'point-min' to 'column-0'
f47b393015 Fix go-ts-mode multi-line string indentation (bug#61923)
e0bf2da3db ; More accurate doc strings for 'window-at' and 'window-a...
2023-03-05 06:30:15 +01:00
Eli Zaretskii
64980a59b6 ; * lisp/files.el (hack-local-variables): Fix typo in the doc string. 2023-03-04 22:03:14 +02:00
Eli Zaretskii
ea5fd375bb Fix documentation of 'normal-mode' in buffers that don't visit files
* lisp/files.el (normal-mode):
* lisp/subr.el (run-mode-hooks):
* doc/emacs/modes.texi (Choosing Modes): Mention the caveat with
'normal-mode' in buffers not visiting files.  (Bug#61925)
* lisp/files.el (hack-local-variables): Doc fix.
2023-03-04 12:16:51 +02:00
Po Lu
48b5a770f2 Fix visiting and saving writable content provider files
* java/org/gnu/emacs/EmacsService.java (checkContentUri):
Improve debug output.
* lisp/files.el (basic-save-buffer): Check whether or not file
itself exists before checking for the existence of the directory
containing it.
* src/android.c (android_open): Don't forget to set errno after
open_content_uri fails.
2023-03-03 16:00:27 +08:00
Stefan Kangas
1bed13111b Merge from origin/emacs-29
b0cbd5590b Eglot: simplify inlay hints implementation with jit-lock
91e24c5b5a Eglot: update inlay hints on window configuration changes
79fead1709 ; Fix a typo in a doc string in c-ts-common.el (bug#61736).
a0b273ef30 ; Clarify documentation of 'file-modes-number-to-symbolic'
5c2be6a263 ; Fix recently-added doc strings in eglot.el
e3be0dbf85 Eglot: display completion label when safe
5286111ea1 Improve documentation of VC commands, including in Dired
990f402713 * doc/emacs/maintaining.texi: More mentions of marked fil...
2023-02-24 06:30:11 +01:00
Eli Zaretskii
a0b273ef30 ; Clarify documentation of 'file-modes-number-to-symbolic'
* doc/lispref/files.texi (Changing Files):
* lisp/files.el (file-modes-number-to-symbolic): Clarify the
confusion with "symbolic" forms of file modes.  (Bug#61709)
2023-02-23 17:45:52 +02:00