emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r116618: Replace some uses of obsolete argument of d


From: Glenn Morris
Subject: [Emacs-diffs] trunk r116618: Replace some uses of obsolete argument of display-completion-list
Date: Sat, 01 Mar 2014 02:31:13 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 116618
revision-id: address@hidden
parent: address@hidden
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Fri 2014-02-28 18:31:05 -0800
message:
  Replace some uses of obsolete argument of display-completion-list
  
  * lisp/minibuffer.el (completion-hilit-commonality):
  Make `base-size' argument optional.  Short-cut if `prefix-len' is 0.
  
  * lisp/comint.el (comint-dynamic-list-completions): Doc fix.
  
  * lisp/comint.el (comint-dynamic-list-completions):
  * lisp/filecache.el (file-cache-minibuffer-complete):
  * lisp/tempo.el (tempo-display-completions):
  * lisp/eshell/em-hist.el (eshell-list-history):
  Replace use of obsolete argument of display-completion-list.
  
  * lisp/tempo.el: Use utf-8 for author name.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/comint.el                 comint.el-20091113204419-o5vbwnq5f7feedwu-149
  lisp/eshell/em-hist.el         emhist.el-20091113204419-o5vbwnq5f7feedwu-1857
  lisp/filecache.el              
filecache.el-20091113204419-o5vbwnq5f7feedwu-1191
  lisp/minibuffer.el             
minibuffer.el-20091113204419-o5vbwnq5f7feedwu-8622
  lisp/tempo.el                  tempo.el-20091113204419-o5vbwnq5f7feedwu-774
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-03-01 01:25:29 +0000
+++ b/lisp/ChangeLog    2014-03-01 02:31:05 +0000
@@ -1,3 +1,14 @@
+2014-03-01  Glenn Morris  <address@hidden>
+
+       * minibuffer.el (completion-hilit-commonality):
+       Make `base-size' argument optional.  Short-cut if `prefix-len' is 0.
+       * comint.el (comint-dynamic-list-completions): Doc fix.
+       * comint.el (comint-dynamic-list-completions):
+       * filecache.el (file-cache-minibuffer-complete):
+       * tempo.el (tempo-display-completions):
+       * eshell/em-hist.el (eshell-list-history):
+       Replace use of obsolete argument of display-completion-list.
+
 2014-03-01  Juanma Barranquero  <address@hidden>
 
        * icomplete.el (icomplete-completions):

=== modified file 'lisp/comint.el'
--- a/lisp/comint.el    2014-02-10 01:34:22 +0000
+++ b/lisp/comint.el    2014-03-01 02:31:05 +0000
@@ -3274,8 +3274,12 @@
 
 (defun comint-dynamic-list-completions (completions &optional common-substring)
   "Display a list of sorted COMPLETIONS.
-The meaning of COMMON-SUBSTRING is the same as in `display-completion-list'.
-Typing SPC flushes the completions buffer."
+Typing SPC flushes the completions buffer.
+
+The optional argument COMMON-SUBSTRING, if non-nil, should be a string
+specifying a common substring for adding the faces
+`completions-first-difference' and `completions-common-part' to
+the completions."
   (let ((window (get-buffer-window "*Completions*" 0)))
     (setq completions (sort completions 'string-lessp))
     (if (and (eq last-command this-command)
@@ -3306,7 +3310,8 @@
       (setq comint-dynamic-list-completions-config
            (current-window-configuration))
       (with-output-to-temp-buffer "*Completions*"
-       (display-completion-list completions common-substring))
+        (display-completion-list
+         (completion-hilit-commonality completions (length common-substring))))
       (if (window-minibuffer-p)
          (minibuffer-message "Type space to flush; repeat completion command 
to scroll")
        (message "Type space to flush; repeat completion command to scroll")))

=== modified file 'lisp/eshell/em-hist.el'
--- a/lisp/eshell/em-hist.el    2014-01-01 07:43:34 +0000
+++ b/lisp/eshell/em-hist.el    2014-03-01 02:31:05 +0000
@@ -509,7 +509,8 @@
        ;; Change "completion" to "history reference"
        ;; to make the display accurate.
        (with-output-to-temp-buffer history-buffer
-         (display-completion-list history prefix)
+         (display-completion-list
+          (completion-hilit-commonality history (length prefix)))
          (set-buffer history-buffer)
          (forward-line 3)
          (while (search-backward "completion" nil 'move)

=== modified file 'lisp/filecache.el'
--- a/lisp/filecache.el 2014-01-01 07:43:34 +0000
+++ b/lisp/filecache.el 2014-03-01 02:31:05 +0000
@@ -613,7 +613,9 @@
                      (append completion-setup-hook
                              (list 'file-cache-completion-setup-function))))
                (with-output-to-temp-buffer file-cache-completions-buffer
-                 (display-completion-list completion-list string))))
+                 (display-completion-list
+                   (completion-hilit-commonality completion-list
+                                                 (length string))))))
          (setq file-cache-string (file-cache-file-name completion-string))
          (if (string= file-cache-string (minibuffer-contents))
              (minibuffer-message file-cache-sole-match-message)

=== modified file 'lisp/minibuffer.el'
--- a/lisp/minibuffer.el        2014-02-28 05:29:45 +0000
+++ b/lisp/minibuffer.el        2014-03-01 02:31:05 +0000
@@ -1586,7 +1586,7 @@
 by contrast.
 See also the face `completions-first-difference'.")
 
-(defun completion-hilit-commonality (completions prefix-len base-size)
+(defun completion-hilit-commonality (completions prefix-len &optional 
base-size)
   "Apply font-lock highlighting to a list of completions, COMPLETIONS.
 PREFIX-LEN is an integer.  BASE-SIZE is an integer or nil (meaning zero).
 
@@ -1597,34 +1597,36 @@
 It returns a list with font-lock properties applied to each element,
 and with BASE-SIZE appended as the last element."
   (when completions
-    (let ((com-str-len (- prefix-len (or base-size 0))))
-      (nconc
-       (mapcar
-        (lambda (elem)
-          (let ((str
-                 ;; Don't modify the string itself, but a copy, since the
-                 ;; the string may be read-only or used for other purposes.
-                 ;; Furthermore, since `completions' may come from
-                 ;; display-completion-list, `elem' may be a list.
-                 (if (consp elem)
-                     (car (setq elem (cons (copy-sequence (car elem))
-                                           (cdr elem))))
-                   (setq elem (copy-sequence elem)))))
-            (font-lock-prepend-text-property
-             0
-             ;; If completion-boundaries returns incorrect
-             ;; values, all-completions may return strings
-             ;; that don't contain the prefix.
-             (min com-str-len (length str))
-             'face 'completions-common-part str)
-            (if (> (length str) com-str-len)
-                (font-lock-prepend-text-property com-str-len (1+ com-str-len)
-                                                 'face
-                                                 'completions-first-difference
-                                                 str)))
-          elem)
-        completions)
-       base-size))))
+    (if (zerop prefix-len)
+        completions
+      (let ((com-str-len (- prefix-len (or base-size 0))))
+        (nconc
+         (mapcar
+          (lambda (elem)
+            (let ((str
+                   ;; Don't modify the string itself, but a copy, since the
+                   ;; the string may be read-only or used for other purposes.
+                   ;; Furthermore, since `completions' may come from
+                   ;; display-completion-list, `elem' may be a list.
+                   (if (consp elem)
+                       (car (setq elem (cons (copy-sequence (car elem))
+                                             (cdr elem))))
+                     (setq elem (copy-sequence elem)))))
+              (font-lock-prepend-text-property
+               0
+               ;; If completion-boundaries returns incorrect
+               ;; values, all-completions may return strings
+               ;; that don't contain the prefix.
+               (min com-str-len (length str))
+               'face 'completions-common-part str)
+              (if (> (length str) com-str-len)
+                  (font-lock-prepend-text-property com-str-len (1+ com-str-len)
+                                                   'face
+                                                   
'completions-first-difference
+                                                   str)))
+            elem)
+          completions)
+         base-size)))))
 
 (defun display-completion-list (completions &optional common-substring)
   "Display the list of completions, COMPLETIONS, using `standard-output'.

=== modified file 'lisp/tempo.el'
--- a/lisp/tempo.el     2014-01-01 07:43:34 +0000
+++ b/lisp/tempo.el     2014-03-01 02:31:05 +0000
@@ -2,9 +2,9 @@
 
 ;; Copyright (C) 1994-1995, 2001-2014 Free Software Foundation, Inc.
 
-;; Author: David K}gedal <address@hidden>
+;; Author: David Kågedal <address@hidden>
 ;; Created: 16 Feb 1994
-;; K}gedal's last version number: 1.2.4
+;; Kågedal's last version number: 1.2.4
 ;; Keywords: extensions, languages, tools
 
 ;; This file is part of GNU Emacs.
@@ -723,13 +723,13 @@
   (if tempo-leave-completion-buffer
       (with-output-to-temp-buffer "*Completions*"
        (display-completion-list
-        (all-completions string tag-list)
-        string))
+        (completion-hilit-commonality (all-completions string tag-list)
+                                      (length string))))
     (save-window-excursion
       (with-output-to-temp-buffer "*Completions*"
        (display-completion-list
-        (all-completions string tag-list)
-        string))
+        (completion-hilit-commonality (all-completions string tag-list)
+                                      (length string))))
       (sit-for 32767))))
 
 ;;;
@@ -763,3 +763,7 @@
 (provide 'tempo)
 
 ;;; tempo.el ends here
+
+;; Local Variables:
+;; coding: utf-8
+;; End:


reply via email to

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