all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
Cc: pbreton@cs.umb.edu, tramp-devel@gnu.org,
	raman@users.sourceforge.net, emacs-devel@gnu.org
Subject: Re: Reverting *Locate* buffers.
Date: Mon, 03 Jul 2006 15:43:10 +0200	[thread overview]
Message-ID: <nqlkrals7l.fsf@alcatel.de> (raw)
In-Reply-To: <200607030251.k632pKhp018621@jane.dms.auburn.edu> (Luc Teirlinck's message of "Sun, 2 Jul 2006 21:51:20 -0500 (CDT)")

Luc Teirlinck <teirllm@dms.auburn.edu> writes:

> Michael Albinus wrote:
>
>    The solution would be to set temporarily default-directory to "/" or
>    whatover local during loading of Tramp. But I have no idea how to say
>    it
>
> I did not think hard about the problem and hence I may not understand
> it, but is I guess that there must be some reason why just saving the
> default directory at the start of tramp, setting it to "/" and setting
> it back to the saved value at the end of tramp does not work?

The problem is that default directory must not be a remote filename
when (auto)loading tramp.el. Any counter measure "at the start of
tramp" (i.e. inside tramp.el) is too late.

> Anyway, assuming that the problem really is hard to solve, I propose
> the following patch.  The main difference with what you proposed is
> that the default value of `locate-update-path' is "/" and that Tramp
> does not get loaded if `locate-update-path' has that default value.
>
> There are two reasons for this.  It makes it easier to revert to the
> old default and that default does not load Tramp (it does not need
> to).  Secondly, I would be very hesitant about asking for a root
> password without the user having explicitly asked for that behavior
> (through setting `locate-update-path').  If the user has no authority
> to be root and inadvertently gives his own password at the prompt,
> then mail may be sent to the "appropriate authorities", possibly
> embarrassing the user.

That's OK for me.

> I propose the following patch and if nobody objects, I will install
> it.  if the recursive load problem would be solved some other way,
> then obviously, the requiring of Tramp could be undone.

It's really too hot these days. One obvious solution avoiding to
require Tramp explicitely coould be this:

;; From Stephen Eglen <stephen@cns.ed.ac.uk>
(defun locate-update (ignore1 ignore2)
  "Revert the *Locate* buffer.
If `locate-update-when-revert' is non-nil, offer to update the
locate database using the shell command in `locate-update-command'."
  (let ((str (car locate-history-list)))
    (and locate-update-when-revert
	 (yes-or-no-p "Update locate database (may take a few seconds)? ")
         ;; `expand-file-name' is used in order to autoload Tramp if
         ;; necessary.  It cannot be loaded when `default-directory'
         ;; is remote.
	 (let ((default-directory (expand-file-name locate-update-path)))
	   (shell-command locate-update-command)))
    (locate str)))

Best regards, Michael.

  reply	other threads:[~2006-07-03 13:43 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-26  3:27 Reverting *Locate* buffers Luc Teirlinck
2006-06-26  7:43 ` David Kastrup
2006-06-28  1:58   ` Luc Teirlinck
2006-06-28  3:55     ` T. V. Raman
2006-06-29  3:13       ` Luc Teirlinck
2006-06-29  6:27         ` David Kastrup
2006-06-29 21:52         ` Michael Albinus
2006-06-30  1:55           ` Luc Teirlinck
2006-07-02 20:39             ` Michael Albinus
2006-07-02 20:52         ` Michael Albinus
2006-07-03  2:51           ` Luc Teirlinck
2006-07-03 13:43             ` Michael Albinus [this message]
2006-07-03 23:21               ` Richard Stallman
2006-07-04  0:14               ` Luc Teirlinck
2006-07-03 15:05           ` Richard Stallman
2006-07-03 15:37             ` Michael Albinus
2006-07-03 15:41               ` David Kastrup
2006-07-04 15:42           ` Stefan Monnier
2006-06-29 21:58       ` Michael Albinus
2006-06-26 13:15 ` Peter Breton
2006-06-27  1:55   ` Luc Teirlinck

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=nqlkrals7l.fsf@alcatel.de \
    --to=michael.albinus@gmx.de \
    --cc=emacs-devel@gnu.org \
    --cc=pbreton@cs.umb.edu \
    --cc=raman@users.sourceforge.net \
    --cc=tramp-devel@gnu.org \
    /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.