aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMasatake YAMATO2012-04-13 23:43:03 +0200
committerLars Ingebrigtsen2012-04-13 23:43:03 +0200
commit09b95ce39ba378b3fe116379c85af5a5a42599cd (patch)
treeeb4ede80437bdbaecdcfab073d1fdbacdb5af94b
parent4b63a9ca3d6451521cdcd2274e9ab1c9b16ba092 (diff)
downloademacs-09b95ce39ba378b3fe116379c85af5a5a42599cd.tar.gz
emacs-09b95ce39ba378b3fe116379c85af5a5a42599cd.zip
Make `C-M-f' and friends work better when prompting for file names
* minibuffer.el (minibuffer-local-filename-syntax): New variable to allow `C-M-f' and `C-M-b' to move to the nearest path separator.
-rw-r--r--etc/NEWS3
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/minibuffer.el18
3 files changed, 26 insertions, 1 deletions
diff --git a/etc/NEWS b/etc/NEWS
index f20b7a840b7..23d6dc0cd89 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -44,6 +44,9 @@ prompts for a column number.
44** `mouse-avoidance-banish-position' can now be used to customize 44** `mouse-avoidance-banish-position' can now be used to customize
45`mouse-avoidance-mode' further. 45`mouse-avoidance-mode' further.
46 46
47** `C-M-f' and `C-M-b' will now move to the path name separator
48character when doing minibuffer filename prompts.
49
47 50
48* Changes in Specialized Modes and Packages in Emacs 24.2 51* Changes in Specialized Modes and Packages in Emacs 24.2
49 52
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c806ed4a803..e8fc25121fd 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12012-04-13 Masatake YAMATO <yamato@redhat.com>
2
3 * minibuffer.el (minibuffer-local-filename-syntax): New variable
4 to allow `C-M-f' and `C-M-b' to move to the nearest path
5 separator (bug#9511).
6
12012-04-13 Lars Ingebrigtsen <larsi@gnus.org> 72012-04-13 Lars Ingebrigtsen <larsi@gnus.org>
2 8
3 * avoid.el: Require cl when compiling. And also move the 9 * avoid.el: Require cl when compiling. And also move the
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index bcc6a808d22..eb731897212 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -2045,6 +2045,21 @@ and `read-file-name-function'."
2045 (funcall (or read-file-name-function #'read-file-name-default) 2045 (funcall (or read-file-name-function #'read-file-name-default)
2046 prompt dir default-filename mustmatch initial predicate)) 2046 prompt dir default-filename mustmatch initial predicate))
2047 2047
2048(defvar minibuffer-local-filename-syntax
2049 (let ((table (make-syntax-table))
2050 (punctuation (car (string-to-syntax "."))))
2051 ;; Convert all punctuation entries to symbol.
2052 (map-char-table (lambda (c syntax)
2053 (when (eq (car syntax) punctuation)
2054 (modify-syntax-entry c "_" table)))
2055 table)
2056 (mapc
2057 (lambda (c)
2058 (modify-syntax-entry c "." table))
2059 '(?/ ?: ?\\))
2060 table)
2061 "Syntax table to be used in minibuffer for reading file name.")
2062
2048;; minibuffer-completing-file-name is a variable used internally in minibuf.c 2063;; minibuffer-completing-file-name is a variable used internally in minibuf.c
2049;; to determine whether to use minibuffer-local-filename-completion-map or 2064;; to determine whether to use minibuffer-local-filename-completion-map or
2050;; minibuffer-local-completion-map. It shouldn't be exported to Elisp. 2065;; minibuffer-local-completion-map. It shouldn't be exported to Elisp.
@@ -2113,7 +2128,8 @@ See `read-file-name' for the meaning of the arguments."
2113 (lambda () 2128 (lambda ()
2114 (with-current-buffer 2129 (with-current-buffer
2115 (window-buffer (minibuffer-selected-window)) 2130 (window-buffer (minibuffer-selected-window))
2116 (read-file-name--defaults dir initial))))) 2131 (read-file-name--defaults dir initial))))
2132 (set-syntax-table minibuffer-local-filename-syntax))
2117 (completing-read prompt 'read-file-name-internal 2133 (completing-read prompt 'read-file-name-internal
2118 pred mustmatch insdef 2134 pred mustmatch insdef
2119 'file-name-history default-filename))) 2135 'file-name-history default-filename)))