From 992908b09a4f95817bbd548fd577d7573ad9cd2d Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Mon, 7 Feb 2022 19:32:38 +0100 Subject: [PATCH] Make connection-local variables user options * 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/variables.texi | 8 ++++---- etc/NEWS | 36 ++++++++++++++++++++++-------------- lisp/files-x.el | 29 ++++++++++++++++++++++++----- 3 files changed, 50 insertions(+), 23 deletions(-) diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index 34c73e70b72..b9de92a29eb 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi @@ -2263,11 +2263,11 @@ list in @var{variables} is an alist of the form @end example @end defun -@defvar connection-local-profile-alist +@deffn {User Option} connection-local-profile-alist This alist holds the connection profile symbols and the associated variable settings. It is updated by @code{connection-local-set-profile-variables}. -@end defvar +@end deffn @defun connection-local-set-profiles criteria &rest profiles This function assigns @var{profiles}, which are symbols, to all remote @@ -2321,11 +2321,11 @@ Therefore, the example above would be equivalent to defined by @code{connection-local-set-profile-variables}. @end defun -@defvar connection-local-criteria-alist +@deffn {User Option} connection-local-criteria-alist This alist contains connection criteria and their assigned profile names. The function @code{connection-local-set-profiles} updates this list. -@end defvar +@end deffn @defun hack-connection-local-variables criteria This function collects applicable connection-local variables diff --git a/etc/NEWS b/etc/NEWS index cd5bd8b71cf..a8a270d57d9 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -80,7 +80,7 @@ as was already the case for all the non-preloaded files. * Startup Changes in Emacs 29.1 +++ -** Emacs now support setting 'user-emacs-directory' via --init-directory. +** Emacs now supports setting 'user-emacs-directory' via '--init-directory'. +++ ** Emacs now has a '--fingerprint' option. @@ -130,14 +130,15 @@ delete the entire sequence, not just a single character at its beginning. ** 'load-history' does not treat autoloads specially any more. -An autoload definition appears just as a (defun . NAME) and the -(t . NAME) entries are not generated any more. +An autoload definition appears just as a '(defun . NAME)' and the +'(t . NAME)' entries are not generated any more. + * Changes in Emacs 29.1 --- ** New user option 'find-library-include-other-files'. -If set to nil, commands like 'M-x find-library' will only include library +If set to nil, commands like 'find-library' will only include library files in the completion candidates. The default is t, which preserves previous behavior, whereby non-library files could also be included. @@ -188,7 +189,7 @@ methods. This leads to less flicker and empty areas of a frame being displayed when a frame is being resized. Unfortunately, it does not work on some ancient buggy window managers, so if Emacs appears to freeze, but -is still responive to input, you can turn it off by setting the X +is still responsive to input, you can turn it off by setting the X resource "synchronizeResize" to "off". +++ @@ -210,6 +211,12 @@ defaults to t, which makes Emacs use the toolkit tooltips. The existing GTK-specific option 'x-gtk-use-system-tooltips' is now an alias of this new option. ++++ +** Some connection-local variables are now user options. +The variables 'connection-local-profile-alist' and +'connection-local-criteria-alist' are now user options, in order to +make it more convenient to inspect and modify them. + --- ** New minor mode 'pixel-scroll-precision-mode'. When enabled, and if your mouse supports it, you can scroll the @@ -300,7 +307,7 @@ These will take you (respectively) to the next and previous "page". *** 'describe-char' now also outputs the name of emoji combinations. +++ -*** New key binding in *Help* buffers: 'I'. +*** New key binding in "*Help*" buffer: 'I'. This will take you to the Emacs Lisp manual entry for the item displayed, if any. @@ -478,7 +485,7 @@ the "*Completions*" buffer. *** New user option 'completions-sort'. This option controls the sorting of the completion candidates in -the *Completions* buffer. Available styles are no sorting, +the "*Completions*" buffer. Available styles are no sorting, alphabetical (the default), or a custom sort function. ** Isearch and Replace @@ -820,9 +827,9 @@ option to nil to disable this confirmation completely. --- *** Make 'image-dired-rotate-thumbnail-(left|right)' obsolete. -Instead, use 'M-x image-dired-refresh-thumb' to generate a new -thumbnail, or 'M-x image-rotate' to rotate the thumbnail without -updating the thumbnail file. +Instead, use commands 'image-dired-refresh-thumb' to generate a new +thumbnail, or 'image-rotate' to rotate the thumbnail without updating +the thumbnail file. ** Dired @@ -922,8 +929,9 @@ the Galeon web browser was released in September, 2008. Prefixing '|', '<' or '>' with an asterisk, i.e. '*|', '*<' or '*>', will cause the whole command to be passed to the operating system shell. This is particularly useful to bypass Eshell's own pipelining -support for pipelines which will move a lot of data. See "Running -Shell Pipelines Natively" in the Eshell manual. +support for pipelines which will move a lot of data. See section +"Running Shell Pipelines Natively" in the Eshell manual, node +"(eshell) Input/Output". ** Miscellaneous @@ -1098,7 +1106,7 @@ is, the alias chain is returned. +++ ** New facility for handling session state: 'multisession-value'. This can be used as a convenient way to store (simple) application -state, and 'M-x list-multisession-values' allows users to list +state, and the command 'list-multisession-values' allows users to list (and edit) this data. +++ @@ -1267,7 +1275,7 @@ inhibits 'isearch' matching the STRING parameter. It can be used to implement own regexp syntax for search/replace. --- -** New variables to customize defaults of FROM for query-replace commands. +** New variables to customize defaults of FROM for 'query-replace*' commands. The new variable 'query-replace-read-from-default' can be set to a function that returns the default value of FROM when 'query-replace' prompts for a string to be replaced. An example of such a function is diff --git a/lisp/files-x.el b/lisp/files-x.el index e86ba8f8d04..773339d748a 100644 --- a/lisp/files-x.el +++ b/lisp/files-x.el @@ -579,15 +579,22 @@ changed by the user.") (setq ignored-local-variables (cons 'connection-local-variables-alist ignored-local-variables)) -(defvar connection-local-profile-alist nil +(defcustom connection-local-profile-alist nil "Alist mapping connection profiles to variable lists. Each element in this list has the form (PROFILE VARIABLES). PROFILE is the name of a connection profile (a symbol). VARIABLES is a list that declares connection-local variables for PROFILE. An element in VARIABLES is an alist whose elements are -of the form (VAR . VALUE).") - -(defvar connection-local-criteria-alist nil +of the form (VAR . VALUE)." + :type '(repeat (cons (symbol :tag "Profile") + (repeat :tag "Variables" + (cons (symbol :tag "Variable") + (sexp :tag "Value"))))) + :group 'files + :group 'tramp + :version "29.1") + +(defcustom connection-local-criteria-alist nil "Alist mapping connection criteria to connection profiles. Each element in this list has the form (CRITERIA PROFILES). CRITERIA is a plist identifying a connection and the application @@ -596,7 +603,19 @@ using this connection. Property names might be `:application', `:application' is a symbol, all other property values are strings. All properties are optional; if CRITERIA is nil, it always applies. -PROFILES is a list of connection profiles (symbols).") +PROFILES is a list of connection profiles (symbols)." + :type '(repeat (cons (plist :tag "Criteria" + ;; Give the most common options as checkboxes. + :options (((const :format "%v " :application) + symbol) + ((const :format "%v " :protocol) string) + ((const :format "%v " :user) string) + ((const :format "%v " :machine) string))) + (repeat :tag "Profiles" + (symbol :tag "Profile")))) + :group 'files + :group 'tramp + :version "29.1") (defsubst connection-local-normalize-criteria (criteria) "Normalize plist CRITERIA according to properties. -- 2.39.5