From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.tramp,gmane.emacs.devel Subject: Re: Reverting *Locate* buffers. Date: Sun, 2 Jul 2006 21:51:20 -0500 (CDT) Message-ID: <200607030251.k632pKhp018621@jane.dms.auburn.edu> References: <200606260327.k5Q3Rfpd013691@jane.dms.auburn.edu> <853bdsmkey.fsf@lola.goethe.zz> <200606280158.k5S1wJCu004606@jane.dms.auburn.edu> <17569.64920.191861.355581@localhost.localdomain> <200606290313.k5T3DwTj002620@jane.dms.auburn.edu> <873bdjwwzu.fsf@gmx.de> NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1151895118 4364 80.91.229.2 (3 Jul 2006 02:51:58 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 3 Jul 2006 02:51:58 +0000 (UTC) Cc: pbreton@cs.umb.edu, tramp-devel@gnu.org, raman@users.sourceforge.net, emacs-devel@gnu.org Original-X-From: tramp-devel-bounces+tramp=quimby.gnus.org@gnu.org Mon Jul 03 04:51:56 2006 Return-path: Envelope-to: tramp@deer.gmane.org Original-Received: from quimby.gnus.org ([80.91.224.244]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FxEXU-00027T-2v for tramp@deer.gmane.org; Mon, 03 Jul 2006 04:51:56 +0200 Original-Received: from lists.gnu.org ([199.232.76.165]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1FxEXT-00035q-00 for ; Mon, 03 Jul 2006 04:51:55 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FxEXS-0002f2-Re for tramp@quimby.gnus.org; Sun, 02 Jul 2006 22:51:54 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FxEXL-0002eN-Cv for tramp-devel@gnu.org; Sun, 02 Jul 2006 22:51:47 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FxEXJ-0002dr-LT for tramp-devel@gnu.org; Sun, 02 Jul 2006 22:51:46 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FxEXJ-0002df-AE; Sun, 02 Jul 2006 22:51:45 -0400 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FxEkf-0005yR-9e; Sun, 02 Jul 2006 23:05:33 -0400 Original-Received: from jane.dms.auburn.edu (jane.dms.auburn.edu [131.204.53.201]) by manatee.dms.auburn.edu (8.13.6/8.13.6) with ESMTP id k632pYMQ017971; Sun, 2 Jul 2006 21:51:34 -0500 (CDT) Original-Received: from jane.dms.auburn.edu (localhost [127.0.0.1]) by jane.dms.auburn.edu (8.13.4+Sun/8.13.4) with ESMTP id k632pMuE018624; Sun, 2 Jul 2006 21:51:22 -0500 (CDT) Original-Received: (from teirllm@localhost) by jane.dms.auburn.edu (8.13.4+Sun/8.13.3/Submit) id k632pKhp018621; Sun, 2 Jul 2006 21:51:20 -0500 (CDT) X-Authentication-Warning: jane.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: michael.albinus@gmx.de In-reply-to: <873bdjwwzu.fsf@gmx.de> (message from Michael Albinus on Sun, 02 Jul 2006 22:52:05 +0200) X-BeenThere: tramp-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: tramp-devel.gnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: tramp-devel-bounces+tramp=quimby.gnus.org@gnu.org Errors-To: tramp-devel-bounces+tramp=quimby.gnus.org@gnu.org Xref: news.gmane.org gmane.emacs.tramp:5031 gmane.emacs.devel:56399 Archived-At: 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? 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. 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. ===File ~/locate-diff======================================= *** locate.el 15 Mar 2006 19:31:47 -0600 1.36 --- locate.el 02 Jul 2006 17:35:17 -0500 *************** *** 191,201 **** --- 191,222 ---- :group 'locate :version "22.1") + (defcustom locate-update-when-revert nil + "This option affects how the *Locate* buffer gets reverted. + If non-nil, offer to update the locate database when reverting that buffer. + \(Normally, you need to have root privileges for this to work. See the + option `locate-update-path'.) + If nil, reverting does not update the locate database." + :type 'boolean + :group 'locate + :version "22.1") + (defcustom locate-update-command "updatedb" "The executable program used to update the locate database." :type 'string :group 'locate) + (defcustom locate-update-path "/" + "The default directory from where `locate-update-command' is called. + Usually, root permissions are required to run that command. This + can be achieved by setting this option to \"/su::\" or \"/sudo::\" + \(if you have the appropriate authority). If your current user + permissions are sufficient to run the command, you can set this + option to \"/\"." + :type 'string + :group 'locate + :version "22.1") + (defcustom locate-prompt-for-command nil "If non-nil, the `locate' command prompts for a command to run. Otherwise, that behavior is invoked via a prefix argument." *************** *** 557,568 **** ;; From Stephen Eglen (defun locate-update (ignore1 ignore2) ! "Update the locate database. ! Database is updated using the shell command in `locate-update-command'." (let ((str (car locate-history-list))) ! (cond ((yes-or-no-p "Update locate database (may take a few seconds)? ") ! (shell-command locate-update-command) ! (locate str))))) ;;; Modified three functions from `dired.el': ;;; dired-find-directory, --- 578,595 ---- ;; From Stephen Eglen (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)? ") ! (progn ! (unless (equal locate-update-path "/") ! (require 'tramp)) ! (let ((default-directory locate-update-path)) ! (shell-command locate-update-command)))) ! (locate str))) ;;; Modified three functions from `dired.el': ;;; dired-find-directory, ============================================================