From: Michael Albinus <michael.albinus@gmx.de>
To: emacs-devel@gnu.org
Subject: server-local variables
Date: Sun, 30 Oct 2016 19:39:38 +0100 [thread overview]
Message-ID: <87r36x7kb9.fsf@gmx.de> (raw)
Hi,
a long standing wishlist for Tramp are server-local (sometimes called
connection-local) variables. It was expressed for the first time in
<https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3736#35>, but there are
more discussions about in bug reports and discussions on emacs-devel and
tramp-devel.
I'm playing with a small patch for files.el, which provides a mechanism
similar to directory-local variables. Most important are the following
functions:
--8<---------------cut here---------------start------------->8---
server-locals-set-class is a compiled Lisp function in
‘../../../src/emacs/lisp/files.el’.
(server-locals-set-class REGEXP CLASS)
Add CLASS for remote servers.
REGEXP is a regular expression identifying remote servers, a string.
CLASS is the name of a project class, a symbol.
When a connection to a remote server is opened, the
server-specific variables from CLASS are applied to the
corresponding process buffer. The variables for a class are
defined using ‘server-locals-set-class-variables’.
--8<---------------cut here---------------end--------------->8---
--8<---------------cut here---------------start------------->8---
server-locals-set-class-variables is a compiled Lisp function in
‘../../../src/emacs/lisp/files.el’.
(server-locals-set-class-variables CLASS VARIABLES)
Map the symbol CLASS to a list of variable settings.
VARIABLES is a list that declares server-local variables for the
class. An element in VARIABLES is an alist whose elements are of
the form (VARIABLE . VALUE).
When a connection to a remote server is opened, the server’s
classes are found. A server may be assigned a class using
‘server-locals-set-directory-class’. Then variables are set in
the server’s process buffer according to the VARIABLES list of
the class. The list is processed in order.
--8<---------------cut here---------------end--------------->8---
--8<---------------cut here---------------start------------->8---
hack-server-local-variables-apply is a compiled Lisp function in
‘../../../src/emacs/lisp/files.el’.
(hack-server-local-variables-apply)
Apply server-local variables for the server identified by ‘default-directory’.
Other local variables, like file-local and dir-local variables,
will not be touched.
--8<---------------cut here---------------end--------------->8---
With these functions, one could write the following code snippet,
pushing a server-local variable `some-useful-setting' for all remote
connections using the "sudo" method:
--8<---------------cut here---------------start------------->8---
(server-locals-set-class-variables
'remote '((some-useful-setting . some-useful-value)))
(server-locals-set-class "^/sudo:" 'remote)
;; This must be applied in a buffer with remote `default-directory'.
(hack-server-local-variables-apply)
--8<---------------cut here---------------end--------------->8---
Comments?
Best regards, Michael.
next reply other threads:[~2016-10-30 18:39 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-30 18:39 Michael Albinus [this message]
2016-10-30 20:08 ` server-local variables Eli Zaretskii
2016-10-30 20:28 ` Michael Albinus
2016-10-31 3:30 ` Eli Zaretskii
2016-10-31 9:54 ` Michael Albinus
2016-10-31 11:17 ` Phil Sainty
2016-10-31 12:45 ` Óscar Fuentes
2016-10-31 15:42 ` Michael Albinus
2016-10-31 20:15 ` Phil Sainty
2016-10-31 13:43 ` Stefan Monnier
2016-10-31 16:30 ` Michael Albinus
2016-10-31 12:39 ` Ted Zlatanov
2016-10-31 13:36 ` Stefan Monnier
2016-10-31 21:03 ` Drew Adams
2016-11-01 2:08 ` Stefan Monnier
2016-11-01 5:08 ` Drew Adams
2016-10-31 16:26 ` Michael Albinus
2016-10-31 17:31 ` Ted Zlatanov
2016-10-31 20:47 ` Michael Albinus
2016-11-01 13:22 ` Ted Zlatanov
2016-11-14 14:02 ` Michael Albinus
2016-11-15 15:02 ` GnuTLS per-connection variables (was: server-local variables) Ted Zlatanov
2016-11-24 12:50 ` GnuTLS per-connection variables Michael Albinus
2016-11-29 16:07 ` Ted Zlatanov
2016-11-28 18:54 ` Michael Albinus
2016-12-05 15:09 ` Michael Albinus
2016-12-05 16:27 ` Ted Zlatanov
2016-12-05 16:49 ` Michael Albinus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r36x7kb9.fsf@gmx.de \
--to=michael.albinus@gmx.de \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.