# HG changeset patch # User Richard M. Stallman # Date 1100624919 0 # Node ID 98c7fc5c718b7b639e1cb11a48f3e15f05749f7f # Parent 803b8e8a1c6d7aa978dfa47526ab96114bad6823 (dabbrev-expand): When handling SPC M-/, temporarily widen before finding the following word to copy. diff -r 803b8e8a1c6d -r 98c7fc5c718b lisp/dabbrev.el --- a/lisp/dabbrev.el Tue Nov 16 17:06:56 2004 +0000 +++ b/lisp/dabbrev.el Tue Nov 16 17:08:39 2004 +0000 @@ -516,25 +516,27 @@ ;; The "abbrev" to expand is just the space. (setq abbrev " ") (save-excursion - (if dabbrev--last-buffer - (set-buffer dabbrev--last-buffer)) - ;; Find the end of the last "expansion" word. - (if (or (eq dabbrev--last-direction 1) - (and (eq dabbrev--last-direction 0) - (< dabbrev--last-expansion-location (point)))) - (setq dabbrev--last-expansion-location - (+ dabbrev--last-expansion-location - (length dabbrev--last-expansion)))) - (goto-char dabbrev--last-expansion-location) - ;; Take the following word, with intermediate separators, - ;; as our expansion this time. - (re-search-forward - (concat "\\(?:" dabbrev--abbrev-char-regexp "\\)+")) - (setq expansion (buffer-substring-no-properties - dabbrev--last-expansion-location (point))) + (save-restriction + (widen) + (if dabbrev--last-buffer + (set-buffer dabbrev--last-buffer)) + ;; Find the end of the last "expansion" word. + (if (or (eq dabbrev--last-direction 1) + (and (eq dabbrev--last-direction 0) + (< dabbrev--last-expansion-location (point)))) + (setq dabbrev--last-expansion-location + (+ dabbrev--last-expansion-location + (length dabbrev--last-expansion)))) + (goto-char dabbrev--last-expansion-location) + ;; Take the following word, with intermediate separators, + ;; as our expansion this time. + (re-search-forward + (concat "\\(?:" dabbrev--abbrev-char-regexp "\\)+")) + (setq expansion (buffer-substring-no-properties + dabbrev--last-expansion-location (point))) - ;; Record the end of this expansion, in case we repeat this. - (setq dabbrev--last-expansion-location (point))) + ;; Record the end of this expansion, in case we repeat this. + (setq dabbrev--last-expansion-location (point)))) ;; Indicate that dabbrev--last-expansion-location is ;; at the end of the expansion. (setq dabbrev--last-direction -1))