From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Christopher Cooper Newsgroups: gmane.emacs.bugs Subject: bug#32090: 26.1; connection-local-variables do not match as described Date: Sun, 8 Jul 2018 09:09:59 -0400 Message-ID: References: <87tvpaawkw.fsf@gmx.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1531055355 25331 195.159.176.226 (8 Jul 2018 13:09:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 8 Jul 2018 13:09:15 +0000 (UTC) To: 32090@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jul 08 15:09:11 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 1fc9R8-0006TE-CD for geb-bug-gnu-emacs@m.gmane.org; Sun, 08 Jul 2018 15:09:10 +0200 Original-Received: from localhost ([::1]:37019 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fc9TF-0000cX-CR for geb-bug-gnu-emacs@m.gmane.org; Sun, 08 Jul 2018 09:11:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54282) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fc9T4-0000cE-0D for bug-gnu-emacs@gnu.org; Sun, 08 Jul 2018 09:11:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fc9Sz-0005Sv-5A for bug-gnu-emacs@gnu.org; Sun, 08 Jul 2018 09:11:09 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:42828) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fc9Sz-0005Sn-0k for bug-gnu-emacs@gnu.org; Sun, 08 Jul 2018 09:11:05 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fc9Sw-0005yf-Fc for bug-gnu-emacs@gnu.org; Sun, 08 Jul 2018 09:11:04 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Christopher Cooper Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 Jul 2018 13:11:02 +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.153105540822914 (code B ref 32090); Sun, 08 Jul 2018 13:11:02 +0000 Original-Received: (at 32090) by debbugs.gnu.org; 8 Jul 2018 13:10:08 +0000 Original-Received: from localhost ([127.0.0.1]:50725 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fc9S4-0005xW-I7 for submit@debbugs.gnu.org; Sun, 08 Jul 2018 09:10:08 -0400 Original-Received: from mail-ua0-f194.google.com ([209.85.217.194]:36856) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fc9S1-0005wx-L5 for 32090@debbugs.gnu.org; Sun, 08 Jul 2018 09:10:07 -0400 Original-Received: by mail-ua0-f194.google.com with SMTP id y8-v6so10175319uan.3 for <32090@debbugs.gnu.org>; Sun, 08 Jul 2018 06:10:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-transfer-encoding; bh=xmR6JrZ3YbLltsi0zpAgnUJ/t4uBFDnkK3xI7DYmly8=; b=SAMknsIWYWq3DnIv9yMOmm90OuYWkBT4DpwEFdJDc9n6r5z2BbjVn87R4MPQqWdmUB c6hmSrMgszc75v76qQjaTRQd7lQSgL81QLqq0r7LjyfNitvjGTIxx5PX8yK+TalYCTYt Of6PhnUkmdVbfKGNNifzveq+f+vQTNohAJ6i5bKWULsJGtuU2C1vRz72oIv2DrVf9Y68 a4wIduEkJz8sIkVty2TvBvxV1O4j5sdH2H7tFuFzhj6kYCMa0m8peYZMospQrA+TPo7Y BLiz4nsmBTA0Rhrv+z6iHEgbWCkPIYJdPbfRKULTfX0fxwnCri4YEtxi0MDVwh6XslMX WSuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-transfer-encoding; bh=xmR6JrZ3YbLltsi0zpAgnUJ/t4uBFDnkK3xI7DYmly8=; b=IbcB2nh0UI8dA8vinu/furustoMkShsX8r2brCEVSTLRRw9Ko04isS14x8fG1D2fBB aoTsEySBqitmM8UfeXIZtOyAi9MFLdb/R0Kt6hP2c7f5I8hO7OnUwIIHAUlAWFIJoRZm 5N+1bz8arRqB0eoVMffckZisjqZjkgkMntEr2zt+/vydQLZPo7gwUNc/dEhefNvbYKLF 7NemmyqbtaADgVx6gVh9Yt4VWiPzi93xqhFrBrB94QeKP7jigB6g4ZfgNknmLTiNTd/J 7DLbQ+3/VU9GQUHov79hfPZ7nHmcKo3zCLELqbkqEtLeHQK8neWQoMI7EyqFdtFGd6lK pc2w== X-Gm-Message-State: APt69E1inzYLspM+OgI2w+QlCPcP0rW+/t+3BhA3SVD9L6e9NYssFSDl NfskTNbROxqbF0kgNGSKfFsnuMK0dPutkjq1GRNuQmCI X-Google-Smtp-Source: AAOMgpeS0l8thqs6dKfNf5CcP2jY891LqoKeHQ68geDENk79DmnITm68FIFYGAUChBVwhEHGyEg93kTFY8EUFz2cGuw= X-Received: by 2002:a9f:3c17:: with SMTP id u23-v6mr10579931uah.179.1531055399839; Sun, 08 Jul 2018 06:09:59 -0700 (PDT) Original-Received: by 2002:a67:3a4a:0:0:0:0:0 with HTTP; Sun, 8 Jul 2018 06:09:59 -0700 (PDT) In-Reply-To: <87tvpaawkw.fsf@gmx.de> 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:148339 Archived-At: Thank you for the speedy response! On Sun, Jul 8, 2018 at 5:46 AM, Michael Albinus wr= ote: > 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. This makes sense, except that I'm still confused on why :application can be nil but :protocol, :user, and :machine cannot be. > 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--- This works, but only because the criteria passed to 'hack-connection-local-variables-apply' does not supply a :machine, :user, or :host. > 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. I think I am beginning to understand... it is essentially up to the application to make the other properties optional. Obviously it wouldn't make sense for the application to make :application optional, so that is the only one that is optional everywhere. > 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. The Tramp info page seems pretty fine to me. The real issue is in two place= s: (info "(elisp) Connection Local Variables"): > -- Function: connection-local-set-profiles criteria &rest profiles > ... > All properties are optional; if > CRITERIA is =E2=80=98nil=E2=80=99, it always applies. But as determined above, if CRITERIA is 'nil', it does not always apply. It is up to the application to provide this feature, and Tramp does not. In fact, there is even an example showing this feature, which appears be plain wrong: > If CRITERIA is =E2=80=98nil=E2=80=99, it applies for all remote conne= ctions. > Therefore, the example above would be equivalent to > > (connection-local-set-profiles > '(:application 'tramp :protocol "ssh" :machine "localhost") > 'remote-bash) > > (connection-local-set-profiles > '(:application 'tramp :protocol "sudo" > :user "root" :machine "localhost") > 'remote-ksh) > > (connection-local-set-profiles > nil 'remote-null-device) At least with current Tramp, the 'remote-null-device profile will never apply, since it does not provide the properties needed by Tramp. This also means that this example is not equivalent to the above example as stated. The other place of confusion was the docstring for 'connection-local-criteria-alist' that I mentioned initially. I think ultimately, it comes down to a confusion over what "optional" means. I took it to mean: "It this property is provided, it will be checked when matching. If not, we don't care about the value of this property." And, as I stated earlier, I don't understand how the sentence "If CRITERIA is 'nil', it always applies." is try in any sense of those words. If the feature is working as intended, those are the worst offenders as far as confusing documentation. Once again, I appreciate this feature and your explanation here. I hope this is helpful in clarifying the documentation. Christopher