unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jim Porter <jporterbugs@gmail.com>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: 57556@debbugs.gnu.org
Subject: bug#57556: 28.1; Eshell not finding executables in PATH when tramp-integration loaded
Date: Sat, 15 Oct 2022 16:33:44 -0700	[thread overview]
Message-ID: <7064d94c-76dc-4572-121c-fd556b420a2e@gmail.com> (raw)
In-Reply-To: <87k051v0c2.fsf@gmx.de>

[-- Attachment #1: Type: text/plain, Size: 1921 bytes --]

On 10/15/2022 3:38 AM, Michael Albinus wrote:
> Use what is offered by texinfo. Say for example
> 
> --8<---------------cut here---------------start------------->8---
> the @env{PATH} environment variable
> --8<---------------cut here---------------end--------------->8---

Ah ha, got it.

> And in sample code, do not apply further formatting, but say it as you
> mean it
> 
> --8<---------------cut here---------------start------------->8---
> @samp{setq name value}
> @samp{export NAME=value}
> --8<---------------cut here---------------end--------------->8---

The Texinfo manual says I should wrap metasyntactic variables though[1]:

     For example,

         To delete file @var{filename},
         type @samp{rm @var{filename}}.

     produces

         To delete file filename, type ‘rm filename’.

     (Note that @var may appear inside @code, @samp, @file, etc.)


> Otherwise, it LGTM. Somewhere there is only one space after a dot
> (should be two spaces), but I didn't marked this during review, and now
> I'm too lazy to look for :-)

I think I found it. Fixed.

> I'd say just push it to the repo, and if there's something left to do we
> can stiil do it.

There's one significant problem I noticed with patch 0002 that we should 
probably fix first: 'setq-connection-local' clears all connection-local 
variables for the profile that were set elsewhere. That is, this:

     (with-connection-local-variables
      (setq-connection-local foo "foo")
      (setq-connection-local bar "bar"))

only sets 'bar' on the connection-local profile; the second 
'setq-connection-local' clears 'foo'. Attached is a fix for this (I'll 
fold it into patch 0002 before merging). I'm not sure if the new 
'connection-local-update-profile-variables' I added is 100% perfect, but 
I think it should work for more real-world situations.

[1] 
https://www.gnu.org/software/texinfo/manual/texinfo/html_node/_0040var.html

[-- Attachment #2: connection-local-update-profile-variables.diff --]
[-- Type: text/plain, Size: 4548 bytes --]

diff --git a/lisp/files-x.el b/lisp/files-x.el
index 665ae2ffa8..0640413ddd 100644
--- a/lisp/files-x.el
+++ b/lisp/files-x.el
@@ -706,6 +706,23 @@ connection-local-set-profile-variables
   (customize-set-variable
    'connection-local-profile-alist connection-local-profile-alist))
 
+;;;###autoload
+(defun connection-local-update-profile-variables (profile variables)
+  "Update the variable settings for PROFILE in-place.
+VARIABLES is a list that declares connection-local variables for
+the connection profile.  An element in VARIABLES is an alist
+whose elements are of the form (VAR . VALUE).
+
+Unlike `connection-local-set-profile-variables' (which see), this
+function preserves the values of any existing variable
+definitions that aren't listed in VARIABLES."
+  (when-let ((existing-variables
+              (nreverse (alist-get profile connection-local-profile-alist))))
+    (dolist (var variables)
+      (setf (alist-get (car var) existing-variables) (cdr var)))
+    (setq variables (nreverse existing-variables)))
+  (connection-local-set-profile-variables profile variables))
+
 (defun hack-connection-local-variables (criteria)
   "Read connection-local variables according to CRITERIA.
 Store the connection-local variables in buffer local
@@ -833,7 +850,7 @@ setq-connection-local
     `(prog1
          ,(macroexp-progn (nreverse set-expr))
        (when connection-local-profile-name-for-setq
-         (connection-local-set-profile-variables
+         (connection-local-update-profile-variables
           connection-local-profile-name-for-setq
           (list ,@(nreverse profile-vars)))
          (connection-local-set-profiles
diff --git a/test/lisp/files-x-tests.el b/test/lisp/files-x-tests.el
index 9499c951c5..274c49bb80 100644
--- a/test/lisp/files-x-tests.el
+++ b/test/lisp/files-x-tests.el
@@ -37,7 +37,8 @@ files-x-test--variables3
 (defconst files-x-test--variables4
   '((remote-null-device . "null")))
 (defconst files-x-test--variables5
-  '((remote-lazy-var . nil)))
+  '((remote-lazy-var . nil)
+    (remote-null-device . "/dev/null")))
 (defvar remote-null-device)
 (defvar remote-lazy-var nil)
 (put 'remote-shell-file-name 'safe-local-variable #'identity)
@@ -95,6 +96,28 @@ files-x-test-connection-local-set-profile-variables
       (connection-local-get-profile-variables 'remote-nullfile)
       files-x-test--variables4))))
 
+(ert-deftest files-x-test-connection-local-update-profile-variables ()
+  "Test updating connection-local profile variables."
+
+  ;; Declare (PROFILE VARIABLES) objects.
+  (let (connection-local-profile-alist connection-local-criteria-alist)
+    (connection-local-set-profile-variables
+     'remote-bash (copy-alist files-x-test--variables1))
+    (should
+     (equal
+      (connection-local-get-profile-variables 'remote-bash)
+      files-x-test--variables1))
+
+    ;; Updating overwrites only the values specified in this call, but
+    ;; retains all the other values from previous calls.
+    (connection-local-update-profile-variables
+     'remote-bash files-x-test--variables2)
+    (should
+     (equal
+      (connection-local-get-profile-variables 'remote-bash)
+      (cons (car files-x-test--variables2)
+            (cdr files-x-test--variables1))))))
+
 (ert-deftest files-x-test-connection-local-set-profiles ()
   "Test setting connection-local profiles."
 
@@ -402,14 +425,21 @@ files-x-test-setq-connection-local
 
       ;; Set the remote value and make sure it retains the value we set.
       (should (equal (files-x-test--set-lazy-var "there") "there"))
-      (should (equal (files-x-test--get-lazy-var) "there")))
+      (should (equal (files-x-test--get-lazy-var) "there"))
+      (with-connection-local-application-variables
+          (cadr files-x-test--application)
+        (setq-connection-local remote-null-device "null")))
 
     ;; Make sure we get the local value we set above.
     (should (equal (files-x-test--get-lazy-var) "here"))
+    (should-not (boundp 'remote-null-device))
 
-  ;; Make sure we get the remote value we set above.
-  (let ((default-directory "/method:host:"))
-    (should (equal (files-x-test--get-lazy-var) "there")))))
+    ;; Make sure we get the remote values we set above.
+    (let ((default-directory "/method:host:"))
+      (should (equal (files-x-test--get-lazy-var) "there"))
+      (with-connection-local-application-variables
+          (cadr files-x-test--application)
+        (should (equal remote-null-device "null"))))))
 
 (provide 'files-x-tests)
 ;;; files-x-tests.el ends here

  reply	other threads:[~2022-10-15 23:33 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-03  5:03 bug#57556: 28.1; Eshell not finding executables in PATH when tramp-integration loaded Colton Lewis via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-03 12:26 ` Lars Ingebrigtsen
2022-09-18 11:18 ` Michael Albinus
2022-09-18 18:54   ` Jim Porter
2022-09-18 19:07     ` Michael Albinus
2022-09-22 17:23       ` Colton Lewis via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-22 17:55         ` Michael Albinus
2022-09-30  3:54           ` Jim Porter
2022-10-01 20:25             ` Michael Albinus
2022-10-01 22:02               ` Jim Porter
2022-10-02  5:34                 ` Jim Porter
2022-10-02  8:48                   ` Michael Albinus
2022-10-07  3:19                     ` Jim Porter
2022-10-07 18:28                       ` Michael Albinus
2022-10-08 22:09                         ` Jim Porter
2022-10-09 18:01                           ` Michael Albinus
2022-10-13  4:11                             ` Jim Porter
2022-10-13  6:35                               ` Eli Zaretskii
2022-10-14  1:29                                 ` Jim Porter
2022-10-14  6:17                                   ` Eli Zaretskii
2022-10-14 12:28                                   ` Michael Albinus
2022-10-14 12:27                               ` Michael Albinus
2022-10-14 20:53                                 ` Jim Porter
2022-10-15 10:38                                   ` Michael Albinus
2022-10-15 23:33                                     ` Jim Porter [this message]
2022-10-16 17:00                                       ` Michael Albinus
2022-10-16 23:01                                         ` Jim Porter
2022-10-16 20:51                                   ` Richard Stallman
2022-10-16 23:07                                     ` Jim Porter
2022-10-18  1:51                                       ` Jim Porter
2022-10-10  9:15                           ` Michael Albinus
2022-10-02  8:55                 ` 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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7064d94c-76dc-4572-121c-fd556b420a2e@gmail.com \
    --to=jporterbugs@gmail.com \
    --cc=57556@debbugs.gnu.org \
    --cc=michael.albinus@gmx.de \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).