Subject: bug#9511: Moving the point to / with C-M-f and C-M-b when reading a filename from minibuffer

From: Masatake YAMATO <[email-masked]>
Date: Thu, 15 Sep 2011 23:05:06 +0900 (JST)

Thank you for reviwing again.

=== modified file 'lisp/minibuffer.el'
*** lisp/minibuffer.el	2011-09-02 00:36:58 +0000
--- lisp/minibuffer.el	2011-09-15 13:48:51 +0000
***************
*** 1997,2002 ****
--- 1997,2020 ----
    (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.
***************
*** 2065,2071 ****
                                 (lambda ()
                                   (with-current-buffer
                                       (window-buffer (minibuffer-selected-window))
! 				   (read-file-name--defaults dir initial)))))
                        (completing-read prompt 'read-file-name-internal
                                         pred mustmatch insdef
                                         'file-name-history default-filename)))
--- 2083,2091 ----
                                 (lambda ()
                                   (with-current-buffer
                                       (window-buffer (minibuffer-selected-window))
! 				   (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)))