emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r107895: Make `C-M-f' and friends wor


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r107895: Make `C-M-f' and friends work better when prompting for file names
Date: Fri, 13 Apr 2012 23:43:03 +0200
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 107895
author: Masatake YAMATO <address@hidden>
committer: Lars Ingebrigtsen <address@hidden>
branch nick: trunk
timestamp: Fri 2012-04-13 23:43:03 +0200
message:
  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.
modified:
  etc/NEWS
  lisp/ChangeLog
  lisp/minibuffer.el
=== modified file 'etc/NEWS'
--- a/etc/NEWS  2012-04-13 21:15:22 +0000
+++ b/etc/NEWS  2012-04-13 21:43:03 +0000
@@ -44,6 +44,9 @@
 ** `mouse-avoidance-banish-position' can now be used to customize
 `mouse-avoidance-mode' further.
 
+** `C-M-f' and `C-M-b' will now move to the path name separator
+character when doing minibuffer filename prompts.
+
 
 * Changes in Specialized Modes and Packages in Emacs 24.2
 

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-04-13 21:17:38 +0000
+++ b/lisp/ChangeLog    2012-04-13 21:43:03 +0000
@@ -1,3 +1,9 @@
+2012-04-13  Masatake YAMATO  <address@hidden>
+
+       * minibuffer.el (minibuffer-local-filename-syntax): New variable
+       to allow `C-M-f' and `C-M-b' to move to the nearest path
+       separator (bug#9511).
+
 2012-04-13  Lars Ingebrigtsen  <address@hidden>
 
        * avoid.el: Require cl when compiling.  And also move the

=== modified file 'lisp/minibuffer.el'
--- a/lisp/minibuffer.el        2012-04-04 09:19:32 +0000
+++ b/lisp/minibuffer.el        2012-04-13 21:43:03 +0000
@@ -2045,6 +2045,21 @@
   (funcall (or read-file-name-function #'read-file-name-default)
            prompt dir default-filename mustmatch initial predicate))
 
+(defvar minibuffer-local-filename-syntax
+  (let ((table (make-syntax-table))
+       (punctuation (car (string-to-syntax "."))))
+    ;; Convert all punctuation entries to symbol.
+    (map-char-table (lambda (c syntax)
+                     (when (eq (car syntax) punctuation)
+                       (modify-syntax-entry c "_" table)))
+                   table)
+    (mapc
+     (lambda (c)
+       (modify-syntax-entry c "." table))
+     '(?/ ?: ?\\))
+    table)
+  "Syntax table to be used in minibuffer for reading file name.")
+
 ;; minibuffer-completing-file-name is a variable used internally in minibuf.c
 ;; to determine whether to use minibuffer-local-filename-completion-map or
 ;; minibuffer-local-completion-map.  It shouldn't be exported to Elisp.
@@ -2113,7 +2128,8 @@
                                (lambda ()
                                  (with-current-buffer
                                      (window-buffer 
(minibuffer-selected-window))
-                                  (read-file-name--defaults dir initial)))))
+                                  (read-file-name--defaults dir initial))))
+                         (set-syntax-table minibuffer-local-filename-syntax))
                       (completing-read prompt 'read-file-name-internal
                                        pred mustmatch insdef
                                        'file-name-history default-filename)))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]