[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs/lisp ChangeLog dabbrev.el
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] emacs/lisp ChangeLog dabbrev.el |
Date: |
Wed, 25 Nov 2009 05:31:09 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Stefan Monnier <monnier> 09/11/25 05:31:08
Modified files:
lisp : ChangeLog dabbrev.el
Log message:
(dabbrev--minibuffer-origin): Use minibuffer-selected-window.
(dabbrev-completion): Use completion-in-region.
(dabbrev--abbrev-at-point): Simplify regexp.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.16727&r2=1.16728
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/dabbrev.el?cvsroot=emacs&r1=1.96&r2=1.97
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.16727
retrieving revision 1.16728
diff -u -b -r1.16727 -r1.16728
--- ChangeLog 25 Nov 2009 04:59:02 -0000 1.16727
+++ ChangeLog 25 Nov 2009 05:31:05 -0000 1.16728
@@ -1,5 +1,9 @@
2009-11-25 Stefan Monnier <address@hidden>
+ * dabbrev.el (dabbrev--minibuffer-origin): Use
minibuffer-selected-window.
+ (dabbrev-completion): Use completion-in-region.
+ (dabbrev--abbrev-at-point): Simplify regexp.
+
* abbrev.el (abbrev--before-point): Use word-motion functions
if :regexp is not specified (bug#5031).
Index: dabbrev.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/dabbrev.el,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -b -r1.96 -r1.97
--- dabbrev.el 13 Nov 2009 22:19:50 -0000 1.96
+++ dabbrev.el 25 Nov 2009 05:31:08 -0000 1.97
@@ -341,9 +341,9 @@
;; Macros
;;----------------------------------------------------------------
-;;; Get the buffer that mini-buffer was activated from
(defsubst dabbrev--minibuffer-origin ()
- (car (cdr (buffer-list))))
+ "Get the buffer from which mini-buffer."
+ (window-buffer (minibuffer-selected-window)))
;; Make a list of some of the elements of LIST.
;; Check each element of LIST, storing it temporarily in the
@@ -364,7 +364,7 @@
;;----------------------------------------------------------------
;;;###autoload (define-key esc-map "/" 'dabbrev-expand)
-;;;??? Do we want this?
+;;??? Do we want this?
;;;###autoload (define-key esc-map [?\C-/] 'dabbrev-completion)
;;;###autoload
@@ -373,11 +373,11 @@
Like \\[dabbrev-expand] but finds all expansions in the current buffer
and presents suggestions for completion.
-With a prefix argument, it searches all buffers accepted by the
+With a prefix argument ARG, it searches all buffers accepted by the
function pointed out by `dabbrev-friend-buffer-function' to find the
completions.
-If the prefix argument is 16 (which comes from C-u C-u),
+If the prefix argument is 16 (which comes from \\[prefix-argument]
\\[prefix-argument]),
then it searches *all* buffers."
(interactive "*P")
(dabbrev--reset-global-variables)
@@ -385,6 +385,8 @@
(dabbrev-check-all-buffers
(and arg (= (prefix-numeric-value arg) 16)))
(abbrev (dabbrev--abbrev-at-point))
+ (beg (progn (search-backward abbrev) (point)))
+ (end (progn (search-forward abbrev) (point)))
(ignore-case-p (and (if (eq dabbrev-case-fold-search 'case-fold-search)
case-fold-search
dabbrev-case-fold-search)
@@ -427,32 +429,8 @@
(intern (downcase string) my-obarray)))
completion-list)))
(setq dabbrev--last-obarray my-obarray)
- (setq dabbrev--last-completion-buffer (current-buffer))
- ;; Find the longest common string.
- (setq init (try-completion abbrev my-obarray))))
- ;;--------------------------------
- ;; Let the user choose between the expansions
- ;;--------------------------------
- (or (stringp init)
- (setq init abbrev))
- (cond
- ;; * Replace string fragment with matched common substring completion.
- ((and (not (string-equal init ""))
- (not (string-equal (downcase init) (downcase abbrev))))
- (if (> (length (all-completions init my-obarray)) 1)
- (message "Repeat `%s' to see all completions"
- (key-description (this-command-keys)))
- (message "The only possible completion"))
- (dabbrev--substitute-expansion nil abbrev init nil))
- (t
- ;; * String is a common substring completion already. Make list.
- (message "Making completion list...")
- (with-output-to-temp-buffer "*Completions*"
- (display-completion-list (all-completions init my-obarray)
- init))
- (message "Making completion list...done")))
- (and (window-minibuffer-p (selected-window))
- (message nil))))
+ (setq dabbrev--last-completion-buffer (current-buffer))))
+ (completion-in-region beg end my-obarray)))
;;;###autoload
(defun dabbrev-expand (arg)
@@ -590,15 +568,15 @@
;; Local functions
;;----------------------------------------------------------------
-;;; Checks if OTHER-BUFFER has the same major mode as current buffer.
(defun dabbrev--same-major-mode-p (other-buffer)
+ "Check if OTHER-BUFFER has the same major mode as current buffer."
(eq major-mode
(with-current-buffer other-buffer
major-mode)))
-;;; Back over all abbrev type characters and then moves forward over
-;;; all skip characters.
(defun dabbrev--goto-start-of-abbrev ()
+ "Back over all abbrev type characters and then moves forward over
+all skip characters."
;; Move backwards over abbrev chars
(save-match-data
(when (> (point) (minibuffer-prompt-end))
@@ -614,8 +592,8 @@
(while (looking-at dabbrev-abbrev-skip-leading-regexp)
(forward-char 1)))))
-;;; Extract the symbol at point to serve as abbreviation.
(defun dabbrev--abbrev-at-point ()
+ "Extract the symbol at point to serve as abbreviation."
;; Check for error
(if (bobp)
(error "No possible abbreviation preceding point"))
@@ -630,10 +608,8 @@
(save-match-data
(if (save-excursion
(forward-char -1)
- (not (looking-at (concat "\\("
- (or dabbrev-abbrev-char-regexp
- "\\sw\\|\\s_")
- "\\)+"))))
+ (not (looking-at (or dabbrev-abbrev-char-regexp
+ "\\sw\\|\\s_"))))
(if (re-search-backward (or dabbrev-abbrev-char-regexp
"\\sw\\|\\s_")
nil t)
@@ -644,8 +620,8 @@
(buffer-substring-no-properties
dabbrev--last-abbrev-location (point))))
-;;; Initializes all global variables
(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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs/lisp ChangeLog dabbrev.el,
Stefan Monnier <=