emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: file-remote-p being called too often?


From: T.V Raman
Subject: Re: file-remote-p being called too often?
Date: Thu, 18 Jan 2024 06:43:23 -0800

thanks for the executable-find tip, yes I shall update  to cache the
value



Eli Zaretskii writes:
 > > From: "T.V Raman" <raman@google.com>
 > > Cc: Emacs Devel <emacs-devel@gnu.org>,  Eli Zaretskii <eliz@gnu.org>
 > > Date: Wed, 17 Jan 2024 13:18:09 -0800
 > > 
 > > Above gets invoked when emacspeak plays a local audio file as an earcon
 > > using a shell command; there should be no reason to run file-remote-p in
 > > this case.
 > > 
 > > Debugger entered--entering a function:
 > > * (file-remote-p "/home/raman/emacs/lisp/emacspeak/sounds/" localname)
 > >   (file-local-name "/home/raman/emacs/lisp/emacspeak/sounds/")
 > >   (executable-find "pactl")
 > >   (emacspeak-sounds-get-file process-active)
 > >   (emacspeak-play-auditory-icon process-active)
 > >   (emacspeak-auditory-icon process-active)
 > >   (emacspeak-speak-mode-line nil)
 > 
 > Why does emacspeak repeatedly call executable-find, and from a
 > mode-line format on top of that?  Why not call executable-find just
 > once, and then store the result in some variable, to be reused on
 > subsequent calls from emacspeak-speak-mode-line?
 > 
 > In any case, for local file names, such as "pactl", the call to
 > file-remote-p should be very inexpensive.  Do you have a reason to
 > believe it is somehow expensive in your case?  Or did you just wonder
 > why file-remote-p is called that often, regardless of whether it's
 > expensive?  The reason for frequent calls seems to be that you have
 > this call in your mode-line-format, which is not a good design.  This
 > design means executable-find will be called every redisplay cycle,
 > time and time again, for the same program name, which is hardly a good
 > idea.

-- 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]