diff options
| author | Stefan Monnier | 2009-11-25 04:59:02 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2009-11-25 04:59:02 +0000 |
| commit | fe4346f0da7e8cc578eb60813bfc8e4e36c62c34 (patch) | |
| tree | 2ecbcd0f3d9fc17008e672c6ae6e9c168361f9a2 | |
| parent | cb190d7d5f3a63086e3f28981ca175945305a3c0 (diff) | |
| download | emacs-fe4346f0da7e8cc578eb60813bfc8e4e36c62c34.tar.gz emacs-fe4346f0da7e8cc578eb60813bfc8e4e36c62c34.zip | |
(abbrev--before-point): Use word-motion functions
if :regexp is not specified (bug#5031).
| -rw-r--r-- | lisp/ChangeLog | 3 | ||||
| -rw-r--r-- | lisp/abbrev.el | 18 |
2 files changed, 16 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d02dbadd9ca..3049fbea5f0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | 2009-11-25 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2009-11-25 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * abbrev.el (abbrev--before-point): Use word-motion functions | ||
| 4 | if :regexp is not specified (bug#5031). | ||
| 5 | |||
| 3 | * subr.el (string-prefix-p): New function. | 6 | * subr.el (string-prefix-p): New function. |
| 4 | 7 | ||
| 5 | * man.el (Man-completion-cache): New var. | 8 | * man.el (Man-completion-cache): New var. |
diff --git a/lisp/abbrev.el b/lisp/abbrev.el index 88c87dafa77..91c510694b0 100644 --- a/lisp/abbrev.el +++ b/lisp/abbrev.el | |||
| @@ -671,11 +671,19 @@ then ABBREV is looked up in that table only." | |||
| 671 | (setq tables (append (abbrev-table-get table :parents) tables)) | 671 | (setq tables (append (abbrev-table-get table :parents) tables)) |
| 672 | (setq res | 672 | (setq res |
| 673 | (and (or (not enable-fun) (funcall enable-fun)) | 673 | (and (or (not enable-fun) (funcall enable-fun)) |
| 674 | (looking-back (or (abbrev-table-get table :regexp) | 674 | (let ((re (abbrev-table-get table :regexp))) |
| 675 | "\\<\\(\\w+\\)\\W*") | 675 | (if (null re) |
| 676 | (line-beginning-position)) | 676 | ;; We used to default `re' to "\\<\\(\\w+\\)\\W*" |
| 677 | (setq start (match-beginning 1)) | 677 | ;; but when words-include-escapes is set, that |
| 678 | (setq end (match-end 1)) | 678 | ;; is not right and fixing it is boring. |
| 679 | (let ((lim (point))) | ||
| 680 | (backward-word 1) | ||
| 681 | (setq start (point)) | ||
| 682 | (forward-word 1) | ||
| 683 | (setq end (min (point) lim))) | ||
| 684 | (when (looking-back re (line-beginning-position)) | ||
| 685 | (setq start (match-beginning 1)) | ||
| 686 | (setq end (match-end 1))))) | ||
| 679 | (setq name (buffer-substring start end)) | 687 | (setq name (buffer-substring start end)) |
| 680 | (let ((abbrev (abbrev-symbol name table))) | 688 | (let ((abbrev (abbrev-symbol name table))) |
| 681 | (when abbrev | 689 | (when abbrev |