From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Masatake YAMATO Newsgroups: gmane.emacs.bugs Subject: bug#9511: Moving the point to / with C-M-f and C-M-b when reading a filename from minibuffer Date: Thu, 15 Sep 2011 17:39:06 +0900 (JST) Organization: Red Hat Japan, Inc. Message-ID: <20110915.173906.185902603333825732.yamato@redhat.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1316075980 31879 80.91.229.12 (15 Sep 2011 08:39:40 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 15 Sep 2011 08:39:40 +0000 (UTC) To: 9511@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Sep 15 10:39:32 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R47Tm-0003aW-Q1 for geb-bug-gnu-emacs@m.gmane.org; Thu, 15 Sep 2011 10:39:31 +0200 Original-Received: from localhost ([::1]:52487 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R47Tl-00048X-QC for geb-bug-gnu-emacs@m.gmane.org; Thu, 15 Sep 2011 04:39:29 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:35876) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R47Ti-00047k-RF for bug-gnu-emacs@gnu.org; Thu, 15 Sep 2011 04:39:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R47Th-0001lz-LD for bug-gnu-emacs@gnu.org; Thu, 15 Sep 2011 04:39:26 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:39415) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R47Th-0001lv-Je for bug-gnu-emacs@gnu.org; Thu, 15 Sep 2011 04:39:25 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1R47YA-0008GY-IZ; Thu, 15 Sep 2011 04:44:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Masatake YAMATO Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 15 Sep 2011 08:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 9511 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.131607623831756 (code B ref -1); Thu, 15 Sep 2011 08:44:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 15 Sep 2011 08:43:58 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R47Y6-0008G9-8P for submit@debbugs.gnu.org; Thu, 15 Sep 2011 04:43:58 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R47Y1-0008G0-Vo for submit@debbugs.gnu.org; Thu, 15 Sep 2011 04:43:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R47TX-0001kl-Mf for submit@debbugs.gnu.org; Thu, 15 Sep 2011 04:39:16 -0400 Original-Received: from lists.gnu.org ([140.186.70.17]:36494) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R47TX-0001kh-LE for submit@debbugs.gnu.org; Thu, 15 Sep 2011 04:39:15 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:35828) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R47TT-000474-G8 for bug-gnu-emacs@gnu.org; Thu, 15 Sep 2011 04:39:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R47TS-0001i7-4n for bug-gnu-emacs@gnu.org; Thu, 15 Sep 2011 04:39:11 -0400 Original-Received: from mx1.redhat.com ([209.132.183.28]:56620) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R47TR-0001gh-Sf for bug-gnu-emacs@gnu.org; Thu, 15 Sep 2011 04:39:10 -0400 Original-Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p8F8d86m002193 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 15 Sep 2011 04:39:08 -0400 Original-Received: from localhost (beach.nrt.redhat.com [10.64.200.71]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p8F8d7Oq018533 for ; Thu, 15 Sep 2011 04:39:07 -0400 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Thu, 15 Sep 2011 04:44:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:51180 Archived-At: 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 * 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)))