]> git.eshelyaron.com Git - emacs.git/commitdiff
Guard occur against an undefined orig-line
authorRaimon Grau <raimonster@gmail.com>
Sun, 9 Dec 2018 23:42:41 +0000 (01:42 +0200)
committerJuri Linkov <juri@linkov.net>
Sun, 9 Dec 2018 23:42:41 +0000 (01:42 +0200)
; 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)

lisp/replace.el

index 940bf56650992b9265f14f8718c2597c96eb39d4..4f0cbf4b958cc8fb089c0a19032154262ea6039b 100644 (file)
@@ -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