From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Juri Linkov <juri@jurta.org>
Cc: Michael Albinus <michael.albinus@gmx.de>,
rms@gnu.org, emacs-devel@gnu.org
Subject: Re: rfn-eshadow
Date: Tue, 08 Jan 2008 21:17:40 -0500 [thread overview]
Message-ID: <jwvfxx7ycpb.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <8763y324rn.fsf@jurta.org> (Juri Linkov's message of "Wed, 09 Jan 2008 02:59:08 +0200")
>>> 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.
next prev parent reply other threads:[~2008-01-09 2:17 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-03 9:51 [jidanni@jidanni.org: ffap; prompt turns color misleadingly] Richard Stallman
2008-01-03 21:42 ` rfn-eshadow (Was: [jidanni@jidanni.org: ffap; prompt turns color misleadingly]) Juri Linkov
2008-01-03 22:12 ` rfn-eshadow Michael Albinus
2008-01-03 22:28 ` rfn-eshadow Juri Linkov
2008-01-04 2:51 ` rfn-eshadow Stefan Monnier
2008-01-04 9:51 ` rfn-eshadow Juri Linkov
2008-01-04 12:11 ` rfn-eshadow Michael Albinus
2008-01-04 21:52 ` rfn-eshadow Juri Linkov
2008-01-04 22:23 ` rfn-eshadow Michael Albinus
2008-01-05 10:36 ` rfn-eshadow Juri Linkov
2008-01-05 22:34 ` rfn-eshadow Stefan Monnier
2008-01-06 14:08 ` rfn-eshadow Michael Albinus
2008-01-06 21:54 ` rfn-eshadow Juri Linkov
2008-01-07 6:57 ` rfn-eshadow Michael Albinus
2008-01-09 0:59 ` rfn-eshadow Juri Linkov
2008-01-09 2:17 ` Stefan Monnier [this message]
2008-01-09 8:13 ` rfn-eshadow Michael Albinus
2008-01-05 5:54 ` rfn-eshadow Richard Stallman
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=jwvfxx7ycpb.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@gnu.org \
--cc=juri@jurta.org \
--cc=michael.albinus@gmx.de \
--cc=rms@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.