[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: rfn-eshadow
From: |
Stefan Monnier |
Subject: |
Re: rfn-eshadow |
Date: |
Tue, 08 Jan 2008 21:17:40 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux) |
>>> Thanks, but it now produces weird results, e.g. removing a letter from
>>> the beginning of an URL and retyping it again doesn't remove the file name
>>> shadow. This is because url-handlers.el is not loaded, and url-file-handler
>>> is undefined. I see two variants of fixing this: either by explicitly
>>> loading url-handlers.el, or adding an ###autoload cookie to url-file-handler
>>> (I think this is better).
>>
>> I've done the latter.
> After your changes arrived to the trunk I observe a strange behavior:
> 1. emacs -Q
> 2. M-x ffap-bindings RET
> 3. C-x C-f C-a C-k / s u : : / C-g
> 4. C-h v file-name-handler-alist RET
> And `file-name-handler-alist' doesn't contain `tramp-file-name-handler'
> anymore. But in the Emacs 22 branch everything is correct.
> Do you see the same?
Indeed, in the above recipe, Tramp gets loaded while we're inside the
ffap, i.e. while inside the `let' binding, so the
tramp-file-name-handler' gets removed when get out of the let
binding :-(
I.e. we shouldn't use let-binding. I installed the untested patch below
which should hopefully fix this problem.
Stefan
--- ffap.el.~1.68.~ 2008-01-08 21:08:40.000000000 -0500
+++ ffap.el 2008-01-08 21:13:19.000000000 -0500
@@ -1263,10 +1263,10 @@
(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)))
+ (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
@@ -1276,7 +1276,12 @@
(if dir (cons guess (length dir)) guess)
(list 'file-name-history)
(and buffer-file-name
- (abbreviate-file-name 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.
- Re: rfn-eshadow, (continued)
- Re: rfn-eshadow, Juri Linkov, 2008/01/04
- Re: rfn-eshadow, Michael Albinus, 2008/01/04
- Re: rfn-eshadow, Juri Linkov, 2008/01/04
- Re: rfn-eshadow, Michael Albinus, 2008/01/04
- Re: rfn-eshadow, Juri Linkov, 2008/01/05
- Re: rfn-eshadow, Stefan Monnier, 2008/01/05
- Re: rfn-eshadow, Michael Albinus, 2008/01/06
- Re: rfn-eshadow, Juri Linkov, 2008/01/06
- Re: rfn-eshadow, Michael Albinus, 2008/01/07
- Re: rfn-eshadow, Juri Linkov, 2008/01/08
- Re: rfn-eshadow,
Stefan Monnier <=
- Re: rfn-eshadow, Michael Albinus, 2008/01/09
- Re: rfn-eshadow, Richard Stallman, 2008/01/05