changeset 87653:3091cbee6fd8

(ffap-read-file-or-url): Don't use let-binding to temporarily add a file-name handler.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 09 Jan 2008 02:16:47 +0000
parents c20d4d87c3ae
children 85fe2f3f4acb
files lisp/ChangeLog lisp/ffap.el
diffstat 2 files changed, 33 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Wed Jan 09 01:43:14 2008 +0000
+++ b/lisp/ChangeLog	Wed Jan 09 02:16:47 2008 +0000
@@ -1,20 +1,22 @@
+2008-01-09  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* ffap.el (ffap-read-file-or-url): Don't use let-binding to temporarily
+	add a file-name handler.
+
 2008-01-08  Roland Winkler  <Roland.Winkler@physik.uni-erlangen.de>
 
-	* textmodes/bibtex.el (bibtex-initialize): New autoloaded
-	command. Rename from function bibtex-files-expand. New optional
-	arg select.
+	* textmodes/bibtex.el (bibtex-initialize): New autoloaded command.
+	Rename from function bibtex-files-expand.  New optional arg select.
 	(bibtex-flash-head): Allow blink-matching-delay being zero.
 	(bibtex-clean-entry): Use atomic-change-group.
 	(bibtex-format-entry): Check presence of required fields only
 	after formatting of fields.  Use member-ignore-case.  Do not use
-	bibtex-parse-entry.  Do not use booktitle field to set a missing
-	title.
+	bibtex-parse-entry.  Do not use booktitle field to set a missing title.
 	(bibtex-autofill-entry): Do not call undo-boundary.
-	(bibtex-lessp): Handle crossref keys that point to another bibtex
-	file.
+	(bibtex-lessp): Handle crossref keys that point to another bibtex file.
 	(bibtex-sort-buffer, bibtex-prepare-new-entry, bibtex-validate):
 	Parse keys if necessary.
-	
+
 2008-01-08  Nick Roberts  <nickrob@snap.net.nz>
 
 	* progmodes/gdb-ui.el (gdb-var-list-children-1): Put varnum in
@@ -22,8 +24,8 @@
 
 2008-01-08  Nick Roberts  <nickrob@snap.net.nz>
 
-	* progmodes/gdb-ui.el (gud-gdb-command-name): Explain
-	"--annotate=3" option is necessary for the Graphical Interface.
+	* progmodes/gdb-ui.el (gud-gdb-command-name):
+	Explain "--annotate=3" option is necessary for the Graphical Interface.
 
 2008-01-08  Nick Roberts  <nickrob@snap.net.nz>
 
@@ -91,10 +93,8 @@
 
 	* time-stamp.el (time-stamp-time-zone):
 	* whitespace.el (whitespace-check-buffer-leading)
-	(whitespace-check-buffer-trailing)
-	(whitespace-check-buffer-indent)
-	(whitespace-check-buffer-spacetab)
-	(whitespace-check-buffer-ateol):
+	(whitespace-check-buffer-trailing, whitespace-check-buffer-indent)
+	(whitespace-check-buffer-spacetab, whitespace-check-buffer-ateol):
 	* progmodes/sh-script.el (sh-indentation):
 	* textmodes/ispell.el (ispell-local-pdict):
 	Add safe-local-variable properties.
--- a/lisp/ffap.el	Wed Jan 09 01:43:14 2008 +0000
+++ b/lisp/ffap.el	Wed Jan 09 02:16:47 2008 +0000
@@ -1263,20 +1263,25 @@
 	  (setq dir (file-name-directory guess))))
     (let ((minibuffer-completing-file-name t)
 	  (completion-ignore-case read-file-name-completion-ignore-case)
-	  ;; because of `rfn-eshadow-update-overlay'.
-	  (file-name-handler-alist
-	   (cons (cons ffap-url-regexp 'url-file-handler)
-		 file-name-handler-alist)))
-      (setq guess
-	    (completing-read
-	     prompt
-	     'ffap-read-file-or-url-internal
-	     dir
-	     nil
-	     (if dir (cons guess (length dir)) guess)
-	     (list 'file-name-history)
-	     (and buffer-file-name
-		  (abbreviate-file-name buffer-file-name)))))
+          (fnh-elem (cons ffap-url-regexp 'url-file-handler)))
+      ;; Explain to `rfn-eshadow' that we can use URLs here.
+      (push fnh-elem file-name-handler-alist)
+      (unwind-protect
+          (setq guess
+                (completing-read
+                 prompt
+                 'ffap-read-file-or-url-internal
+                 dir
+                 nil
+                 (if dir (cons guess (length dir)) guess)
+                 (list 'file-name-history)
+                 (and buffer-file-name
+                      (abbreviate-file-name buffer-file-name))))
+        ;; Remove the special handler manually.  We used to just let-bind
+        ;; file-name-handler-alist to preserve its value, but that caused
+        ;; other modifications to be lost (e.g. when Tramp gets loaded
+        ;; during the completing-read call).
+        (setq file-name-handler-alist (delq fnh-elem file-name-handler-alist))))
     ;; Do file substitution like (interactive "F"), suggested by MCOOK.
     (or (ffap-url-p guess) (setq guess (substitute-in-file-name guess)))
     ;; Should not do it on url's, where $ is a common (VMS?) character.