[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: strange behaviour of "//" in open file names
From: |
Juri Linkov |
Subject: |
Re: strange behaviour of "//" in open file names |
Date: |
Thu, 09 Feb 2006 21:16:16 +0200 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) |
[followup to address@hidden from address@hidden
> When I open a file with C-x C-f I have to enter its name in the minibuffer.
> If
> its name contains double slashs "//", everything before them is printed in
> grey
> (my global standard colour is orange). Additionally, a C-a doesn't go to the
> first character in the file path but to the most recent double slash (if the
> cursor was behind it).
I use ffap and since file-name-shadow-mode was enabled it bothered me that
the protocol part of URLs is shadowed and C-a doesn't go to the beginning
of the minibuffer. In all other respects I like file-name-shadow-mode.
I think there should be a way to tell file-name-shadow-mode not to shadow
certain minibuffer strings with a patch like below:
Index: lisp/rfn-eshadow.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/rfn-eshadow.el,v
retrieving revision 1.22
diff -u -w -b -r1.22 rfn-eshadow.el
--- lisp/rfn-eshadow.el 6 Feb 2006 14:33:35 -0000 1.22
+++ lisp/rfn-eshadow.el 9 Feb 2006 19:16:11 -0000
@@ -130,6 +130,10 @@
(defvar rfn-eshadow-overlay)
(make-variable-buffer-local 'rfn-eshadow-overlay)
+(defvar rfn-eshadow-update-overlay-p nil
+ "Function to disable shadow depending on the minibuffer contents.
+Its return value nil removes shadow from the minibuffer.")
+
;;; Hook functions
@@ -168,6 +172,10 @@
This is intended to be used as a minibuffer `post-command-hook' for
`file-name-shadow-mode'; the minibuffer should have already
been set up by `rfn-eshadow-setup-minibuffer'."
+ (if (and (functionp rfn-eshadow-update-overlay-p)
+ (null (funcall rfn-eshadow-update-overlay-p)))
+ (move-overlay rfn-eshadow-overlay
+ (minibuffer-prompt-end) (minibuffer-prompt-end))
(condition-case nil
(let ((goal (substitute-in-file-name (minibuffer-contents)))
(mid (overlay-end rfn-eshadow-overlay))
@@ -195,7 +203,7 @@
(setq end mid)))
(move-overlay rfn-eshadow-overlay (minibuffer-prompt-end) start)))
;; `substitute-in-file-name' can fail on partial input.
- (error nil)))
+ (error nil))))
(define-minor-mode file-name-shadow-mode
"Toggle File-Name Shadow mode.
Index: lisp/ffap.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/ffap.el,v
retrieving revision 1.53
diff -c -r1.53 ffap.el
*** lisp/ffap.el 19 Nov 2005 12:18:07 -0000 1.53
--- lisp/ffap.el 9 Feb 2006 19:16:12 -0000
***************
*** 1255,1261 ****
(abbreviate-file-name (expand-file-name guess))
))
(setq dir (file-name-directory guess))))
! (let ((minibuffer-completing-file-name t))
(setq guess
(completing-read
prompt
--- 1255,1263 ----
(abbreviate-file-name (expand-file-name guess))
))
(setq dir (file-name-directory guess))))
! (let ((minibuffer-completing-file-name t)
! (rfn-eshadow-update-overlay-p
! (lambda () (not (ffap-url-p (minibuffer-contents))))))
(setq guess
(completing-read
prompt
--
Juri Linkov
http://www.jurta.org/emacs/
- Re: strange behaviour of "//" in open file names,
Juri Linkov <=