aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2014-02-28 18:31:05 -0800
committerGlenn Morris2014-02-28 18:31:05 -0800
commitb829360f5052d532a00f4693f9ca6494a348449e (patch)
tree4a69d121129eaabef08afa3cd76e6730387a20ce
parent5c410a9b800eeb93c58945dec0387697108ad5e2 (diff)
downloademacs-b829360f5052d532a00f4693f9ca6494a348449e.tar.gz
emacs-b829360f5052d532a00f4693f9ca6494a348449e.zip
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.
-rw-r--r--lisp/ChangeLog11
-rw-r--r--lisp/comint.el11
-rw-r--r--lisp/eshell/em-hist.el3
-rw-r--r--lisp/filecache.el4
-rw-r--r--lisp/minibuffer.el60
-rw-r--r--lisp/tempo.el16
6 files changed, 65 insertions, 40 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 97fef60ee8c..2da420c0015 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,14 @@
12014-03-01 Glenn Morris <rgm@gnu.org>
2
3 * minibuffer.el (completion-hilit-commonality):
4 Make `base-size' argument optional. Short-cut if `prefix-len' is 0.
5 * comint.el (comint-dynamic-list-completions): Doc fix.
6 * comint.el (comint-dynamic-list-completions):
7 * filecache.el (file-cache-minibuffer-complete):
8 * tempo.el (tempo-display-completions):
9 * eshell/em-hist.el (eshell-list-history):
10 Replace use of obsolete argument of display-completion-list.
11
12014-03-01 Juanma Barranquero <lekktu@gmail.com> 122014-03-01 Juanma Barranquero <lekktu@gmail.com>
2 13
3 * icomplete.el (icomplete-completions): 14 * icomplete.el (icomplete-completions):
diff --git a/lisp/comint.el b/lisp/comint.el
index 8faa5243a11..76b1d803877 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -3274,8 +3274,12 @@ See also `comint-dynamic-complete-filename'."
3274 3274
3275(defun comint-dynamic-list-completions (completions &optional common-substring) 3275(defun comint-dynamic-list-completions (completions &optional common-substring)
3276 "Display a list of sorted COMPLETIONS. 3276 "Display a list of sorted COMPLETIONS.
3277The meaning of COMMON-SUBSTRING is the same as in `display-completion-list'. 3277Typing SPC flushes the completions buffer.
3278Typing SPC flushes the completions buffer." 3278
3279The optional argument COMMON-SUBSTRING, if non-nil, should be a string
3280specifying a common substring for adding the faces
3281`completions-first-difference' and `completions-common-part' to
3282the completions."
3279 (let ((window (get-buffer-window "*Completions*" 0))) 3283 (let ((window (get-buffer-window "*Completions*" 0)))
3280 (setq completions (sort completions 'string-lessp)) 3284 (setq completions (sort completions 'string-lessp))
3281 (if (and (eq last-command this-command) 3285 (if (and (eq last-command this-command)
@@ -3306,7 +3310,8 @@ Typing SPC flushes the completions buffer."
3306 (setq comint-dynamic-list-completions-config 3310 (setq comint-dynamic-list-completions-config
3307 (current-window-configuration)) 3311 (current-window-configuration))
3308 (with-output-to-temp-buffer "*Completions*" 3312 (with-output-to-temp-buffer "*Completions*"
3309 (display-completion-list completions common-substring)) 3313 (display-completion-list
3314 (completion-hilit-commonality completions (length common-substring))))
3310 (if (window-minibuffer-p) 3315 (if (window-minibuffer-p)
3311 (minibuffer-message "Type space to flush; repeat completion command to scroll") 3316 (minibuffer-message "Type space to flush; repeat completion command to scroll")
3312 (message "Type space to flush; repeat completion command to scroll"))) 3317 (message "Type space to flush; repeat completion command to scroll")))
diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el
index ec3cc8e1626..b721b5d8485 100644
--- a/lisp/eshell/em-hist.el
+++ b/lisp/eshell/em-hist.el
@@ -509,7 +509,8 @@ See also `eshell-read-history'."
509 ;; Change "completion" to "history reference" 509 ;; Change "completion" to "history reference"
510 ;; to make the display accurate. 510 ;; to make the display accurate.
511 (with-output-to-temp-buffer history-buffer 511 (with-output-to-temp-buffer history-buffer
512 (display-completion-list history prefix) 512 (display-completion-list
513 (completion-hilit-commonality history (length prefix)))
513 (set-buffer history-buffer) 514 (set-buffer history-buffer)
514 (forward-line 3) 515 (forward-line 3)
515 (while (search-backward "completion" nil 'move) 516 (while (search-backward "completion" nil 'move)
diff --git a/lisp/filecache.el b/lisp/filecache.el
index 802308b59c6..7d12517fcc3 100644
--- a/lisp/filecache.el
+++ b/lisp/filecache.el
@@ -613,7 +613,9 @@ the name is considered already unique; only the second substitution
613 (append completion-setup-hook 613 (append completion-setup-hook
614 (list 'file-cache-completion-setup-function)))) 614 (list 'file-cache-completion-setup-function))))
615 (with-output-to-temp-buffer file-cache-completions-buffer 615 (with-output-to-temp-buffer file-cache-completions-buffer
616 (display-completion-list completion-list string)))) 616 (display-completion-list
617 (completion-hilit-commonality completion-list
618 (length string))))))
617 (setq file-cache-string (file-cache-file-name completion-string)) 619 (setq file-cache-string (file-cache-file-name completion-string))
618 (if (string= file-cache-string (minibuffer-contents)) 620 (if (string= file-cache-string (minibuffer-contents))
619 (minibuffer-message file-cache-sole-match-message) 621 (minibuffer-message file-cache-sole-match-message)
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index c888721fb49..63e7e145d10 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -1586,7 +1586,7 @@ less visible than normal, so that the differing parts are emphasized
1586by contrast. 1586by contrast.
1587See also the face `completions-first-difference'.") 1587See also the face `completions-first-difference'.")
1588 1588
1589(defun completion-hilit-commonality (completions prefix-len base-size) 1589(defun completion-hilit-commonality (completions prefix-len &optional base-size)
1590 "Apply font-lock highlighting to a list of completions, COMPLETIONS. 1590 "Apply font-lock highlighting to a list of completions, COMPLETIONS.
1591PREFIX-LEN is an integer. BASE-SIZE is an integer or nil (meaning zero). 1591PREFIX-LEN is an integer. BASE-SIZE is an integer or nil (meaning zero).
1592 1592
@@ -1597,34 +1597,36 @@ This adds the face `completions-common-part' to the first
1597It returns a list with font-lock properties applied to each element, 1597It returns a list with font-lock properties applied to each element,
1598and with BASE-SIZE appended as the last element." 1598and with BASE-SIZE appended as the last element."
1599 (when completions 1599 (when completions
1600 (let ((com-str-len (- prefix-len (or base-size 0)))) 1600 (if (zerop prefix-len)
1601 (nconc 1601 completions
1602 (mapcar 1602 (let ((com-str-len (- prefix-len (or base-size 0))))
1603 (lambda (elem) 1603 (nconc
1604 (let ((str 1604 (mapcar
1605 ;; Don't modify the string itself, but a copy, since the 1605 (lambda (elem)
1606 ;; the string may be read-only or used for other purposes. 1606 (let ((str
1607 ;; Furthermore, since `completions' may come from 1607 ;; Don't modify the string itself, but a copy, since the
1608 ;; display-completion-list, `elem' may be a list. 1608 ;; the string may be read-only or used for other purposes.
1609 (if (consp elem) 1609 ;; Furthermore, since `completions' may come from
1610 (car (setq elem (cons (copy-sequence (car elem)) 1610 ;; display-completion-list, `elem' may be a list.
1611 (cdr elem)))) 1611 (if (consp elem)
1612 (setq elem (copy-sequence elem))))) 1612 (car (setq elem (cons (copy-sequence (car elem))
1613 (font-lock-prepend-text-property 1613 (cdr elem))))
1614 0 1614 (setq elem (copy-sequence elem)))))
1615 ;; If completion-boundaries returns incorrect 1615 (font-lock-prepend-text-property
1616 ;; values, all-completions may return strings 1616 0
1617 ;; that don't contain the prefix. 1617 ;; If completion-boundaries returns incorrect
1618 (min com-str-len (length str)) 1618 ;; values, all-completions may return strings
1619 'face 'completions-common-part str) 1619 ;; that don't contain the prefix.
1620 (if (> (length str) com-str-len) 1620 (min com-str-len (length str))
1621 (font-lock-prepend-text-property com-str-len (1+ com-str-len) 1621 'face 'completions-common-part str)
1622 'face 1622 (if (> (length str) com-str-len)
1623 'completions-first-difference 1623 (font-lock-prepend-text-property com-str-len (1+ com-str-len)
1624 str))) 1624 'face
1625 elem) 1625 'completions-first-difference
1626 completions) 1626 str)))
1627 base-size)))) 1627 elem)
1628 completions)
1629 base-size)))))
1628 1630
1629(defun display-completion-list (completions &optional common-substring) 1631(defun display-completion-list (completions &optional common-substring)
1630 "Display the list of completions, COMPLETIONS, using `standard-output'. 1632 "Display the list of completions, COMPLETIONS, using `standard-output'.
diff --git a/lisp/tempo.el b/lisp/tempo.el
index 9ff7a49146d..9b6cd75b313 100644
--- a/lisp/tempo.el
+++ b/lisp/tempo.el
@@ -2,9 +2,9 @@
2 2
3;; Copyright (C) 1994-1995, 2001-2014 Free Software Foundation, Inc. 3;; Copyright (C) 1994-1995, 2001-2014 Free Software Foundation, Inc.
4 4
5;; Author: David K}gedal <davidk@lysator.liu.se> 5;; Author: David Kågedal <davidk@lysator.liu.se>
6;; Created: 16 Feb 1994 6;; Created: 16 Feb 1994
7;; K}gedal's last version number: 1.2.4 7;; Kågedal's last version number: 1.2.4
8;; Keywords: extensions, languages, tools 8;; Keywords: extensions, languages, tools
9 9
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
@@ -723,13 +723,13 @@ non-nil, a buffer containing possible completions is displayed."
723 (if tempo-leave-completion-buffer 723 (if tempo-leave-completion-buffer
724 (with-output-to-temp-buffer "*Completions*" 724 (with-output-to-temp-buffer "*Completions*"
725 (display-completion-list 725 (display-completion-list
726 (all-completions string tag-list) 726 (completion-hilit-commonality (all-completions string tag-list)
727 string)) 727 (length string))))
728 (save-window-excursion 728 (save-window-excursion
729 (with-output-to-temp-buffer "*Completions*" 729 (with-output-to-temp-buffer "*Completions*"
730 (display-completion-list 730 (display-completion-list
731 (all-completions string tag-list) 731 (completion-hilit-commonality (all-completions string tag-list)
732 string)) 732 (length string))))
733 (sit-for 32767)))) 733 (sit-for 32767))))
734 734
735;;; 735;;;
@@ -763,3 +763,7 @@ space bar, and looks something like this:
763(provide 'tempo) 763(provide 'tempo)
764 764
765;;; tempo.el ends here 765;;; tempo.el ends here
766
767;; Local Variables:
768;; coding: utf-8
769;; End: