[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: syntax table in minibuffer
From: |
Masatake YAMATO |
Subject: |
Re: syntax table in minibuffer |
Date: |
Mon, 12 Sep 2011 16:47:15 +0900 (JST) |
From: Stefan Monnier <address@hidden>
Date: Fri, 09 Sep 2011 21:44:19 -0400
>> When emacs reading file name, I'd like to make the point in minibuffer
>> to "/", the file name separator, with \M-\C-b and \M-\C-f.
>> Do you want, too?
>
> I'm not sure I'd want that, but it does sound like a reasonable
> desire, yes.
>
>> In my knowledge, I have to modify syntax table for minibuffer for
>> doing that. However, I cannot find something link
>> `minibuffer-local-filename-syntax-table'.
>
>> Could you give me hints for that?
>
> I think you'll need to use minibuffer-with-setup-hook around the
> relevant completing-read so as to setup the syntax-table with
> set-syntax-table.
Thank you. I've implemented base on your hit.
New behaviors of \M-\C-f and \M-\C-b in \C-x\C-f are nice.
I'd like you to include this into the offcial emacs source tree.
We are in feature-freeze stage. What shoud I do?
Should I submit this to bug tracking system?
2011-09-12 Masatake YAMATO <address@hidden>
* 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-12 07:38:03 +0000
@@ -1997,6 +1997,24 @@
(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)))
+ (mapc
+ (lambda (c)
+ (modify-syntax-entry 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 +2083,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)))
- syntax table in minibuffer, Masatake YAMATO, 2011/09/09
- Re: syntax table in minibuffer, Stefan Monnier, 2011/09/09
- Re: syntax table in minibuffer,
Masatake YAMATO <=
- Re: syntax table in minibuffer, Stefan Monnier, 2011/09/13
- Re: syntax table in minibuffer, Masatake YAMATO, 2011/09/13
- Re: syntax table in minibuffer, Stefan Monnier, 2011/09/13
- Re: syntax table in minibuffer, Masatake YAMATO, 2011/09/15
- Re: syntax table in minibuffer, Stefan Monnier, 2011/09/15
- Re: syntax table in minibuffer, Masatake YAMATO, 2011/09/15