aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2004-03-26 15:19:39 +0000
committerStefan Monnier2004-03-26 15:19:39 +0000
commit2e27ed13abd927950d1dfc12fc45abfa5e3e9f0d (patch)
treec9da8236769c16ee015f6fb7b26dcd0a74061f58
parentff3d76aafc1e59374432914b8087097c886d7292 (diff)
downloademacs-2e27ed13abd927950d1dfc12fc45abfa5e3e9f0d.tar.gz
emacs-2e27ed13abd927950d1dfc12fc45abfa5e3e9f0d.zip
(dabbrev-expand): Fix regexp construction.
(dabbrev--find-expansion): Use pop. (dabbrev--search): Use match-string-no-properties.
-rw-r--r--lisp/dabbrev.el16
1 files changed, 5 insertions, 11 deletions
diff --git a/lisp/dabbrev.el b/lisp/dabbrev.el
index c9591950f50..3763f2ccab8 100644
--- a/lisp/dabbrev.el
+++ b/lisp/dabbrev.el
@@ -1,6 +1,6 @@
1;;; dabbrev.el --- dynamic abbreviation package 1;;; dabbrev.el --- dynamic abbreviation package
2 2
3;; Copyright (C) 1985, 86, 92, 94, 96, 1997, 2000, 01, 2003 3;; Copyright (C) 1985, 86, 92, 94, 96, 1997, 2000, 01, 03, 2004
4;; Free Software Foundation, Inc. 4;; Free Software Foundation, Inc.
5 5
6;; Author: Don Morrison 6;; Author: Don Morrison
@@ -529,7 +529,7 @@ See also `dabbrev-abbrev-char-regexp' and \\[dabbrev-completion]."
529 ;; Take the following word, with intermediate separators, 529 ;; Take the following word, with intermediate separators,
530 ;; as our expansion this time. 530 ;; as our expansion this time.
531 (re-search-forward 531 (re-search-forward
532 (concat "\\(\\(" dabbrev--abbrev-char-regexp "\\)+\\)")) 532 (concat "\\(?:" dabbrev--abbrev-char-regexp "\\)+"))
533 (setq expansion (buffer-substring-no-properties 533 (setq expansion (buffer-substring-no-properties
534 dabbrev--last-expansion-location (point))) 534 dabbrev--last-expansion-location (point)))
535 535
@@ -793,10 +793,7 @@ of the start of the occurrence."
793 ;; Walk through the buffers till we find a match. 793 ;; Walk through the buffers till we find a match.
794 (let (expansion) 794 (let (expansion)
795 (while (and (not expansion) dabbrev--friend-buffer-list) 795 (while (and (not expansion) dabbrev--friend-buffer-list)
796 (setq dabbrev--last-buffer 796 (setq dabbrev--last-buffer (pop dabbrev--friend-buffer-list))
797 (car dabbrev--friend-buffer-list))
798 (setq dabbrev--friend-buffer-list
799 (cdr dabbrev--friend-buffer-list))
800 (set-buffer dabbrev--last-buffer) 797 (set-buffer dabbrev--last-buffer)
801 (dabbrev--scanning-message) 798 (dabbrev--scanning-message)
802 (setq dabbrev--last-expansion-location (point-min)) 799 (setq dabbrev--last-expansion-location (point-min))
@@ -1000,8 +997,7 @@ Leaves point at the location of the start of the expansion."
1000 nil 997 nil
1001 ;; We have a truly valid match. Find the end. 998 ;; We have a truly valid match. Find the end.
1002 (re-search-forward pattern2) 999 (re-search-forward pattern2)
1003 (setq found-string (buffer-substring-no-properties 1000 (setq found-string (match-string-no-properties 0))
1004 (match-beginning 0) (match-end 0)))
1005 (setq result found-string) 1001 (setq result found-string)
1006 (and ignore-case (setq found-string (downcase found-string))) 1002 (and ignore-case (setq found-string (downcase found-string)))
1007 ;; Ignore this match if it's already in the table. 1003 ;; Ignore this match if it's already in the table.
@@ -1010,9 +1006,7 @@ Leaves point at the location of the start of the expansion."
1010 (string= found-string table-string)) 1006 (string= found-string table-string))
1011 (setq found-string nil))) 1007 (setq found-string nil)))
1012 ;; Prepare to continue searching. 1008 ;; Prepare to continue searching.
1013 (if reverse 1009 (goto-char (if reverse (match-beginning 0) (match-end 0))))
1014 (goto-char (match-beginning 0))
1015 (goto-char (match-end 0))))
1016 ;; If we found something, use it. 1010 ;; If we found something, use it.
1017 (when found-string 1011 (when found-string
1018 ;; Put it into `dabbrev--last-table' 1012 ;; Put it into `dabbrev--last-table'