emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/lisp ChangeLog files.el


From: Stefan Monnier
Subject: [Emacs-diffs] emacs/lisp ChangeLog files.el
Date: Fri, 04 Sep 2009 03:18:12 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Stefan Monnier <monnier>        09/09/04 03:18:11

Modified files:
        lisp           : ChangeLog files.el 

Log message:
        (locate-file-completion-table): Make it provide boundary
        information, so partial-completion works better.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.16094&r2=1.16095
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/files.el?cvsroot=emacs&r1=1.1075&r2=1.1076

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.16094
retrieving revision 1.16095
diff -u -b -r1.16094 -r1.16095
--- ChangeLog   4 Sep 2009 03:09:44 -0000       1.16094
+++ ChangeLog   4 Sep 2009 03:18:08 -0000       1.16095
@@ -1,3 +1,8 @@
+2009-09-04  Stefan Monnier  <address@hidden>
+
+       * files.el (locate-file-completion-table): Make it provide boundary
+       information, so partial-completion works better.
+
 2009-09-04  Leo  <address@hidden>  (tiny change)
 
        * mail/footnote.el (Footnote-text-under-cursor):

Index: files.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/files.el,v
retrieving revision 1.1075
retrieving revision 1.1076
diff -u -b -r1.1075 -r1.1076
--- files.el    29 Aug 2009 15:33:27 -0000      1.1075
+++ files.el    4 Sep 2009 03:18:11 -0000       1.1076
@@ -716,24 +716,34 @@
 
 (defun locate-file-completion-table (dirs suffixes string pred action)
   "Do completion for file names passed to `locate-file'."
-  (if (file-name-absolute-p string)
+  (cond
+   ((file-name-absolute-p string)
       (let ((read-file-name-predicate pred))
-        (read-file-name-internal string nil action))
+      (read-file-name-internal string nil action)))
+   ((eq (car-safe action) 'boundaries)
+    (let ((suffix (cdr action)))
+      (list* 'boundaries 
+             (length (file-name-directory string))
+             (let ((x (file-name-directory suffix)))
+               (if x (1- (length x)) (length suffix))))))
+   (t
     (let ((names nil)
          (suffix (concat (regexp-opt suffixes t) "\\'"))
-         (string-dir (file-name-directory string)))
+         (string-dir (file-name-directory string))
+          (string-file (file-name-nondirectory string)))
       (dolist (dir dirs)
        (unless dir
          (setq dir default-directory))
        (if string-dir (setq dir (expand-file-name string-dir dir)))
        (when (file-directory-p dir)
          (dolist (file (file-name-all-completions
-                        (file-name-nondirectory string) dir))
-           (add-to-list 'names (if string-dir (concat string-dir file) file))
+                        string-file dir))
+           (push file names)
            (when (string-match suffix file)
              (setq file (substring file 0 (match-beginning 0)))
-             (push (if string-dir (concat string-dir file) file) names)))))
-      (complete-with-action action names string pred))))
+              (push file names)))))
+      (completion-table-with-context
+       string-dir names string-file pred action)))))
 
 (defun locate-file-completion (string path-and-suffixes action)
   "Do completion for file names passed to `locate-file'.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]