From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: bug in file-name-shadow-mode Date: Mon, 21 Mar 2005 11:20:43 -0500 Message-ID: References: <200503192012.j2JKCSJ02066@raven.dms.auburn.edu> <200503201626.j2KGQIw04956@raven.dms.auburn.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1111422994 23180 80.91.229.2 (21 Mar 2005 16:36:34 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 21 Mar 2005 16:36:34 +0000 (UTC) Cc: Luc Teirlinck , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Mar 21 17:36:33 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DDPlL-0000yC-9e for ged-emacs-devel@m.gmane.org; Mon, 21 Mar 2005 17:28:20 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DDQ2S-0006U1-Vr for ged-emacs-devel@m.gmane.org; Mon, 21 Mar 2005 11:46:01 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DDQ1V-0006HD-Pd for emacs-devel@gnu.org; Mon, 21 Mar 2005 11:45:02 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DDQ1Q-0006Ee-Ju for emacs-devel@gnu.org; Mon, 21 Mar 2005 11:44:57 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DDQ1P-0006C9-KA for emacs-devel@gnu.org; Mon, 21 Mar 2005 11:44:55 -0500 Original-Received: from [132.204.24.67] (helo=mercure.iro.umontreal.ca) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DDPe7-0006ok-CC; Mon, 21 Mar 2005 11:20:51 -0500 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 1EB69340018; Mon, 21 Mar 2005 11:20:51 -0500 (EST) Original-Received: from asado.iro.umontreal.ca (asado.iro.umontreal.ca [132.204.24.84]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id 38D614AC24D; Mon, 21 Mar 2005 11:20:44 -0500 (EST) Original-Received: by asado.iro.umontreal.ca (Postfix, from userid 20848) id 12EF1E6A41; Mon, 21 Mar 2005 11:20:44 -0500 (EST) Original-To: rms@gnu.org In-Reply-To: (Richard Stallman's message of "Sun, 20 Mar 2005 20:19:15 -0500") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-4.821, requis 5, autolearn=not spam, AWL 0.08, BAYES_00 -4.90) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org X-MailScanner-To: ged-emacs-devel@m.gmane.org Xref: news.gmane.org gmane.emacs.devel:34896 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:34896 > Do C-g to quit the current minibuffer. Then do C-x C-f. > One now has ~/ in the minibuffer. If you type an extra "/", the "~/" > preceding it does not get any special highlighting, as it should if > file-name-shadow-mode is t. > The cause of this is that the minibuffer binds minibuffer-setup-hook > and therefore the local binding is what gets set. Thus, exiting the > minibuffer wipes it out. > I think there is nothing to be done about this. It would be hard to > fix and it probably isn't worth the trouble. How 'bout the untested patch below? Stefan --- files.el 15 f=E9v 2005 11:00:48 -0500 1.745 +++ files.el 21 mar 2005 11:19:48 -0500=09 @@ -928,20 +928,30 @@ (defvar find-file-default nil "Used within `find-file-read-args'.") =20 +(defmacro minibuffer-with-setup-hook (fun &rest body) + "Add FUN to `minibuffer-setup-hook' while executing BODY. +BODY should use the minibuffer at most once. +Recursive uses of the minibuffer will not be affected." + (declare (indent 1) (debug t)) + (let ((funname (make-symbol "setup-hook")) + (oldval (make-symbol "old-val"))) + `(unwind-protect + (progn + (fset ',funname (lambda () (,fun) + ;; Clear out this hook so it does not interfere + ;; with any recursive minibuffer usage. + (remove-hook 'minibuffer-setup-hook ',funname))) + (add-hook 'minibuffer-setup-hook ',funname) + ,@body) + (remove-hook 'minibuffer-setup-hook ',funname)))) + (defun find-file-read-args (prompt mustmatch) (list (let ((find-file-default (and buffer-file-name - (abbreviate-file-name buffer-file-name))) - (munge-default-fun - (lambda () - (setq minibuffer-default find-file-default) - ;; Clear out this hook so it does not interfere - ;; with any recursive minibuffer usage. - (pop minibuffer-setup-hook))) - (minibuffer-setup-hook - minibuffer-setup-hook)) - (add-hook 'minibuffer-setup-hook munge-default-fun) - (read-file-name prompt nil default-directory mustmatch)) + (abbreviate-file-name buffer-file-name)))) + (minibuffer-with-setup-hook + (lambda () (setq minibuffer-default find-file-default)) + (read-file-name prompt nil default-directory mustmatch))) t)) =20 (defun find-file (filename &optional wildcards)