[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master f0451db 173/184: ivy.el (ivy-occur-revert-buffer): Don't e
From: |
Oleh Krehel |
Subject: |
[elpa] master f0451db 173/184: ivy.el (ivy-occur-revert-buffer): Don't error if the swiper buffer was killed |
Date: |
Wed, 16 Oct 2019 13:15:17 -0400 (EDT) |
branch: master
commit f0451db9e8a36498fe441437db2b66c75c8eb6bf
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
ivy.el (ivy-occur-revert-buffer): Don't error if the swiper buffer was
killed
---
ivy.el | 23 ++++++++++++++---------
swiper.el | 16 +++++++++++++++-
2 files changed, 29 insertions(+), 10 deletions(-)
diff --git a/ivy.el b/ivy.el
index fea6ad5..8073665 100644
--- a/ivy.el
+++ b/ivy.el
@@ -498,7 +498,8 @@ action functions.")
current
def
ignore
- multi-action)
+ multi-action
+ extra-props)
(defvar ivy-last (make-ivy-state)
"The last parameters passed to `ivy-read'.
@@ -1204,6 +1205,7 @@ If the text hasn't changed as a result, forward to
`ivy-alt-done'."
:re-builder (ivy-state-re-builder ivy-last)
:matcher (ivy-state-matcher ivy-last)
:dynamic-collection (ivy-state-dynamic-collection ivy-last)
+ :extra-props (ivy-state-extra-props ivy-last)
:caller (ivy-state-caller ivy-last))))))
(defvar-local ivy-calling nil
@@ -1993,7 +1995,9 @@ found, it falls back to the key t."
history preselect def keymap update-fn sort
action multi-action
unwind re-builder matcher
- dynamic-collection caller)
+ dynamic-collection
+ extra-props
+ caller)
"Read a string in the minibuffer, with completion.
PROMPT is a string, normally ending in a colon and a space.
@@ -2052,6 +2056,9 @@ list of candidates, and returns the list of matching
candidates.
DYNAMIC-COLLECTION is a boolean specifying whether the list of
candidates is updated after each input by calling COLLECTION.
+EXTRA-PROPS can be used to store collection-specific
+session-specific data.
+
CALLER is a symbol to uniquely identify the caller to `ivy-read'.
It is used, along with COLLECTION, to determine which
customizations apply to the current completion session."
@@ -2099,6 +2106,7 @@ customizations apply to the current completion session."
:dynamic-collection dynamic-collection
:display-transformer-fn (plist-get ivy--display-transformers-list
caller)
:directory default-directory
+ :extra-props extra-props
:caller caller
:def def))
(ivy--reset-state ivy-last)
@@ -4803,13 +4811,10 @@ updated original buffer."
(let ((caller (ivy-state-caller ivy-occur-last))
(ivy-last ivy-occur-last))
(cond ((member caller '(swiper swiper-isearch))
- (let ((buffer (ivy-state-buffer ivy-occur-last)))
- (unless (buffer-live-p buffer)
- (error "Buffer was killed"))
- (let ((inhibit-read-only t))
- (erase-buffer)
- (funcall (plist-get ivy--occurs-list caller) t)
- (ivy-occur-grep-mode))))
+ (let ((inhibit-read-only t))
+ (erase-buffer)
+ (funcall (plist-get ivy--occurs-list caller) t)
+ (ivy-occur-grep-mode)))
((memq caller ivy-highlight-grep-commands)
(let ((inhibit-read-only t)
(line (line-number-at-pos)))
diff --git a/swiper.el b/swiper.el
index 1a4f6dd..964ea51 100644
--- a/swiper.el
+++ b/swiper.el
@@ -640,11 +640,23 @@ When non-nil, INITIAL-INPUT is the initial search
pattern."
(forward-line 4)
(setq-local next-error-function #'ivy-occur-next-error))
+(defun swiper--occur-buffer ()
+ (let ((buffer (ivy-state-buffer ivy-last)))
+ (unless (buffer-live-p buffer)
+ (setq buffer
+ (setf (ivy-state-buffer ivy-last)
+ (find-file-noselect
+ (plist-get (ivy-state-extra-props ivy-last) :fname))))
+ (save-selected-window
+ (pop-to-buffer buffer))
+ (setf (ivy-state-window ivy-last) (selected-window)))
+ buffer))
+
(defun swiper-occur (&optional revert)
"Generate a custom occur buffer for `swiper'.
When REVERT is non-nil, regenerate the current *ivy-occur* buffer.
When capture groups are present in the input, print them instead of lines."
- (let* ((buffer (ivy-state-buffer ivy-last))
+ (let* ((buffer (swiper--occur-buffer))
(fname (propertize
(with-ivy-window
(if (buffer-file-name buffer)
@@ -798,6 +810,7 @@ When non-nil, INITIAL-INPUT is the initial search pattern."
:action #'swiper--action
:re-builder #'swiper--re-builder
:history 'swiper-history
+ :extra-props (list :fname (buffer-file-name))
:caller 'swiper))
(point))
(unless (or res swiper-stay-on-quit)
@@ -1614,6 +1627,7 @@ When not running `swiper-isearch' already, start it."
:action #'swiper-isearch-action
:re-builder #'swiper--re-builder
:history 'swiper-history
+ :extra-props (list :fname (buffer-file-name))
:caller 'swiper-isearch))
(point))
(unless (or res swiper-stay-on-quit)
- [elpa] master 9d3d7de 132/184: counsel.el (counsel-slime-repl-history): Add., (continued)
- [elpa] master 9d3d7de 132/184: counsel.el (counsel-slime-repl-history): Add., Oleh Krehel, 2019/10/16
- [elpa] master 9e1b9a0 131/184: counsel.el (counsel-google-function): Add missing require, Oleh Krehel, 2019/10/16
- [elpa] master 5ff8b5e 133/184: ivy.el (ivy-completion-in-region-action): Use declare-function., Oleh Krehel, 2019/10/16
- [elpa] master 78dd554 134/184: ivy.el (ivy--exhibit): Handle ivy--reset-state initial call, Oleh Krehel, 2019/10/16
- [elpa] master c1ea2af 145/184: ivy.el (ivy-read): Fix conflict an existing read-key session, Oleh Krehel, 2019/10/16
- [elpa] master 589e03f 144/184: ivy.el (ivy-configure): Use for ivy-index-functions-alist, Oleh Krehel, 2019/10/16
- [elpa] master 64c0804 163/184: ivy.el (ivy-partial-or-done): Work with completion-cycle-threshold, Oleh Krehel, 2019/10/16
- [elpa] master 6f23c5e 152/184: ivy.el (ivy-occur-press): Re-use ivy-highlight-grep-commands, Oleh Krehel, 2019/10/16
- [elpa] master f46cdad 154/184: counsel.el (counsel-grep): Add :require-match, Oleh Krehel, 2019/10/16
- [elpa] master 2d840b8 157/184: ivy.el (ivy-configure): Add :sort-fn, Oleh Krehel, 2019/10/16
- [elpa] master f0451db 173/184: ivy.el (ivy-occur-revert-buffer): Don't error if the swiper buffer was killed,
Oleh Krehel <=
- [elpa] master 3bd1d87 182/184: counsel.el (counsel-locate-cmd-es): Encode command to local codepage, Oleh Krehel, 2019/10/16
- [elpa] master 8b4693c 169/184: counsel.el (counsel-imenu-action and -get-canditates-from): Revert., Oleh Krehel, 2019/10/16
- [elpa] master 882d6c4 161/184: counsel.el (counsel-imenu): Work with :update-fn 'auto, Oleh Krehel, 2019/10/16
- [elpa] master 1a9002b 168/184: ivy.el: Clean up obsolete aliases, Oleh Krehel, 2019/10/16
- [elpa] master c2d3a4c 184/184: Merge commit 'cd634c6f51458f81898ecf2821ac3169cb65a1eb' from ivy, Oleh Krehel, 2019/10/16
- [elpa] master 12f4771 124/184: ivy.el (ivy-completion-in-region): Add workaround for package-menu-filter, Oleh Krehel, 2019/10/16
- [elpa] master 2b974b4 139/184: ivy.el (ivy-update-fns-alist): New defcustom, Oleh Krehel, 2019/10/16
- [elpa] master 57e0b94 146/184: swiper.el (swiper--action): Set case-fold-search, Oleh Krehel, 2019/10/16
- [elpa] master cdca2fc 141/184: counsel.el (counsel-switch-buffer): Re-use ivy-switch-buffer, Oleh Krehel, 2019/10/16
- [elpa] master a5701a9 159/184: ivy.el (ivy-configure): Add :format-fn, Oleh Krehel, 2019/10/16