* lisp/files-x.el (modify-dir-local-variable): Take a 5th optional
argument, the filename of the dir locals file to modify.
(read-dir-locals-file): New function.
(add-dir-local-variable, delete-dir-local-variable)
(copy-file-locals-to-dir-locals): Optionally read the filename to
modify, and pass it to modify-dir-local-variable.
* etc/NEWS: Announce the change.
* doc/emacs/custom.texi (Directory Variables): Document the new
functionality.
* lisp/files-x.el (modify-file-local-variable-message): Suggest to
revert from the buffer's file only if that file exists; otherwise
suggest 'normal-mode'. (Bug#64844)
* lisp/files-x.el (connection-local-set-profiles)
(connection-local-set-profile-variables): Avoid saving the changed
user option to file unless triggered explicitly by user. (Bug#63300)
* lisp/files-x.el (connection-local-set-profiles)
(connection-local-set-profile-variables):
Use `custom-set-variables'. It serves the purpose to not keep
unsaved user options, and it is less invasive than
`customize-save-variable'.
* lisp/files-x.el (connection-local-set-profiles)
(connection-local-set-profile-variables):
Use `customize-save-variable' instead of `customize-set-variable'.
(Bug#62106)
* doc/lispref/lists.texi (Plist Access): Improve description of
default predicate.
* lisp/emacs-lisp/cl-extra.el (cl-getf, cl--set-getf): Assume
plist-member always returns a cons.
* lisp/emacs-lisp/gv.el (plist-get): Support new optional predicate
argument (bug#47425#91).
* lisp/emacs-lisp/map.el: Bump minor version.
(map--dispatch): Remove now that bug#58563 is fixed. Break two
remaining uses out into corresponding cl-defmethods.
(map--plist-p): Add docstring.
(map--plist-has-predicate, map--plist-member-1, map--plist-member)
(map--plist-put-1, map--plist-put): New definitions for supporting
predicate argument backward compatibly.
(map-elt): Fix generalized variable getter under a
predicate (bug#58531). Use predicate when given a plist.
(map-put): Avoid gratuitous warnings when called without the hidden
predicate argument. Improve obsoletion message.
(map-put!): Use predicate when given a plist.
(map-contains-key): Ditto. Declare forgotten
advertised-calling-convention (bug#58531#19).
(map--put): Group definition in file together with that of map-put!.
* lisp/files-x.el (connection-local-normalize-criteria): Simplify
using mapcan + plist-get.
* lisp/net/eudc.el (eudc--plist-member): New convenience function.
(eudc-plist-member, eudc-plist-get, eudc-lax-plist-get): Use it
instead of open-coding plist-member.
* src/fns.c (Fplist_get, plist_get, Fplist_put, plist_put): Pass the
plist element as the first argument to the predicate, for
consistency with assoc + alist-get.
(Fplist_member, plist_member): Move from widget to plist section.
Open-code the EQ case in plist_member, and call it from
Fplist_member in that case, rather than the other way around.
* test/lisp/apropos-tests.el (apropos-tests-format-plist): Avoid
polluting obarray.
* test/lisp/emacs-lisp/cl-extra-tests.el (cl-getf): Extend test with
generalized variables, degenerate plists, and improper lists.
* test/lisp/emacs-lisp/gv-tests.el: Byte-compile file; in the
meantime bug#24402 seems to have been fixed or worked around.
(gv-setter-edebug): Inhibit printing messages.
(gv-plist-get): Avoid modifying constant literals. Also test with a
predicate argument.
* test/lisp/emacs-lisp/map-tests.el (with-maps-do): Simplify
docstring.
(test-map-elt-testfn): Rename...
(test-map-elt-testfn-alist): ...to this. Also test with a predicate
argument.
(test-map-elt-testfn-plist, test-map-elt-gv, test-map-elt-signature)
(test-map-put!-plist, test-map-put!-signature)
(test-map-contains-key-signature, test-map-plist-member)
(test-map-plist-put): New tests.
(test-map-contains-key-testfn): Also test with a predicate argument.
(test-map-setf-alist-overwrite-key, test-map-setf-plist-insert-key)
(test-map-setf-plist-overwrite-key): Avoid modifying constant
literals.
(test-hash-table-setf-insert-key)
(test-hash-table-setf-overwrite-key): Fix indentation.
(test-setf-map-with-function): Make test more precise.
* test/lisp/net/eudc-tests.el: New file.
* test/lisp/subr-tests.el (test-plistp): Extend test with circular
list.
* test/src/fns-tests.el (test-cycle-equal, test-cycle-nconc): Move
from plist section to circular list section.
(plist-put/odd-number-of-elements): Avoid modifying constant
literals.
(plist-member/improper-list): Simplify.
(test-plist): Move to plist section. Also test with a predicate
argument.
* lisp/files-x.el (connection-local-criteria)
(connection-local-profile-name-for-setq): New variables.
(with-connection-local-variables-1): ... let-bind them here.
(connection-local-update-profile-variables)
(connection-local-profile-name-for-criteria): New functions.
(with-connection-local-application-variables, setq-connection-local):
New macros.
* test/lisp/files-x-tests.el: Require 'tramp-integration'
(files-x-test--variable5, remote-lazy-var): New variables.
(files-x-test-hack-connection-local-variables-apply): Expand checks.
(files-x-test-with-connection-local-variables): Remove
'hack-connection-local-variables-apply' check (it belongs in the above
test), and expand some other checks.
(files-x-test--get-lazy-var, files-x-test--set-lazy-var): New
functions.
(files-x-test-connection-local-update-profile-variables)
(files-x-test-setq-connection-local): New tests.
* doc/lispref/variables.texi (Connection Local Variables): Split into
two subsections and document the new features.
* etc/NEWS: Announce 'setq-connection-local'.
* lisp/files-x.el (modify-dir-local-variable): Add a 'no-byte-compile'
file local variable when generating a .dir-locals.el
file.
* .dir-locals.el: Add 'no-byte-compile'. (Bug#58486)
* lisp/files-x.el (modify-dir-local-variable): Insert a newline
only after creating a new file.
(dir-locals-to-string): Remove newline to not add more newlines
on every save.
* lisp/files-x.el (dir-locals-to-string): Add newline at the end of
newly created .dir-locals.el files. This avoids git complaining about
"No newline at end of file".
Move the bulk of the code of `with-connection-local-variables` into
a separate function, which both avoids duplicating that code but also
avoids duplicating the code passed as the body of
a `with-connection-local-variables`. Also makes it easier to
debug the code, or change the implementation of
`with-connection-local-variables` without having to recompile all
the users.
* lisp/files-x.el (with-connection-local-variables-1): New function,
extracted from `with-connection-local-variables`.
(with-connection-local-variables): Use it.
* lisp/files-x.el (connection-local-profile-alist)
(connection-local-criteria-alist): Make them user options.
* doc/lispref/variables.texi (Connection Local Variables):
* etc/NEWS: Document this.
* doc/lispref/os.texi (System Environment): Add `path-separator'
function and `null-device' variable and function.
* etc/NEWS: Mention 'null-device' and 'path-separator'. Fix typos.
* lisp/files-x.el (path-separator, null-device): New defuns. (Bug#3736)
* lisp/net/tramp-adb.el
(tramp-adb-connection-local-default-shell-variables): Rename from
`tramp-adb-connection-local-default-profile'.
* lisp/net/tramp-integration.el
(tramp-connection-local-default-system-variables): New defvar.
Add it to connection-local profiles.
(tramp-connection-local-default-shell-variables): Rename from
`tramp-connection-local-default-profile'.
* lisp/progmodes/grep.el (grep-hello-file): New defun.
(grep-compute-defaults): Use `null-device' function for remote
case. Handle remote `hello-file'. Use `process-file-shell-command'.
(grep,grep-expand-keywords, lgrep): Use `null-device' function for
remote case.
Restore lines saying "Maintainer: emacs-devel@gnu.org" when there is
no special maintainer for a file. Although this wasn't documented
it was common practice and removing the lines didn't have consensus.
* lisp/files-x.el (cl-lib): Require when compiling.
(hack-connection-local-variables): Regard connection-local
variables as safe. (Bug#34943)
* lisp/shell.el (shell): Use `with-connection-local-variables' for
the whole code block. (Bug#34943)
* lisp/net/tramp-adb.el (tramp-connection-local-safe-shell-file-names):
Do not set values.
* lisp/net/tramp-integration.el
(tramp-connection-local-safe-shell-file-names): Remove.
(shell-file-name, shell-command-switch): Do not add safe-local-variable
property.
* lisp/net/tramp.el (tramp-handle-shell-command): Use proper
buffer name.
* test/lisp/net/tramp-tests.el (tramp-test34-explicit-shell-file-name):
Tag it :unstable.
* doc/emacs/custom.texi (Connection Variables): New node.
* doc/emacs/emacs.texi (Top): Add entry for Connection Variables.
* doc/emacs/misc.texi (Single Shell): Mention default value for
remote buffers.
* doc/lispref/variables.texi (Connection Local Variables):
Describe `with-connection-local-variables' instead of
`with-connection-local-profiles'.
* doc/misc/tramp.texi (Remote processes): Refer to Emacs manual.
Mention default connection-local settings for `shell-file-name'
and `shell-command-switch'.
* etc/NEWS: Mention connection-local variables changes.
* lisp/files-x.el (hack-connection-local-variables):
Push connection-local variables to `file-local-variables-alist'.
(connection-local-criteria-for-default-directory): New defsubst.
(with-connection-local-variables): Rename from
`with-connection-local-profiles'. Adapt implementation.
* lisp/files.el (hack-local-variables):
Call `hack-connection-local-variables'.
* lisp/shell.el (shell): Use `with-connection-local-variables'.
* lisp/subr.el (start-file-process-shell-command):
* lisp/progmodes/compile.el (compilation-start):
Use `with-connection-local-variables'. Do not set "/bin/sh" for
remote buffers, trust settings of `shell-file-name'. (Bug#24338),
(Bug#29723)
* lisp/net/ange-ftp.el (ange-ftp-compress, ange-ftp-uncompress):
Use `shell-command-switch'.
* lisp/net/tramp-adb.el (tramp-adb-connection-local-default-profile):
New defvar. Add it to connection-local profiles after loading "shell".
* lisp/net/tramp-integration.el (tramp-compat): Require tramp-compat.
(tramp-compat-exec-path): Do not declare anymore.
(tramp-connection-local-safe-shell-file-names): New defvar.
(tramp-connection-local-default-profile): New defconst. Activate
it after loading "shell".
(shell-file-name, shell-command-switch): Add safe-local-variable
property.
* lisp/net/tramp-sh.el (tramp-display-escape-sequence-regexp):
Add tramp-autoload cookie.
* test/lisp/files-x-tests.el (remote-shell-file-name):
Add safe-local-variable property to remote-* variables.
(tramp-connection-local-default-profile): Declare.
(files-x-test-with-connection-local-variables):
Rename from `files-x-test-with-connection-local-profiles'. Adapt
implementation.
* test/lisp/net/tramp-tests.el
(tramp-test34-connection-local-variables): New test.
(tramp-test34-explicit-shell-file-name): Run it also for tramp-adb.
Bind connection-local-{profile,criteria}-alist. Use tramp-adb
specific `shell-file-name'. Add safe-local-variable property to
`explicit-shell-file-name' and `explicit-sh-args'.
instead of assq-delete-all for cases when mode is a subdirectory name.
(dir-locals-to-string): Call pp-to-string and string-trim-right
on values. (Bug#32817)
* lisp/files-x.el (modify-file-local-variable-prop-line): Handle
whitespace when checking if there's already a ';' before the
variable (Bug#23294).
Copyright-paperwork-exempt: yes
* lisp/files-x.el (connection-local-normalize-criteria): Do not
use PROPERTIES anymore.
(connection-local-get-profiles): Rewrite, in order to accept any
property as optional. (Bug#32090)
(connection-local-set-profiles):
Adapt ´connection-local-normalize-criteria' call.
* test/lisp/files-x-tests.el
(files-x-test-connection-local-set-profiles)
(files-x-test-hack-connection-local-variables-apply): Extend tests.