[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master bd93a0f 081/167: ivy.el (ivy-state): Add a new field BUFFE
From: |
Oleh Krehel |
Subject: |
[elpa] master bd93a0f 081/167: ivy.el (ivy-state): Add a new field BUFFER |
Date: |
Tue, 08 Dec 2015 10:50:01 +0000 |
branch: master
commit bd93a0ff88dddfe22206b9c11c11494d68483bed
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
ivy.el (ivy-state): Add a new field BUFFER
* ivy.el (ivy-resume): Update.
(ivy-read): Update.
* swiper.el (swiper--action): Use `ivy-state-buffer'.
---
ivy.el | 42 +++++++++++++++++++++++-------------------
swiper.el | 28 ++++++++++++++++------------
2 files changed, 39 insertions(+), 31 deletions(-)
diff --git a/ivy.el b/ivy.el
index e33d71c..b6c8b08 100644
--- a/ivy.el
+++ b/ivy.el
@@ -187,6 +187,8 @@ Only \"./\" and \"../\" apply here. They appear in reverse
order."
history preselect keymap update-fn sort
;; The window in which `ivy-read' was called
window
+ ;; The buffer in which `ivy-read' was called
+ buffer
action
unwind
re-builder
@@ -496,25 +498,26 @@ If the text hasn't changed as a result, forward to
`ivy-alt-done'."
(defun ivy-resume ()
"Resume the last completion session."
(interactive)
- (ivy-read
- (ivy-state-prompt ivy-last)
- (ivy-state-collection ivy-last)
- :predicate (ivy-state-predicate ivy-last)
- :require-match (ivy-state-require-match ivy-last)
- :initial-input ivy-text
- :history (ivy-state-history ivy-last)
- :preselect (unless (eq (ivy-state-collection ivy-last)
- 'read-file-name-internal)
- ivy--current)
- :keymap (ivy-state-keymap ivy-last)
- :update-fn (ivy-state-update-fn ivy-last)
- :sort (ivy-state-sort ivy-last)
- :action (ivy-state-action ivy-last)
- :unwind (ivy-state-unwind ivy-last)
- :re-builder (ivy-state-re-builder ivy-last)
- :matcher (ivy-state-matcher ivy-last)
- :dynamic-collection (ivy-state-dynamic-collection ivy-last)
- :caller (ivy-state-caller ivy-last)))
+ (with-current-buffer (ivy-state-buffer ivy-last)
+ (ivy-read
+ (ivy-state-prompt ivy-last)
+ (ivy-state-collection ivy-last)
+ :predicate (ivy-state-predicate ivy-last)
+ :require-match (ivy-state-require-match ivy-last)
+ :initial-input ivy-text
+ :history (ivy-state-history ivy-last)
+ :preselect (unless (eq (ivy-state-collection ivy-last)
+ 'read-file-name-internal)
+ ivy--current)
+ :keymap (ivy-state-keymap ivy-last)
+ :update-fn (ivy-state-update-fn ivy-last)
+ :sort (ivy-state-sort ivy-last)
+ :action (ivy-state-action ivy-last)
+ :unwind (ivy-state-unwind ivy-last)
+ :re-builder (ivy-state-re-builder ivy-last)
+ :matcher (ivy-state-matcher ivy-last)
+ :dynamic-collection (ivy-state-dynamic-collection ivy-last)
+ :caller (ivy-state-caller ivy-last))))
(defvar ivy-calling nil
"When non-nil, call the current action when `ivy--index' changes.")
@@ -1015,6 +1018,7 @@ customizations should apply to the current completion
session."
:sort sort
:action action
:window (selected-window)
+ :buffer (current-buffer)
:unwind unwind
:re-builder re-builder
:matcher matcher
diff --git a/swiper.el b/swiper.el
index 7125823..ffbdea0 100644
--- a/swiper.el
+++ b/swiper.el
@@ -447,18 +447,22 @@ BEG and END, when specified, are the point bounds."
"Goto line X."
(if (null x)
(user-error "No candidates")
- (goto-char (point-min))
- (funcall (if swiper-use-visual-line
- #'line-move
- #'forward-line)
- (1- (read (get-text-property 0 'display x))))
- (re-search-forward
- (ivy--regex ivy-text) (line-end-position) t)
- (swiper--ensure-visible)
- (when (/= (point) swiper--opoint)
- (unless (and transient-mark-mode mark-active)
- (push-mark swiper--opoint t)
- (message "Mark saved where search started")))))
+ (with-ivy-window
+ (unless (equal (current-buffer)
+ (ivy-state-buffer ivy-last))
+ (switch-to-buffer (ivy-state-buffer ivy-last)))
+ (goto-char (point-min))
+ (funcall (if swiper-use-visual-line
+ #'line-move
+ #'forward-line)
+ (1- (read (get-text-property 0 'display x))))
+ (re-search-forward
+ (ivy--regex ivy-text) (line-end-position) t)
+ (swiper--ensure-visible)
+ (when (/= (point) swiper--opoint)
+ (unless (and transient-mark-mode mark-active)
+ (push-mark swiper--opoint t)
+ (message "Mark saved where search started"))))))
;; (define-key isearch-mode-map (kbd "C-o") 'swiper-from-isearch)
(defun swiper-from-isearch ()
- [elpa] master f0acebd 063/167: Fix Custom menus, (continued)
- [elpa] master f0acebd 063/167: Fix Custom menus, Oleh Krehel, 2015/12/08
- [elpa] master f6dd9cd 066/167: ivy.el (ivy-alt-done): Fix up last commit, Oleh Krehel, 2015/12/08
- [elpa] master a11c978 068/167: ivy-immediate-done should use ivy--directory, Oleh Krehel, 2015/12/08
- [elpa] master d8673f8 078/167: ivy.el (ffap): Move require, Oleh Krehel, 2015/12/08
- [elpa] master 47f53b6 073/167: counsel.el (counsel--find-symbol): Resolve name clash better, Oleh Krehel, 2015/12/08
- [elpa] master dc84ba3 070/167: Rename and move the minibuffer faces, Oleh Krehel, 2015/12/08
- [elpa] master 183b803 071/167: Use a specific blending method for dark themes, Oleh Krehel, 2015/12/08
- [elpa] master f9ef307 072/167: Improve the preselect index in ivy-resume, Oleh Krehel, 2015/12/08
- [elpa] master 576563d 082/167: ivy.el (with-ivy-window): Ensure window is live, Oleh Krehel, 2015/12/08
- [elpa] master f60d10e 075/167: "C-x C-f M-n" can call ffap-url-fetcher when at URL, Oleh Krehel, 2015/12/08
- [elpa] master bd93a0f 081/167: ivy.el (ivy-state): Add a new field BUFFER,
Oleh Krehel <=
- [elpa] master 202546b 080/167: swiper.el (swiper-mc): Update, Oleh Krehel, 2015/12/08
- [elpa] master f00696a 056/167: ivy.el (ivy-extra-directories): Improve :type, Oleh Krehel, 2015/12/08
- [elpa] master e338785 057/167: ivy.el (ivy-sort-functions-alist): Upgrade to defcustom, Oleh Krehel, 2015/12/08
- [elpa] master 71695df 065/167: "C-j" should not stop completion for a pasted file path, Oleh Krehel, 2015/12/08
- [elpa] master dfd6204 064/167: Fix pasting file paths on Windows, Oleh Krehel, 2015/12/08
- [elpa] master 1af25f6 067/167: swiper.el (swiper-font-lock-ensure): Amend exception list, Oleh Krehel, 2015/12/08
- [elpa] master 5f22310 069/167: counsel.el (counsel-git): Update default-directory, Oleh Krehel, 2015/12/08
- [elpa] master 4a04d6e 031/167: Default ivy-display-style to 'fancy for Emacs>=24.5, Oleh Krehel, 2015/12/08
- [elpa] master 3ae4f1a 052/167: ivy-test.el (swiper--re-builder): Update, Oleh Krehel, 2015/12/08
- [elpa] master 713fd6d 049/167: Try to fix the previous commit, Oleh Krehel, 2015/12/08