summaryrefslogtreecommitdiff
path: root/lisp/dabbrev.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2004-11-16 17:08:39 +0000
committerRichard M. Stallman <rms@gnu.org>2004-11-16 17:08:39 +0000
commitb9559a72b415ecc645ad1999e7f6d7f51828f4f1 (patch)
treeffb441e1c0936461729a90f06ebc5d804aaa8333 /lisp/dabbrev.el
parente7ea75456336aa6e4671829096b0264c54c2202a (diff)
downloademacs-b9559a72b415ecc645ad1999e7f6d7f51828f4f1.tar.gz
emacs-b9559a72b415ecc645ad1999e7f6d7f51828f4f1.tar.bz2
emacs-b9559a72b415ecc645ad1999e7f6d7f51828f4f1.zip
(dabbrev-expand): When handling SPC M-/,
temporarily widen before finding the following word to copy.
Diffstat (limited to 'lisp/dabbrev.el')
-rw-r--r--lisp/dabbrev.el40
1 files changed, 21 insertions, 19 deletions
diff --git a/lisp/dabbrev.el b/lisp/dabbrev.el
index 47ffba9873d..af310593124 100644
--- a/lisp/dabbrev.el
+++ b/lisp/dabbrev.el
@@ -516,25 +516,27 @@ See also `dabbrev-abbrev-char-regexp' and \\[dabbrev-completion]."
;; 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)))
-
- ;; Record the end of this expansion, in case we repeat this.
- (setq 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))))
;; Indicate that dabbrev--last-expansion-location is
;; at the end of the expansion.
(setq dabbrev--last-direction -1))