From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.bugs Subject: bug#32090: 26.1; connection-local-variables do not match as described Date: Sun, 08 Jul 2018 11:46:55 +0200 Message-ID: <87tvpaawkw.fsf@gmx.de> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1531043165 7669 195.159.176.226 (8 Jul 2018 09:46:05 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 8 Jul 2018 09:46:05 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 32090@debbugs.gnu.org To: Christopher Cooper Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jul 08 11:46:00 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fc6GW-0001rg-3s for geb-bug-gnu-emacs@m.gmane.org; Sun, 08 Jul 2018 11:46:00 +0200 Original-Received: from localhost ([::1]:36430 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fc6Id-0005BV-4O for geb-bug-gnu-emacs@m.gmane.org; Sun, 08 Jul 2018 05:48:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55252) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fc6IX-0005BM-32 for bug-gnu-emacs@gnu.org; Sun, 08 Jul 2018 05:48:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fc6IT-0005us-Uu for bug-gnu-emacs@gnu.org; Sun, 08 Jul 2018 05:48:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:42758) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fc6IT-0005ug-RC for bug-gnu-emacs@gnu.org; Sun, 08 Jul 2018 05:48:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fc6IT-0007dA-Gn for bug-gnu-emacs@gnu.org; Sun, 08 Jul 2018 05:48:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 Jul 2018 09:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32090 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 32090-submit@debbugs.gnu.org id=B32090.153104322529263 (code B ref 32090); Sun, 08 Jul 2018 09:48:01 +0000 Original-Received: (at 32090) by debbugs.gnu.org; 8 Jul 2018 09:47:05 +0000 Original-Received: from localhost ([127.0.0.1]:50655 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fc6HY-0007bu-L1 for submit@debbugs.gnu.org; Sun, 08 Jul 2018 05:47:04 -0400 Original-Received: from mout.gmx.net ([212.227.15.15]:43051) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fc6HX-0007bP-3E for 32090@debbugs.gnu.org; Sun, 08 Jul 2018 05:47:03 -0400 Original-Received: from detlef.gmx.de ([212.91.242.147]) by mail.gmx.com (mrgmx002 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MOx4J-1fhr2V0FOB-006NiD; Sun, 08 Jul 2018 11:46:56 +0200 In-Reply-To: (Christopher Cooper's message of "Sun, 8 Jul 2018 00:10:48 -0400") X-Provags-ID: V03:K1:4T8flejKe4qAHtPZ91XyKLL55pGaE2BcwXmxe0EETD6IkhJgLLb FCUvr5PbSWwetkIBEFL/Q4DT4VnFHx9oJbw/QjVCkV3d2ZyabDChQuo2ggylEONCq/wJq/P 71ThuVJgcuCcfdkcQkFF1QvHM9qpW8TaaTKU0mzeARBdRDUey36tGB3E5rp9Hs/vZh1HdbA N8ibAMva+lGPtb6j6wcZw== X-UI-Out-Filterresults: notjunk:1;V01:K0:YtSFir+OsCg=:GQ5+q/x5MzaCJOyokTVOFd m/tlt65lQSoHLzhla38MG3LaijC9ynMOw7AVU14xUr26kcctWC1BdAqIhFBRbCyVRTj6+psDv xj1gWbrFw/zmpPo1Bun0I+zsHEH/3szikhEh5GIXS8BEwKmHSJmhaUpq9fAvgNArOvnd4uhzZ OjxtxbraqSwmsvvG0qr8sysRCzSfg0M5cRP+yUUc6K1UX8//FIRNz1yrXKK/4mXQ6w13ko6AZ wzTTKsQo9ahoM7Jfp5lwTxy5OePer7n8sGJUgOrLAs7VbTtrIkZedh5GKlCLfdxYHu8EFO7/j skU6u+VOioVuvTcEUR2JhfKCKzzElZNbvIWze5E7focjv89fOabYsILnQ0Z7lk6zWy3GH7xtm q6Z5RKU5xTB6oEeCksTDQxZcULvORNV4NCxJ5KmQFJDo9yThyuVqoEUK+3FZ5qJGhB/4NcOxx YGKTUF+/Xdd2mUz1CKH4HCNMtv7lEmKBMYdRZNHg27pYcaUN0smam7UnufmvaImnnCq5sl87a POQxm6jQ9nm1JGtn7XTq3fTvrzs25uI+1I+FjL4uAbHl9RaewJ/3aynUSAu2WuI7il2Dk6GMX bPjvWLyoas5912dCrLDW3KYehCGh4YSSr5ARi6zqTbmZyv/Maul5Nt2DjWb1b9p34O9Ob95Nw 7H60dbKHY2uWo7fpMSgAcFqEOHS0Qt0Vf6oQhssIJW7dTwX8YlLeZx2foHMKdAgxHMlsUt2b5 ZMgPmpZ3X6xYf9CCB9XQkeYDPmHsmOTAtBX13fwMScbjhjGHexfISOlWPF/GjBEU6h8lNECO X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:148331 Archived-At: Christopher Cooper writes: Hi Christopher, > According to the docstring for 'connection-local-criteria-alist', > "CRITERIA is a plist identifying a connection and the application > using this connection. ... All properties are optional; if > CRITERIA is nil, it always applies." > > This does not appear to be true. In fact, this is plainly evident by > simple visual inspection of 'connection-local-get-profiles'. Only > :application seems to be optional. > > Reproduction is quite simple. Run emacs -Q and eval the following elisp: > > (defvar test--var nil) > (setf enable-connection-local-variables t) > (connection-local-set-profile-variables 'test-profile '((test--var . t))) > (connection-local-set-profiles nil 'test-profile) > > Now open any TRAMP connection. Switch to the TRAMP buffer (where > connection-local-variables should have taken effect) and do > M-: test--var. The result is nil. > > If you conduct the same test, but specify the :protocol, :user, and > :machine as part of the criteria in the 'connection-local-set-profiles' > call, test--var will evaluate to t, which is correct. > > At best this is a case of misleading documentation, and at worst it is a > feature that never got implemented. Connection-local variables would be > very useful to me if they worked as described. I am glad to provide more > info or help in any capacity. It is not misleading documentation. It is the Tramp implementation, how connection-local variables are set. In tramp-set-connection-local-variables, you'll see --8<---------------cut here---------------start------------->8--- (tramp-compat-funcall 'hack-connection-local-variables-apply `(:application tramp :protocol ,(tramp-file-name-method vec) :user ,(tramp-file-name-user-domain vec) :machine ,(tramp-file-name-host-port vec))))) --8<---------------cut here---------------end--------------->8--- That means, the Tramp implementation requires :application to be 'tramp or nil, *and* it requires setting of :protocol, :user and :machine in your criteria, which match the respective remote file name. Connection-lcal variables in general work as expected. Eval in the *scratch* buffer: --8<---------------cut here---------------start------------->8--- (defvar test--var nil) (setf enable-connection-local-variables t) (connection-local-set-profile-variables 'test-profile '((test--var . t))) (connection-local-set-profiles nil 'test-profile) ;; Check initial value. (describe-variable 'test--var) ;; Set connection local variables for a random criteria. (hack-connection-local-variables-apply '(:application foo)) ;; Check the value, again. (describe-variable 'test--var) --8<---------------cut here---------------end--------------->8--- In fact, properties in criteria are optional only in case the application allows this in its `hack-connection-local-variables-apply' call, except for :application. This must either match, or be nil. The Tramp manual gives you an example how to use connection-local variables fo Tramp itself, see (info "(tramp) Remote processes") . I agree, it should be more verbose to explain, how a criteria for Tramp must look like. Will add it. Best regards, Michael.