summaryrefslogtreecommitdiff
path: root/lisp/replace.el
diff options
context:
space:
mode:
authorRaimon Grau <raimonster@gmail.com>2018-12-10 01:42:41 +0200
committerJuri Linkov <juri@linkov.net>2018-12-10 01:42:41 +0200
commitee1ebe8246c333e9ca0e3454f357d12c713c129b (patch)
treed302cf284ef36d8564ec40b1dc7c3baa4647d1e8 /lisp/replace.el
parent908af9dfc46f783c89d06cb48d9499eb6a582d3e (diff)
downloademacs-ee1ebe8246c333e9ca0e3454f357d12c713c129b.tar.gz
Guard occur against an undefined orig-line
; Not to be merged to master * lisp/replace.el (occur-engine): Avoid inserting the current line if orig-line is nil. This happens, for example, when reverting an occur buffer with `list-matching-lines-jump-to-current-line' set to t. (Bug#33476)
Diffstat (limited to 'lisp/replace.el')
-rw-r--r--lisp/replace.el4
1 files changed, 3 insertions, 1 deletions
diff --git a/lisp/replace.el b/lisp/replace.el
index 940bf566509..4f0cbf4b958 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -1748,6 +1748,7 @@ See also `multi-occur'."
(when (and list-matching-lines-jump-to-current-line
(not multi-occur-p)
(not orig-line-shown-p)
+ orig-line
(>= curr-line orig-line))
(insert
(concat
@@ -1774,7 +1775,8 @@ See also `multi-occur'."
;; Insert original line if haven't done yet.
(when (and list-matching-lines-jump-to-current-line
(not multi-occur-p)
- (not orig-line-shown-p))
+ (not orig-line-shown-p)
+ orig-line)
(with-current-buffer out-buf
(insert
(concat