GNU bug report logs -
#9511
Moving the point to / with C-M-f and C-M-b when reading a filename from minibuffer
Previous Next
Reported by: Masatake YAMATO <yamato <at> redhat.com>
Date: Thu, 15 Sep 2011 08:44:02 UTC
Severity: wishlist
Tags: fixed, patch
Fixed in version 24.2
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
This is a request for merge a patch to official GNU Emacs source tree.
Following patch adds a function to move the point to / with
C-M-f and C-M-b when reading a filename from minibuffer.
See also the thread at http://lists.gnu.org/archive/html/emacs-devel/2011-09/msg00155.html
2011-09-15 Masatake YAMATO <yamato <at> redhat.com>
* minibuffer.el (minibuffer-local-filename-syntax): New variable.
(read-file-name-default): Install the syntax table.
=== modified file 'lisp/minibuffer.el'
--- lisp/minibuffer.el 2011-09-02 00:36:58 +0000
+++ lisp/minibuffer.el 2011-09-15 06:27:34 +0000
@@ -1997,6 +1997,31 @@
(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 (cc syntax)
+ (when (and syntax
+ (eq (car syntax)
+ punctuation))
+ (let* ((cons? (consp cc))
+ (begin (if cons? (car cc) cc))
+ (end (if cons? (cdr cc) begin))
+ (c begin))
+ (while (<= c end)
+ (modify-syntax-entry c "_" table)
+ (setq c (1+ c))))))
+ 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,7 +2090,9 @@
(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)))
This bug report was last modified 13 years and 93 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.