Mercurial > emacs
comparison lisp/abbrev.el @ 106233:13733fc37569
(abbrev--before-point): Use word-motion functions
if :regexp is not specified (bug#5031).
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Wed, 25 Nov 2009 04:59:02 +0000 |
parents | 42ca82b4620b |
children | 1d1d5d9bd884 |
comparison
equal
deleted
inserted
replaced
106232:f44541b1d13c | 106233:13733fc37569 |
---|---|
669 (let* ((table (pop tables)) | 669 (let* ((table (pop tables)) |
670 (enable-fun (abbrev-table-get table :enable-function))) | 670 (enable-fun (abbrev-table-get table :enable-function))) |
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 |
682 (setq enable-fun (abbrev-get abbrev :enable-function)) | 690 (setq enable-fun (abbrev-get abbrev :enable-function)) |
683 (and (or (not enable-fun) (funcall enable-fun)) | 691 (and (or (not enable-fun) (funcall enable-fun)) |