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.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 9511 in the body.
You can then email your comments to 9511 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#9511
; Package
emacs
.
(Thu, 15 Sep 2011 08:44:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Masatake YAMATO <yamato <at> redhat.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 15 Sep 2011 08:44:02 GMT)
Full text and
rfc822 format available.
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)))
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#9511
; Package
emacs
.
(Thu, 15 Sep 2011 13:09:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 9511 <at> debbugs.gnu.org (full text, mbox):
> + (when (and syntax
> + (eq (car syntax)
> + punctuation))
If syntax is nil, (car syntax) is nil, so the above is equivalent to
(when (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))))))
Aka (modify-syntax-entry cc "_" table), since it accepts the same "cons
to represent a range" convention ;-)
Stefan
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#9511
; Package
emacs
.
(Thu, 15 Sep 2011 14:10:03 GMT)
Full text and
rfc822 format available.
Message #11 received at 9511 <at> debbugs.gnu.org (full text, mbox):
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)))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#9511
; Package
emacs
.
(Thu, 12 Apr 2012 19:55:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 9511 <at> debbugs.gnu.org (full text, mbox):
Masatake YAMATO <yamato <at> redhat.com> writes:
> 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.
Isn't this virtually the same as `M-f'/`M-b' in most cases?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog http://lars.ingebrigtsen.no/
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#9511
; Package
emacs
.
(Fri, 13 Apr 2012 01:32:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 9511 <at> debbugs.gnu.org (full text, mbox):
Lars Magne Ingebrigtsen <larsi <at> gnus.org> writes:
> Masatake YAMATO <yamato <at> redhat.com> writes:
>
>> 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.
>
> Isn't this virtually the same as `M-f'/`M-b' in most cases?
M-f / M-b captures periods used in extension(suffix).
Consider
/tmp/foo.el<point>
If you type M-b, you will see
/tmp/foo.<point>el
What I want with M-C-b is
/tmp/<point>foo.el
I think read-file-name should know path separator defined by underlying
operating system.
Masatake YAMATO
> --
> (domestic pets only, the antidote for overdose, milk.)
> bloggy blog http://lars.ingebrigtsen.no/
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#9511
; Package
emacs
.
(Fri, 13 Apr 2012 21:38:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 9511 <at> debbugs.gnu.org (full text, mbox):
Masatake YAMATO <yamato <at> redhat.com> writes:
> Consider
>
> /tmp/foo.el<point>
>
> If you type M-b, you will see
>
> /tmp/foo.<point>el
>
> What I want with M-C-b is
>
> /tmp/<point>foo.el
Yeah, that seems useful. I'm applying your patch with some white-space
cleanups.
--
(domestic pets only, the antidote for overdose, milk.)
http://lars.ingebrigtsen.no * Sent from my Rome
Added tag(s) fixed.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Fri, 13 Apr 2012 21:46:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 24.2, send any further explanations to
9511 <at> debbugs.gnu.org and Masatake YAMATO <yamato <at> redhat.com>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Fri, 13 Apr 2012 21:46:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 12 May 2012 11:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 13 years and 92 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.