[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r107591: * lisp/dabbrev.el: Fix cycle
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r107591: * lisp/dabbrev.el: Fix cycle completion order. |
Date: |
Mon, 12 Mar 2012 16:07:45 -0400 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 107591
fixes bug(s): http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10963
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Mon 2012-03-12 16:07:45 -0400
message:
* lisp/dabbrev.el: Fix cycle completion order.
(dabbrev--last-obarray, dabbrev--last-completion-buffer): Remove.
(dabbrev-completion): Don't use an obarray; provide
a cycle-sort-function.
modified:
lisp/ChangeLog
lisp/dabbrev.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-03-12 18:21:35 +0000
+++ b/lisp/ChangeLog 2012-03-12 20:07:45 +0000
@@ -1,3 +1,10 @@
+2012-03-12 Stefan Monnier <address@hidden>
+
+ * dabbrev.el: Fix cycle completion order (bug#10963).
+ (dabbrev--last-obarray, dabbrev--last-completion-buffer): Remove.
+ (dabbrev-completion): Don't use an obarray; provide
+ a cycle-sort-function.
+
2012-03-12 Leo Liu <address@hidden>
* simple.el (kill-new): Use equal-including-properties for
=== modified file 'lisp/dabbrev.el'
--- a/lisp/dabbrev.el 2012-03-12 13:03:10 +0000
+++ b/lisp/dabbrev.el 2012-03-12 20:07:45 +0000
@@ -291,9 +291,6 @@
;; Internal variables
;;----------------------------------------------------------------
-;; Last obarray of completions in `dabbrev-completion'
-(defvar dabbrev--last-obarray nil)
-
;; Table of expansions seen so far
(defvar dabbrev--last-table nil)
@@ -321,9 +318,6 @@
;; The buffer we found the expansion last time.
(defvar dabbrev--last-buffer-found nil)
-;; The buffer we last did a completion in.
-(defvar dabbrev--last-completion-buffer nil)
-
;; If non-nil, a function to use when copying successive words.
;; It should be `upcase' or `downcase'.
(defvar dabbrev--last-case-pattern nil)
@@ -393,47 +387,39 @@
dabbrev-case-fold-search)
(or (not dabbrev-upcase-means-case-search)
(string= abbrev (downcase abbrev)))))
- (my-obarray dabbrev--last-obarray)
+ (list 'uninitialized)
(table
- (completion-table-dynamic
- (let ((initialized nil))
- (lambda (abbrev)
- (unless initialized
- (setq initialized t)
- (save-excursion
- ;;--------------------------------
- ;; New abbreviation to expand.
- ;;--------------------------------
- (setq dabbrev--last-abbreviation abbrev)
- ;; Find all expansion
- (let ((completion-list
- (dabbrev--find-all-expansions abbrev ignore-case-p))
- (completion-ignore-case ignore-case-p))
- ;; Make an obarray with all expansions
- (setq my-obarray (make-vector (length completion-list) 0))
- (or (> (length my-obarray) 0)
- (error "No dynamic expansion for \"%s\" found%s"
- abbrev
- (if dabbrev--check-other-buffers
- "" " in this-buffer")))
- (cond
- ((not (and ignore-case-p
- dabbrev-case-replace))
- (dolist (string completion-list)
- (intern string my-obarray)))
- ((string= abbrev (upcase abbrev))
- (dolist (string completion-list)
- (intern (upcase string) my-obarray)))
- ((string= (substring abbrev 0 1)
- (upcase (substring abbrev 0 1)))
- (dolist (string completion-list)
- (intern (capitalize string) my-obarray)))
- (t
- (dolist (string completion-list)
- (intern (downcase string) my-obarray))))
- (setq dabbrev--last-obarray my-obarray)
- (setq dabbrev--last-completion-buffer (current-buffer)))))
- my-obarray)))))
+ (lambda (s p a)
+ (if (eq a 'metadata)
+ `(metadata (cycle-sort-function . ,#'identity)
+ (category . dabbrev))
+ (when (eq list 'uninitialized)
+ (save-excursion
+ ;;--------------------------------
+ ;; New abbreviation to expand.
+ ;;--------------------------------
+ (setq dabbrev--last-abbreviation abbrev)
+ ;; Find all expansion
+ (let ((completion-list
+ (dabbrev--find-all-expansions abbrev ignore-case-p))
+ (completion-ignore-case ignore-case-p))
+ (or (consp completion-list)
+ (error "No dynamic expansion for \"%s\" found%s"
+ abbrev
+ (if dabbrev--check-other-buffers
+ "" " in this-buffer")))
+ (setq list
+ (cond
+ ((not (and ignore-case-p dabbrev-case-replace))
+ completion-list)
+ ((string= abbrev (upcase abbrev))
+ (mapcar #'upcase completion-list))
+ ((string= (substring abbrev 0 1)
+ (upcase (substring abbrev 0 1)))
+ (mapcar #'capitalize completion-list))
+ (t
+ (mapcar #'downcase completion-list)))))))
+ (complete-with-action a list s p)))))
(completion-in-region beg end table)))
;;;###autoload
@@ -627,8 +613,6 @@
(defun dabbrev--reset-global-variables ()
"Initialize all global variables."
- ;; dabbrev--last-obarray and dabbrev--last-completion-buffer
- ;; must not be reset here.
(setq dabbrev--last-table nil
dabbrev--last-abbreviation nil
dabbrev--last-abbrev-location nil
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r107591: * lisp/dabbrev.el: Fix cycle completion order.,
Stefan Monnier <=