emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r105991: * lisp/minibuffer.el (comple


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r105991: * lisp/minibuffer.el (completion-table-case-fold): Use currying.
Date: Mon, 03 Oct 2011 11:03:00 -0400
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 105991
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Mon 2011-10-03 11:03:00 -0400
message:
  * lisp/minibuffer.el (completion-table-case-fold): Use currying.
  (completion--styles-type, completion--cycling-threshold-type): New constants.
  (completion-styles, completion-category-overrides)
  (completion-cycle-threshold): Use them.
  * lisp/pcomplete.el (pcomplete-completions-at-point): Adjust call to
  completion-table-case-fold.
modified:
  lisp/ChangeLog
  lisp/minibuffer.el
  lisp/pcomplete.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-10-03 14:47:40 +0000
+++ b/lisp/ChangeLog    2011-10-03 15:03:00 +0000
@@ -1,3 +1,13 @@
+2011-10-03  Stefan Monnier  <address@hidden>
+
+       * minibuffer.el (completion-table-case-fold): Use currying.
+       (completion--styles-type, completion--cycling-threshold-type):
+       New constants.
+       (completion-styles, completion-category-overrides)
+       (completion-cycle-threshold): Use them.
+       * pcomplete.el (pcomplete-completions-at-point): Adjust call to
+       completion-table-case-fold.
+
 2011-10-03  Stephen Berman  <address@hidden>
 
        * minibuffer.el (completion-category-overrides): Fix type of styles

=== modified file 'lisp/minibuffer.el'
--- a/lisp/minibuffer.el        2011-10-03 14:47:40 +0000
+++ b/lisp/minibuffer.el        2011-10-03 15:03:00 +0000
@@ -216,9 +216,13 @@
           (setq ,var (,fun)))
         ,var))))
 
-(defun completion-table-case-fold (table string pred action)
-  (let ((completion-ignore-case t))
-    (complete-with-action action table string pred)))
+(defun completion-table-case-fold (table &optional dont-fold)
+  "Return new completion TABLE that is case insensitive.
+If DONT-FOLD is non-nil, return a completion table that is
+case sensitive instead."
+  (lambda (string pred action)
+    (let ((completion-ignore-case (not dont-fold)))
+      (complete-with-action action table string pred))))
 
 (defun completion-table-with-context (prefix table string pred action)
   ;; TODO: add `suffix' maybe?
@@ -468,6 +472,15 @@
 follow the calling convention of `completion-all-completions'),
 and DOC describes the way this style of completion works.")
 
+(defconst completion--styles-type
+  `(repeat :tag "insert a new menu to add more styles"
+           (choice ,@(mapcar (lambda (x) (list 'const (car x)))
+                             completion-styles-alist))))
+(defconst completion--cycling-threshold-type
+  '(choice (const :tag "No cycling" nil)
+           (const :tag "Always cycle" t)
+           (integer :tag "Threshold")))
+
 (defcustom completion-styles
   ;; First, use `basic' because prefix completion has been the standard
   ;; for "ever" and works well in most cases, so using it first
@@ -486,8 +499,7 @@
 
 Note that `completion-category-overrides' may override these
 styles for specific categories, such as files, buffers, etc."
-  :type `(repeat (choice ,@(mapcar (lambda (x) (list 'const (car x)))
-                                   completion-styles-alist)))
+  :type completion--styles-type
   :group 'minibuffer
   :version "23.1")
 
@@ -501,19 +513,16 @@
   :type `(alist :key-type (choice :tag "Category"
                                  (const buffer)
                                   (const file)
+                                  (const unicode-name)
                                   symbol)
           :value-type
           (set :tag "Properties to override"
           (cons :tag "Completion Styles"
                 (const :tag "Select a style from the menu;" styles)
-                (repeat :tag "insert a new menu to add more styles"
-                        (choice ,@(mapcar (lambda (x) (list 'const (car x)))
-                                          completion-styles-alist))))
+                ,completion--styles-type)
            (cons :tag "Completion Cycling"
                 (const :tag "Select one value from the menu." cycle)
-                 (choice (const :tag "No cycling" nil)
-                         (const :tag "Always cycle" t)
-                         (integer :tag "Threshold"))))))
+                 ,completion--cycling-threshold-type))))
 
 (defun completion--styles (metadata)
   (let* ((cat (completion-metadata-get metadata 'category))
@@ -599,9 +608,7 @@
 If t, cycling is always used.
 If an integer, cycling is used as soon as there are fewer completion
 candidates than this number."
-  :type '(choice (const :tag "No cycling" nil)
-          (const :tag "Always cycle" t)
-          (integer :tag "Threshold")))
+  :type completion--cycling-threshold-type)
 
 (defun completion--cycle-threshold (metadata)
   (let* ((cat (completion-metadata-get metadata 'category))

=== modified file 'lisp/pcomplete.el'
--- a/lisp/pcomplete.el 2011-10-02 04:08:50 +0000
+++ b/lisp/pcomplete.el 2011-10-03 15:03:00 +0000
@@ -523,8 +523,7 @@
                            (funcall norm-func (directory-file-name f))
                            seen)))))))
           (when pcomplete-ignore-case
-            (setq table
-                  (apply-partially #'completion-table-case-fold table)))
+            (setq table (completion-table-case-fold table)))
           (list beg (point) table
                 :predicate pred
                 :exit-function


reply via email to

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