[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#33476: [PATCH] Fix occur revert with list-matching-lines-jump-to-cur
From: |
Raimon Grau |
Subject: |
bug#33476: [PATCH] Fix occur revert with list-matching-lines-jump-to-current-line |
Date: |
Fri, 23 Nov 2018 21:10:19 +0000 |
Hello,
I reproduced this bug with Emacs 26.1 and 26.1.90 using -Q option.
When pressing 'g' (revert-buffer) in an *Occur* buffer, in the case of
having `list-matching-lines-jump-to-current-line' set to non-nil, the
function errors as it can't find orig-line.
I'm attaching a patch that adds a guard to the list of guards before
inserting the current line.
Cheers,
Raimon Grau
>From 2f874d70b6d69debd7370da562e768fc3b9b8198 Mon Sep 17 00:00:00 2001
From: Raimon Grau <raimonster@gmail.com>
Date: Fri, 23 Nov 2018 20:37:12 +0000
Subject: [PATCH] Guard occur against an undefined orig-line
* 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.
---
lisp/replace.el | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lisp/replace.el b/lisp/replace.el
index 940bf56..4f0cbf4 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -1748,6 +1748,7 @@ occur-engine
(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 @@ occur-engine
;; 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
--
2.7.4
- bug#33476: [PATCH] Fix occur revert with list-matching-lines-jump-to-current-line,
Raimon Grau <=