all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: 54459@debbugs.gnu.org
Cc: spacibba@aol.com
Subject: bug#54459: 29.0.50; Simplify connection-local variables (feature request)
Date: Sun, 20 Mar 2022 12:04:28 +0100	[thread overview]
Message-ID: <87fsncdgw3.fsf@gmx.de> (raw)
In-Reply-To: <87bky2zjzz.fsf@aol.com> (Ergus via's message of "Sat, 19 Mar 2022 04:41:52 +0100")

Ergus via "Bug reports for GNU Emacs, the Swiss army knife of text
editors" <bug-gnu-emacs@gnu.org> writes:

> Hi:

Hi,

> There are 3 issues that could be solved/improved:
>
> 1) If another buffer of a file in the same remote host is already open,
> then when the function is called in that buffer for the first time it
> will use the value cached in gtags--executable-connection. That's why in
> the code I need to create a buffer local variable... Could we provide a
> way to update all of them immediately?

I don't understand the scenario, sorry. Could you pls explain it in detail?

> 2) There are functions to set connection-local profile variables
> (connection-local-set-profile-variables) But so far there are not any
> clean way to append variables to an existing profile; so a call to
> connection-local-set-profile-variables deleted any previous variable,
> actually the user is enforced to create a unique name for every profile
> every time it needs something like this.

--8<---------------cut here---------------start------------->8---
(connection-local-set-profile-variables
 'profile
 (append
  (connection-local-get-profile-variables 'profile)
  my-variables-list))
--8<---------------cut here---------------end--------------->8---

> 3) In the ideal world it may be possible to add an optional parameter to
> tell executable-find to cache the found values per host and executable
> name... so it could avoid the extra remote search... I understand this
> shouldn't be enabled by default, but many packages may find it
> useful. executable-find could be smart enough to remember some of the
> previous searches at least in remote hosts.

That's hard to do. A user could change the remote PATH while the result
of executable-find is cached. Furthermore, Tramp appends the local part
of the remote default-directory to the directory search list. Therefore,
executable-find could return a possibly wrong cached value.

You could write your own function, using Tramp's cache mechanism, but at
your own risk. Something like (untested)

--8<---------------cut here---------------start------------->8---
(defun my-executable-find (command &optional remote)
  (if (and remote (file-remote-p default-directory))
      (with-tramp-connection-property
	  (tramp-get-process (tramp-dissect-file-name default-directory))
	  (concat "executable-find-" command)
	(executable-find command remote))
    (executable-find command remote)))
--8<---------------cut here---------------end--------------->8---

Best regards, Michael.





  reply	other threads:[~2022-03-20 11:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87bky2zjzz.fsf.ref@aol.com>
2022-03-19  3:41 ` bug#54459: 29.0.50; Simplify connection-local variables (feature request) Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-03-20 11:04   ` Michael Albinus [this message]
2022-03-20 12:09     ` Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-03-20 18:17       ` Michael Albinus
2022-03-29  8:25         ` Michael Albinus
2022-03-29 12:01           ` Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-03-29 13:11             ` 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=87fsncdgw3.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=54459@debbugs.gnu.org \
    --cc=spacibba@aol.com \
    /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.