1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-12 09:28:24 +00:00
Commit Graph

2060 Commits

Author SHA1 Message Date
Stefan Kangas
261367781b * lisp/files.el (user-emacs-directory-warning): Clarify docstring. 2021-11-07 19:48:45 +01:00
Eli Zaretskii
2ba4ccf290 ; * lisp/files.el (make-nearby-temp-file): Doc fix. 2021-10-31 17:20:16 +02:00
Juri Linkov
575e626105 Add symbol property 'save-some-buffers-function' (bug#46374)
* lisp/files.el (save-some-buffers-root): Put non-nil
symbol property 'save-some-buffers-function'.
(save-some-buffers): Check pred for the
symbol property 'save-some-buffers-function'.
(save-some-buffers-default-predicate): Mention
symbol property 'save-some-buffers-function'.
2021-10-10 20:38:12 +03:00
Stefan Kangas
0a7bab689c ; Minor stylistic fixes found by checkdoc 2021-10-05 02:06:57 +02:00
Eli Zaretskii
13e5943386 ; Fix a typo in a doc string
* lisp/files.el (hack-local-variables--find-variables): Fix typo
in the doc string.
2021-10-02 15:57:51 +03:00
Lars Ingebrigtsen
83e08dfef3 save-some-buffers-root doc string change
* lisp/files.el (save-some-buffers-root): Improve doc string.
2021-09-25 07:32:48 +02:00
Stefan Kangas
aebba085cb ; More minor stylistic fixes found by checkdoc 2021-09-22 20:26:40 +02:00
John Cummings
b95157de2d Fix disk-free info in 'insert-directory'
* lisp/files.el (insert-directory): Call 'get-free-disk-space'
with the argument FILE, to make sure the reported info is for the
correct volume.  (Bug#50630)

Copyright-paperwork-exempt: yes
2021-09-17 10:03:15 +03:00
Stefan Kangas
63f419f133 ; Minor stylistic fixes found by checkdoc 2021-09-16 19:37:07 +02:00
Lars Ingebrigtsen
5ee05fa75d Fix typo in previous files.el change 2021-09-13 15:32:20 +02:00
Lars Ingebrigtsen
59ff342869 Mention unibyte issues in insert-file-contents-literally doc string
* lisp/files.el (insert-file-contents-literally): Mention possible
issues with multibyte buffers (bug#50560).
2021-09-13 15:17:06 +02:00
Stefan Kangas
f02624b342 ; Minor doc fixes found by checkdoc 2021-09-13 06:44:52 +02:00
Lars Ingebrigtsen
7a4d823b39 Fix revert-buffer' message in find-file-select'
* lisp/files.el (find-file-noselect): Refer to revert-buffer-quick
here since we're in a file-based buffer.
2021-09-03 07:48:10 +02:00
Lars Ingebrigtsen
591b8bd87a Add new variable 'kill-buffer/delete-auto-save-files'
* doc/emacs/files.texi (Auto Save Files): Document it.
* lisp/cus-start.el (standard): Add customize form.

* lisp/files.el (delete-auto-save-files): Move definition to C
(since it's used in the C layer).

* src/buffer.c (Fkill_buffer): Use the new variable (and remove
the old code that apparently didn't trigger for
kill-buffer/delete-auto-save-files.
(syms_of_buffer): Add new variable
kill-buffer-delete-auto-save-files and move definition of
delete-auto-save-files here (bug#21612).
2021-08-23 15:56:54 +02:00
Lars Ingebrigtsen
06c3a321e3 Revert "Fix dired switch (that contain quotes and spaces) parsing"
This reverts commit 04f723dec9.

The dired switches are documented to not follow shell syntax, but instead
uses a lisp-in-string-form kind of quoting.
2021-08-22 16:58:19 +02:00
Colin Woodbury
16bb524a5e Don't echo empty string in file-name-with-extension
* lisp/files.el (file-name-with-extension): Avoid echoing a filename
string known to be empty (bug#50149).
2021-08-22 16:27:12 +02:00
Eli Zaretskii
beb54dc1b2 Improve documentation of 'file-preserve-symlinks-on-save'
* lisp/files.el (file-precious-flag): Mention
'file-preserve-symlinks-on-save' in the doc string.

* doc/lispref/files.texi (Saving Buffers): Move the description of
'file-preserve-symlinks-on-save' from here...
* doc/emacs/files.texi (Customize Save): ...to here.  Improve
wording.

* etc/NEWS: Fix wording of 'file-preserve-symlinks-on-save' entry.
2021-08-21 10:58:24 +03:00
Lars Ingebrigtsen
13fdded2c1 Allow preserving symlinks with file-precious-flag set
* doc/lispref/files.texi (Saving Buffers): Document it.
* lisp/files.el (file-preserve-symlinks-on-save): New user option
(bug#18125).
(basic-save-buffer-2): Use it.
2021-08-20 16:20:51 +02:00
Marco Centurion
657fe8b9d8 Allow copy-directory to copy the source as a symlink
* doc/emacs/files.texi (Copying and Naming): Document it.

* lisp/files.el (copy-directory): Allow copying symbolic links as
is (bug#10897).
(copy-directory-create-symlink): New user option.

Copyright-paperwork-exempt: yes
2021-08-20 15:43:41 +02:00
Lars Ingebrigtsen
04f723dec9 Fix dired switch (that contain quotes and spaces) parsing
* lisp/files.el (insert-directory): Tokenize shell strings
correctly (bug#18875).
2021-08-19 16:21:07 +02:00
Lars Ingebrigtsen
cebe18b63e permanently-enabled-local-variables doc string clarification
* lisp/files.el (permanently-enabled-local-variables): Clarify
what kind of local variables this refers to.
2021-08-13 14:44:30 +02:00
Juri Linkov
a9ad3d4774 Add save-some-buffers-root to save-some-buffers-default-predicate (bug#46374)
* lisp/files.el (save-some-buffers-default-predicate): Add choice
'save-some-buffers-root'.
(save-some-buffers-root): New predicate function.
(save-some-buffers): Check if 'pred' returns a lexically-bound lambda,
then use it as 'pred'.

Thanks to Tino Calancha <tino.calancha@gmail.com>
2021-08-13 10:10:29 +03:00
Juri Linkov
fc174eb20b ; Fix typos 2021-08-11 10:10:19 +03:00
Lars Ingebrigtsen
ebaae4480e Add a new command `revert-buffer-quick'
* doc/emacs/files.texi (Reverting): Document it.
* lisp/bindings.el (ctl-x-x-map): Bind `C-x x g' to
`revert-buffer-quick' instead.

* lisp/files.el (revert-buffer-quick-short-answers): New user option.
(revert-buffer-quick): New command (bug#49869).
2021-08-10 16:41:37 +02:00
Mattias Engdegård
3b7b181bde Use string-search instead of string-match[-p]
`string-search` is easier to understand, less error-prone, much
faster, does not pollute the regexp cache, and does not mutate global
state.  Use it where applicable and obviously safe (erring on the
conservative side).

* admin/authors.el (authors-canonical-file-name)
(authors-scan-change-log):
* lisp/apropos.el (apropos-command)
(apropos-documentation-property, apropos-symbols-internal):
* lisp/arc-mode.el (archive-arc-summarize)
(archive-zoo-summarize):
* lisp/calc/calc-aent.el (math-read-factor):
* lisp/calc/calc-ext.el (math-read-big-expr)
(math-format-nice-expr, math-format-number-fancy):
* lisp/calc/calc-forms.el (math-read-angle-brackets):
* lisp/calc/calc-graph.el (calc-graph-set-range):
* lisp/calc/calc-keypd.el (calc-keypad-press):
* lisp/calc/calc-lang.el (tex, latex, math-read-big-rec):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-user-define-permanent, math-define-exp):
* lisp/calc/calc.el (calc-record, calcDigit-key)
(calc-count-lines):
* lisp/calc/calcalg2.el (calc-solve-for, calc-poly-roots)
(math-do-integral):
* lisp/calc/calcalg3.el (calc-find-root, calc-find-minimum)
(calc-get-fit-variables):
* lisp/cedet/ede/speedbar.el (ede-tag-expand):
* lisp/cedet/semantic/java.el (semantic-java-expand-tag):
* lisp/cedet/semantic/sb.el (semantic-sb-show-extra)
(semantic-sb-expand-group):
* lisp/cedet/semantic/wisent/python.el
(semantic-python-instance-variable-p):
* lisp/cus-edit.el (get):
* lisp/descr-text.el (describe-text-sexp):
* lisp/dired-aux.el (dired-compress-file):
* lisp/dired-x.el (dired-make-relative-symlink):
* lisp/dired.el (dired-glob-regexp):
* lisp/dos-fns.el (dos-convert-standard-filename, dos-8+3-filename):
* lisp/edmacro.el (edmacro-format-keys):
* lisp/emacs-lisp/eieio-opt.el (eieio-sb-expand):
* lisp/emacs-lisp/eieio-speedbar.el (eieio-speedbar-object-expand):
* lisp/emacs-lisp/lisp-mnt.el (lm-keywords-list):
* lisp/emacs-lisp/warnings.el (display-warning):
* lisp/emulation/viper-ex.el (viper-ex-read-file-name)
(ex-print-display-lines):
* lisp/env.el (read-envvar-name, setenv):
* lisp/epa-mail.el (epa-mail-encrypt):
* lisp/epg.el (epg--start):
* lisp/erc/erc-backend.el (erc-parse-server-response):
* lisp/erc/erc-dcc.el (erc-dcc-member):
* lisp/erc/erc-speedbar.el (erc-speedbar-expand-server)
(erc-speedbar-expand-channel, erc-speedbar-expand-user):
* lisp/erc/erc.el (erc-send-input):
* lisp/eshell/em-glob.el (eshell-glob-entries):
* lisp/eshell/esh-proc.el (eshell-needs-pipe-p):
* lisp/eshell/esh-util.el (eshell-convert):
* lisp/eshell/esh-var.el (eshell-envvar-names):
* lisp/faces.el (x-resolve-font-name):
* lisp/ffap.el (ffap-file-at-point):
* lisp/files.el (wildcard-to-regexp, shell-quote-wildcard-pattern):
* lisp/forms.el (forms--update):
* lisp/frameset.el (frameset-filter-unshelve-param):
* lisp/gnus/gnus-art.el (article-decode-charset):
* lisp/gnus/gnus-kill.el (gnus-kill-parse-rn-kill-file):
* lisp/gnus/gnus-mlspl.el (gnus-group-split-fancy):
* lisp/gnus/gnus-msg.el (gnus-summary-resend-message-insert-gcc)
(gnus-inews-insert-gcc):
* lisp/gnus/gnus-rfc1843.el (rfc1843-decode-article-body):
* lisp/gnus/gnus-search.el (gnus-search-indexed-parse-output)
(gnus-search--complete-key-data):
* lisp/gnus/gnus-spec.el (gnus-parse-simple-format):
* lisp/gnus/gnus-sum.el (gnus-summary-refer-article):
* lisp/gnus/gnus-util.el (gnus-extract-address-components)
(gnus-newsgroup-directory-form):
* lisp/gnus/gnus-uu.el (gnus-uu-grab-view):
* lisp/gnus/gnus.el (gnus-group-native-p, gnus-short-group-name):
* lisp/gnus/message.el (message-check-news-header-syntax)
(message-make-message-id, message-user-mail-address)
(message-make-fqdn, message-get-reply-headers, message-followup):
* lisp/gnus/mm-decode.el (mm-dissect-buffer):
* lisp/gnus/nnheader.el (nnheader-insert):
* lisp/gnus/nnimap.el (nnimap-process-quirk)
(nnimap-imap-ranges-to-gnus-ranges):
* lisp/gnus/nnmaildir.el (nnmaildir--ensure-suffix):
* lisp/gnus/nnmairix.el (nnmairix-determine-original-group-from-path):
* lisp/gnus/nnrss.el (nnrss-match-macro):
* lisp/gnus/nntp.el (nntp-find-group-and-number):
* lisp/help-fns.el (help--symbol-completion-table-affixation):
* lisp/help.el (help-function-arglist):
* lisp/hippie-exp.el (he-concat-directory-file-name):
* lisp/htmlfontify.el (hfy-relstub):
* lisp/ido.el (ido-make-prompt, ido-complete, ido-copy-current-word)
(ido-exhibit):
* lisp/image/image-converter.el (image-convert-p):
* lisp/info-xref.el (info-xref-docstrings):
* lisp/info.el (Info-toc-build, Info-follow-reference)
(Info-backward-node, Info-finder-find-node)
(Info-speedbar-expand-node):
* lisp/international/mule-diag.el (print-fontset-element):
* lisp/language/korea-util.el (default-korean-keyboard):
* lisp/linum.el (linum-after-change):
* lisp/mail/ietf-drums.el (ietf-drums-parse-address):
* lisp/mail/mail-utils.el (mail-dont-reply-to):
* lisp/mail/rfc2047.el (rfc2047-encode-1, rfc2047-decode-string):
* lisp/mail/rfc2231.el (rfc2231-parse-string):
* lisp/mail/rmailkwd.el (rmail-set-label):
* lisp/mail/rmailsum.el (rmail-header-summary):
* lisp/mail/smtpmail.el (smtpmail-maybe-append-domain)
(smtpmail-user-mail-address):
* lisp/mail/uce.el (uce-reply-to-uce):
* lisp/man.el (Man-default-man-entry):
* lisp/mh-e/mh-alias.el (mh-alias-gecos-name)
(mh-alias-minibuffer-confirm-address):
* lisp/mh-e/mh-comp.el (mh-forwarded-letter-subject):
* lisp/mh-e/mh-speed.el (mh-speed-parse-flists-output):
* lisp/mh-e/mh-utils.el (mh-collect-folder-names-filter)
(mh-folder-completion-function):
* lisp/minibuffer.el (completion--make-envvar-table)
(completion-file-name-table, completion-flex-try-completion)
(completion-flex-all-completions):
* lisp/mpc.el (mpc--proc-quote-string, mpc-cmd-special-tag-p)
(mpc-constraints-tag-lookup):
* lisp/net/ange-ftp.el (ange-ftp-send-cmd)
(ange-ftp-allow-child-lookup):
* lisp/net/mailcap.el (mailcap-mime-types):
* lisp/net/mairix.el (mairix-search-thread-this-article):
* lisp/net/pop3.el (pop3-open-server):
* lisp/net/soap-client.el (soap-decode-xs-complex-type):
* lisp/net/socks.el (socks-filter):
* lisp/nxml/nxml-outln.el (nxml-highlighted-qname):
* lisp/nxml/rng-cmpct.el (rng-c-expand-name, rng-c-expand-datatype):
* lisp/nxml/rng-uri.el (rng-uri-file-name-1):
* lisp/obsolete/complete.el (partial-completion-mode)
(PC-do-completion):
* lisp/obsolete/longlines.el (longlines-encode-string):
* lisp/obsolete/nnir.el (nnir-compose-result):
* lisp/obsolete/terminal.el (te-quote-arg-for-sh):
* lisp/obsolete/tpu-edt.el (tpu-check-search-case):
* lisp/obsolete/url-ns.el (isPlainHostName):
* lisp/pcmpl-unix.el (pcomplete/scp):
* lisp/play/dunnet.el (dun-listify-string2, dun-get-path)
(dun-unix-parse, dun-doassign, dun-cat, dun-batch-unix-interface):
* lisp/progmodes/ebnf2ps.el: (ebnf-eps-header-footer-comment):
* lisp/progmodes/gdb-mi.el (gdb-var-delete)
(gdb-speedbar-expand-node, gdbmi-bnf-incomplete-record-result):
* lisp/progmodes/gud.el (gud-find-expr):
* lisp/progmodes/idlw-help.el (idlwave-do-context-help1):
* lisp/progmodes/idlw-shell.el (idlwave-shell-mode)
(idlwave-shell-filter-hidden-output, idlwave-shell-filter):
* lisp/progmodes/idlwave.el (idlwave-skip-label-or-case)
(idlwave-routine-info):
* lisp/progmodes/octave.el (inferior-octave-completion-at-point):
* lisp/progmodes/sh-script.el (sh-add-completer):
* lisp/progmodes/sql.el (defun):
* lisp/progmodes/xscheme.el (xscheme-process-filter):
* lisp/replace.el (query-replace-compile-replacement)
(map-query-replace-regexp):
* lisp/shell.el (shell--command-completion-data)
(shell-environment-variable-completion):
* lisp/simple.el (display-message-or-buffer):
* lisp/speedbar.el (speedbar-dired, speedbar-tag-file)
(speedbar-tag-expand):
* lisp/subr.el (split-string-and-unquote):
* lisp/tar-mode.el (tar-extract):
* lisp/term.el (term-command-hook, serial-read-name):
* lisp/textmodes/bibtex.el (bibtex-print-help-message):
* lisp/textmodes/ispell.el (ispell-lookup-words, ispell-filter)
(ispell-parse-output, ispell-buffer-local-parsing):
* lisp/textmodes/reftex-cite.el (reftex-do-citation):
* lisp/textmodes/reftex-parse.el (reftex-notice-new):
* lisp/textmodes/reftex-ref.el (reftex-show-entry):
* lisp/textmodes/reftex.el (reftex-compile-variables):
* lisp/textmodes/tex-mode.el (tex-send-command)
(tex-start-tex, tex-append):
* lisp/thingatpt.el (thing-at-point-url-at-point):
* lisp/tmm.el (tmm-add-one-shortcut):
* lisp/transient.el (transient-format-key):
* lisp/url/url-auth.el (url-basic-auth)
(url-digest-auth-directory-id-assoc):
* lisp/url/url-news.el (url-news):
* lisp/url/url-util.el (url-parse-query-string):
* lisp/vc/vc-cvs.el (vc-cvs-parse-entry):
* lisp/wid-browse.el (widget-browse-sexp):
* lisp/woman.el (woman-parse-colon-path, woman-mini-help)
(WoMan-getpage-in-background, woman-negative-vertical-space):
* lisp/xml.el:
* test/lisp/emacs-lisp/check-declare-tests.el
(check-declare-tests-warn):
* test/lisp/files-tests.el
(files-tests-file-name-non-special-dired-compress-handler):
* test/lisp/net/network-stream-tests.el (server-process-filter):
* test/src/coding-tests.el (ert-test-unibyte-buffer-dos-eol-decode):
Use `string-search` instead of `string-match` and `string-match-p`.
2021-08-09 11:35:56 +02:00
Mattias Engdegård
051434fdef Use string-replace instead of replace-regexp-in-string
`string-replace` is easier to understand, less error-prone, much
faster, and results in shorter Lisp and byte code.  Use it where
applicable and obviously safe (erring on the conservative side).

* admin/authors.el (authors-scan-change-log):
* lisp/autoinsert.el (auto-insert-alist):
* lisp/calc/calc-prog.el (calc-edit-macro-combine-alg-ent)
(calc-edit-macro-combine-ext-command)
(calc-edit-macro-combine-var-name):
* lisp/calc/calc-units.el (math-make-unit-string):
* lisp/calendar/cal-html.el (cal-html-comment):
* lisp/calendar/cal-tex.el (cal-tex-comment):
* lisp/calendar/icalendar.el (icalendar--convert-string-for-export)
(icalendar--convert-string-for-import):
* lisp/calendar/iso8601.el (iso8601--concat-regexps)
(iso8601--full-time-match, iso8601--combined-match):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/todo-mode.el (todo-filter-items-filename):
* lisp/cedet/cedet-files.el (cedet-directory-name-to-file-name)
(cedet-file-name-to-directory-name):
* lisp/comint.el (comint-watch-for-password-prompt):
* lisp/dired-aux.el (dired-do-chmod):
* lisp/dired-x.el (dired-man):
* lisp/dired.el (dired-insert-directory, dired-goto-file-1):
* lisp/emacs-lisp/comp.el (comp-c-func-name):
* lisp/emacs-lisp/re-builder.el (reb-copy):
* lisp/erc/erc-dcc.el (erc-dcc-unquote-filename):
* lisp/erc/erc.el (erc-quit-reason-zippy, erc-part-reason-zippy)
(erc-update-mode-line-buffer, erc-message-english-PART):
* lisp/files.el (make-backup-file-name-1, files--transform-file-name)
(read-file-modes):
* lisp/fringe.el (fringe-mode):
* lisp/gnus/gnus-art.el (gnus-button-handle-info-url):
* lisp/gnus/gnus-group.el (gnus-group-completing-read):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-ical):
* lisp/gnus/gnus-mlspl.el (gnus-group-split-fancy):
* lisp/gnus/gnus-search.el (gnus-search-query-parse-date)
(gnus-search-transform-expression, gnus-search-run-search):
* lisp/gnus/gnus-start.el (gnus-dribble-enter):
* lisp/gnus/gnus-sum.el (gnus-summary-refer-article):
* lisp/gnus/gnus-util.el (gnus-mode-string-quote):
* lisp/gnus/message.el (message-put-addresses-in-ecomplete)
(message-parse-mailto-url, message-mailto-1):
* lisp/gnus/mml-sec.el (mml-secure-epg-sign):
* lisp/gnus/mml-smime.el (mml-smime-epg-verify):
* lisp/gnus/mml2015.el (mml2015-epg-verify):
* lisp/gnus/nnmaildir.el (nnmaildir--system-name)
(nnmaildir-request-list, nnmaildir-retrieve-groups)
(nnmaildir-request-group, nnmaildir-retrieve-headers):
* lisp/gnus/nnrss.el (nnrss-node-text):
* lisp/gnus/spam-report.el (spam-report-gmane-internal)
(spam-report-user-mail-address):
* lisp/ibuffer.el (name):
* lisp/image-dired.el (image-dired-pngnq-thumb)
(image-dired-pngcrush-thumb, image-dired-optipng-thumb)
(image-dired-create-thumb-1):
* lisp/info.el (Info-set-mode-line):
* lisp/international/mule-cmds.el (describe-language-environment):
* lisp/mail/rfc2231.el (rfc2231-parse-string):
* lisp/mail/rfc2368.el (rfc2368-parse-mailto-url):
* lisp/mail/rmail.el (rmail-insert-inbox-text)
(rmail-simplified-subject-regexp):
* lisp/mail/rmailout.el (rmail-output-body-to-file):
* lisp/mail/undigest.el (rmail-digest-rfc1153):
* lisp/man.el (Man-default-man-entry):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc--debug):
* lisp/net/browse-url.el (browse-url-mail):
* lisp/net/eww.el (eww-update-header-line-format):
* lisp/net/newst-backend.el (newsticker-save-item):
* lisp/net/rcirc.el (rcirc-sentinel):
* lisp/net/soap-client.el (soap-decode-date-time):
* lisp/nxml/rng-cmpct.el (rng-c-literal-2-re):
* lisp/nxml/xmltok.el (let*):
* lisp/obsolete/nnir.el (nnir-run-swish-e, nnir-run-hyrex)
(nnir-run-find-grep):
* lisp/play/dunnet.el (dun-doassign):
* lisp/play/handwrite.el (handwrite):
* lisp/proced.el (proced-format-args):
* lisp/profiler.el (profiler-report-header-line-format):
* lisp/progmodes/gdb-mi.el (gdb-mi-quote):
* lisp/progmodes/make-mode.el (makefile-bsdmake-rule-action-regex)
(makefile-make-font-lock-keywords):
* lisp/progmodes/prolog.el (prolog-guess-fill-prefix):
* lisp/progmodes/ruby-mode.el (ruby-toggle-string-quotes):
* lisp/progmodes/sql.el (sql-remove-tabs-filter, sql-str-literal):
* lisp/progmodes/which-func.el (which-func-current):
* lisp/replace.el (query-replace-read-from)
(occur-engine, replace-quote):
* lisp/select.el (xselect--encode-string):
* lisp/ses.el (ses-export-tab):
* lisp/subr.el (shell-quote-argument):
* lisp/term/pc-win.el (msdos-show-help):
* lisp/term/w32-win.el (w32--set-selection):
* lisp/term/xterm.el (gui-backend-set-selection):
* lisp/textmodes/picture.el (picture-tab-search):
* lisp/thumbs.el (thumbs-call-setroot-command):
* lisp/tooltip.el (tooltip-show-help-non-mode):
* lisp/transient.el (transient-format-key):
* lisp/url/url-mailto.el (url-mailto):
* lisp/vc/log-edit.el (log-edit-changelog-ours-p):
* lisp/vc/vc-bzr.el (vc-bzr-status):
* lisp/vc/vc-hg.el (vc-hg--glob-to-pcre):
* lisp/vc/vc-svn.el (vc-svn-after-dir-status):
* lisp/xdg.el (xdg-desktop-strings):
* test/lisp/electric-tests.el (defun):
* test/lisp/term-tests.el (term-simple-lines):
* test/lisp/time-stamp-tests.el (formatz-mod-del-colons):
* test/lisp/wdired-tests.el (wdired-test-bug32173-01)
(wdired-test-unfinished-edit-01):
* test/src/json-tests.el (json-parse-with-custom-null-and-false-objects):
Use `string-replace` instead of `replace-regexp-in-string`.
2021-08-08 19:25:26 +02:00
Eli Zaretskii
1cae6b9aab Another fix for parse-colon-path
* test/lisp/files-tests.el (files-tests-bug-21454, files-colon-path):
Adapt to change in behavior of 'parse-colon-path'.

* lisp/files.el (parse-colon-path): Don't expand the directory
names: that changes the names in ways this function is not
supposed to.  (Bug#49918)
2021-08-08 17:29:56 +03:00
Lars Ingebrigtsen
9a6fc63843 Fix problem with relative directories in CDPATH
* lisp/files.el (parse-colon-path): Allow relative directories
(like ".") in CDPATH (bug#49918).
2021-08-07 12:50:56 +02:00
Konstantin Kharlamov
4ec10c80ab Reset mtime of a buffer reverted "delicately"
* lisp/files.el (revert-buffer-insert-file-contents-delicately):
Once buffer is reverted, reset its mtime to that of the file.
(Bug#49893)
2021-08-05 20:45:02 +03:00
Lars Ingebrigtsen
16876744d4 Ensure that recover-file doesn't leave stale auto-save files behind
* lisp/files.el (recover-file): Don't leave stale auto-save files
behind after crash recovery (bug#11331).
2021-07-30 14:07:04 +02:00
Lars Ingebrigtsen
989937e1bc Revert "Make revert-buffer preserve buffer-readedness"
This reverts commit fcae435f59.

This leads to problems when reverting from a file that's changed
readedness externally.
2021-07-27 17:24:14 +02:00
Lars Ingebrigtsen
f04f8126f0 Rename directory-append to file-name-concat
* src/fileio.c (Ffile_name_concat):
* lisp/files.el (move-file-to-trash):
* lisp/emacs-lisp/shortdoc.el (file-name):
* doc/lispref/files.texi (Directory Names): Rename
`directory-append' to `file-name-concat'.
2021-07-25 08:54:20 +02:00
Lars Ingebrigtsen
86a795f6dd Fix problem when moving files called ~ to the trash
* lisp/files.el (move-file-to-trash): Construct the trash file
name safely (bug#49711).  This makes (move-file-to-trash "/tmp/~")
etc work.
2021-07-24 13:34:52 +02:00
Lars Ingebrigtsen
9ac6ff53b1 Make the test for auto-mode-alist from .dir-local.el stricter
* lisp/files.el (set-auto-mode--dir-local-valid-p): New function.
(set-auto-mode--apply-alist): Use it as a stricter test.
2021-07-24 11:16:15 +02:00
Eli Zaretskii
5708322560 ; * lisp/files.el (set-auto-mode--apply-alist): Doc fix. 2021-07-23 22:43:22 +03:00
Lars Ingebrigtsen
2a231378fa Fix typo in set-auto-mode--apply-alist
* lisp/files.el (set-auto-mode--apply-alist): Fix typo in
ad5faa424a (bug#49712).
2021-07-23 20:18:21 +02:00
Tom Tromey
ad5faa424a Add auto-mode-alist functionality to .dir-locals.el
* doc/emacs/custom.texi (Directory Variables): Document
auto-mode-alist in .dir-locals.el (Bug#18721)
* doc/emacs/modes.texi (Choosing Modes): Update.
* lisp/files.el (set-auto-mode--apply-alist): New function,
from set-auto-mode.
(set-auto-mode): Check directory locals for auto-mode-alist.
(dir-locals-collect-variables): Add "predicate" parameter.
(hack-dir-local--get-variables): New function, from
hack-dir-local-variables.
(hack-dir-local-variables): Call hack-dir-local--get-variables.
* test/lisp/files-resources/.dir-locals.el: New file.
* test/lisp/files-resources/whatever.quux: New file.
* test/lisp/files-tests.el (files-tests-data-dir): New variable.
(files-test-dir-locals-auto-mode-alist): New test.
2021-07-23 15:51:11 +02:00
Lars Ingebrigtsen
fcae435f59 Make revert-buffer preserve buffer-readedness
* lisp/files.el (revert-buffer): Preserve buffer-readedness
(bug#35166).
2021-07-22 16:24:58 +02:00
Eli Zaretskii
b575e44cbf Fix documentation of a recent changeset
* lisp/autorevert.el (auto-revert-mode):
* lisp/files.el (revert-buffer): Doc fix.  (Bug#49661)
2021-07-20 18:37:40 +03:00
Konstantin Kharlamov
61c1522dde Improve auto-revert-mode and revert-buffer doc strings
* lisp/autorevert.el (auto-revert-mode):
* lisp/files.el (revert-buffer): Mention that there is
revert-buffer-with-fine-grain that is better suited for markers
preservation (bug#49661).
2021-07-20 16:38:55 +02:00
Lars Ingebrigtsen
e02576c7eb Put command line file names and mouse dragging onto 'file-name-history'
* lisp/dnd.el (dnd-open-local-file): Add file to history.
* lisp/files.el (file-name-history--add): New function (bug#12915).

* lisp/startup.el (command-line-1): Add file to history.
2021-07-20 13:48:10 +02:00
Eli Zaretskii
bbce22337c Fix documentation of a recent changeset (bug#5003)
* lisp/files.el (safe-local-variable-values)
(ignored-local-variable-values): Doc fix.
(ignored-local-variable-values): Add :version tag.

* doc/emacs/custom.texi (Safe File Variables): Mention
'ignored-local-variable-values'.
* doc/lispref/variables.texi (File Local Variables): Fix wording.

* etc/NEWS: Improve wording of the 'ignored-local-variable-values'
entry.
2021-07-18 21:53:22 +03:00
Lars Ingebrigtsen
da200ab049 Allow ignoring local variable values permanently
* doc/lispref/variables.texi (File Local Variables): Document it.

* lisp/files.el (ignored-local-variable-values): New user option
(bug#5003).
(hack-local-variables-confirm): Allow ignoring permanently.
(hack-local-variables-filter): Ignore the permanently ignored
variables.
2021-07-18 17:18:22 +02:00
Michael Albinus
4200f091b0 ; Fix last change in files.el 2021-07-16 18:54:12 +02:00
Michael Albinus
553ad9c9e8 Add lock-file-mode
* doc/emacs/files.texi (Interlocking):
* doc/lispref/files.texi (File Locks):
* etc/NEWS: Add lock-file-mode.

* lisp/files.el (lock-file-name-transforms)
(remote-file-name-inhibit-locks): Move down.
(lock-file-mode): New minor mode.
2021-07-16 18:13:28 +02:00
Eli Zaretskii
d8d9504c5a ; Fix wording of recent changes in documentation
* lisp/files.el (query-about-changed-file):
* doc/emacs/files.texi (Visiting):
* etc/NEWS: Fix the wording of a recent change.  (Bug#10755)
2021-07-16 16:26:21 +03:00
Lars Ingebrigtsen
9b601d8537 Add new user option 'query-about-changed-file'
* doc/emacs/files.texi (Visiting): Document it.
* lisp/files.el (query-about-changed-file): New user option (bug#10775).
(find-file-noselect): Use it.
2021-07-16 14:30:24 +02:00
Lars Ingebrigtsen
561ef16fd0 Fix lock-file-name-transforms build problem
* lisp/files.el (lock-file-name-transforms): Remove
custom-initialize-delay to fix build problem (bug#49507).
2021-07-16 13:59:46 +02:00
Michael Albinus
cce84822f7 Add remote-file-name-inhibit-locks
* doc/emacs/files.texi (Interlocking):
* doc/lispref/files.texi (File Locks):
* doc/misc/tramp.texi (Auto-save File Lock and Backup):
Add remote-file-name-inhibit-locks.

* etc/NEWS: New user option 'remote-file-name-inhibit-locks'.

* lisp/files.el (remote-file-name-inhibit-locks): New defcustom.

* lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist):
* lisp/net/tramp-crypt.el (tramp-crypt-file-name-handler-alist):
* lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist):
* lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist):
* lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist):
* lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist):
* lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist):
Use `tramp-handle-make-lock-file-name'.

* lisp/net/tramp.el (tramp-allow-unsafe-temporary-files): Fix docstring.
(tramp-handle-make-lock-file-name): New defun.

* test/lisp/net/tramp-tests.el (tramp-test39-lock-file): Extend test.
2021-07-13 19:50:05 +02:00
Michael Albinus
a6a92e3ac5 Code cleanup wrt file locks
* lisp/files.el (make-lock-file-name): Fix docstring.

* lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist):
* lisp/net/tramp-archive.el (tramp-archive-file-name-handler-alist):
* lisp/net/tramp-crypt.el (tramp-crypt-file-name-handler-alist):
* lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist):
* lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist):
* lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist):
* lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist):
* lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist):
Add `make-lock-file-name'.

* lisp/net/tramp.el (tramp-file-name-for-operation):
Add `make-lock-file-name'.
(tramp-handle-unlock-file): Call `userlock--handle-unlock-error'
in case of error.

* src/buffer.c (Frestore_buffer_modified_p):
* src/editfns.c (Freplace_buffer_contents):
* src/fileio.c (Finsert_file_contents, write_region): Call Funlock_file.

* src/filelock.c (unlock_file): Rename from unlock_file_body.
Remove the other declarations of unlock_file.  Move file name
handler check to ...
(Funlock_file): ... here.  Adapt argument numbers.  Call
unlock_file wrapped by internal_condition_case.
(Flock_file): Adapt argument numbers.
(unlock_all_files, Funlock_buffer, unlock_buffer): Call Funlock_file.

* src/lisp.h (unlock_file): Remove.
2021-07-08 21:13:40 +02:00