comparison lisp/dabbrev.el @ 91015:b83d0dadb2a7

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 857-865) - Update from CVS - Merge from emacs--rel--22 - Update from CVS: lisp/emacs-lisp/avl-tree.el: New file. - Remove RCS keywords * emacs--rel--22 (patch 97-100) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 246-247) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-252
author Miles Bader <miles@gnu.org>
date Wed, 29 Aug 2007 05:03:40 +0000
parents f55f9811f5d7 c865c404d660
children 606f2d163a64
comparison
equal deleted inserted replaced
91014:2392e6a45952 91015:b83d0dadb2a7
329 ;; Same as dabbrev-check-other-buffers, but is set for every expand. 329 ;; Same as dabbrev-check-other-buffers, but is set for every expand.
330 (defvar dabbrev--check-other-buffers dabbrev-check-other-buffers) 330 (defvar dabbrev--check-other-buffers dabbrev-check-other-buffers)
331 331
332 ;; The regexp for recognizing a character in an abbreviation. 332 ;; The regexp for recognizing a character in an abbreviation.
333 (defvar dabbrev--abbrev-char-regexp nil) 333 (defvar dabbrev--abbrev-char-regexp nil)
334
335 ;; The progress reporter for buffer-scanning progress.
336 (defvar dabbrev--progress-reporter nil)
334 337
335 ;;---------------------------------------------------------------- 338 ;;----------------------------------------------------------------
336 ;; Macros 339 ;; Macros
337 ;;---------------------------------------------------------------- 340 ;;----------------------------------------------------------------
338 341
709 (goto-char (point-min)) 712 (goto-char (point-min))
710 (while (setq expansion (dabbrev--find-expansion abbrev -1 ignore-case)) 713 (while (setq expansion (dabbrev--find-expansion abbrev -1 ignore-case))
711 (setq all-expansions (cons expansion all-expansions)))) 714 (setq all-expansions (cons expansion all-expansions))))
712 all-expansions)) 715 all-expansions))
713 716
714 (defun dabbrev--scanning-message ()
715 (unless (window-minibuffer-p (selected-window))
716 (message "Scanning `%s'" (buffer-name (current-buffer)))))
717
718 (defun dabbrev--ignore-buffer-p (buffer) 717 (defun dabbrev--ignore-buffer-p (buffer)
719 "Return non-nil if BUFFER should be ignored by dabbrev." 718 "Return non-nil if BUFFER should be ignored by dabbrev."
720 (let ((bn (buffer-name buffer))) 719 (let ((bn (buffer-name buffer)))
721 (or (member bn dabbrev-ignored-buffer-names) 720 (or (member bn dabbrev-ignored-buffer-names)
722 (let ((tail dabbrev-ignored-buffer-regexps) 721 (let ((tail dabbrev-ignored-buffer-regexps)
738 of the start of the occurrence." 737 of the start of the occurrence."
739 (save-excursion 738 (save-excursion
740 ;; If we were scanning something other than the current buffer, 739 ;; If we were scanning something other than the current buffer,
741 ;; continue scanning there. 740 ;; continue scanning there.
742 (when dabbrev--last-buffer 741 (when dabbrev--last-buffer
743 (set-buffer dabbrev--last-buffer) 742 (set-buffer dabbrev--last-buffer))
744 (dabbrev--scanning-message))
745 (or 743 (or
746 ;; ------------------------------------------ 744 ;; ------------------------------------------
747 ;; Look backward in current buffer. 745 ;; Look backward in current buffer.
748 ;; ------------------------------------------ 746 ;; ------------------------------------------
749 (and (not dabbrev-search-these-buffers-only) 747 (and (not dabbrev-search-these-buffers-only)
771 (setq dabbrev--last-direction -1) 769 (setq dabbrev--last-direction -1)
772 (unless dabbrev--last-buffer 770 (unless dabbrev--last-buffer
773 ;; If we have just now begun to search other buffers, 771 ;; If we have just now begun to search other buffers,
774 ;; determine which other buffers we should check. 772 ;; determine which other buffers we should check.
775 ;; Put that list in dabbrev--friend-buffer-list. 773 ;; Put that list in dabbrev--friend-buffer-list.
776 (or dabbrev--friend-buffer-list 774 (unless dabbrev--friend-buffer-list
777 (setq dabbrev--friend-buffer-list 775 (setq dabbrev--friend-buffer-list
778 (dabbrev--make-friend-buffer-list)))) 776 (dabbrev--make-friend-buffer-list))
777 (setq dabbrev--progress-reporter
778 (make-progress-reporter
779 "Scanning for dabbrevs..."
780 (- (length dabbrev--friend-buffer-list)) 0 0 1 1.5))))
779 ;; Walk through the buffers till we find a match. 781 ;; Walk through the buffers till we find a match.
780 (let (expansion) 782 (let (expansion)
781 (while (and (not expansion) dabbrev--friend-buffer-list) 783 (while (and (not expansion) dabbrev--friend-buffer-list)
782 (setq dabbrev--last-buffer (pop dabbrev--friend-buffer-list)) 784 (setq dabbrev--last-buffer (pop dabbrev--friend-buffer-list))
783 (set-buffer dabbrev--last-buffer) 785 (set-buffer dabbrev--last-buffer)
784 (dabbrev--scanning-message) 786 (progress-reporter-update dabbrev--progress-reporter
787 (- (length dabbrev--friend-buffer-list)))
785 (setq dabbrev--last-expansion-location (point-min)) 788 (setq dabbrev--last-expansion-location (point-min))
786 (setq expansion (dabbrev--try-find abbrev nil 1 ignore-case))) 789 (setq expansion (dabbrev--try-find abbrev nil 1 ignore-case)))
787 expansion))))) 790 expansion)))))
788 791
789 ;; Compute the list of buffers to scan. 792 ;; Compute the list of buffers to scan.