[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ivy-hydra 8d840b2 317/395: counsel.el (counsel-find-fil
From: |
Basil L. Contovounesios |
Subject: |
[elpa] externals/ivy-hydra 8d840b2 317/395: counsel.el (counsel-find-file-undo): Undo changing current directory |
Date: |
Thu, 25 Feb 2021 08:32:28 -0500 (EST) |
branch: externals/ivy-hydra
commit 8d840b2e8680e2768edb794c9ccecf975f6ba4cf
Author: Oleh Krehel <ohwoeowho@gmail.com>
Commit: Oleh Krehel <ohwoeowho@gmail.com>
counsel.el (counsel-find-file-undo): Undo changing current directory
This means we can undo directory changes with "RET" or "DEL", while
using the standard `undo' binding.
Since we have this, we no-longer need the "DEL" preselect logic that
was making "RET" into and "undo" in that case. Which is good, since
"DEL RET" is a valid workflow to select the parent directory in
`dired'.
Re #1424
Fixes #2593
---
counsel.el | 9 +++++----
ivy.el | 20 +++++---------------
2 files changed, 10 insertions(+), 19 deletions(-)
diff --git a/counsel.el b/counsel.el
index 10301f2..52cc0d3 100644
--- a/counsel.el
+++ b/counsel.el
@@ -2144,10 +2144,11 @@ See variable `counsel-up-directory-level'."
(defun counsel-find-file-undo ()
(interactive)
(if (string= ivy-text "")
- (progn
- (ivy-backward-delete-char)
- (ivy--exhibit)
- (ivy-insert-current))
+ (let ((dir (progn
+ (pop ivy--directory-hist)
+ (pop ivy--directory-hist))))
+ (when dir
+ (ivy--cd dir)))
(undo)))
(defun counsel-at-git-issue-p ()
diff --git a/ivy.el b/ivy.el
index d666add..9a71429 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1588,6 +1588,7 @@ If so, move to that directory, while keeping only the
file name."
"When completing file names, move to directory DIR."
(if (null ivy--directory)
(error "Unexpected")
+ (push dir ivy--directory-hist)
(setq ivy--old-cands nil)
(setq ivy--old-re nil)
(ivy-set-index 0)
@@ -1602,15 +1603,7 @@ If so, move to that directory, while keeping only the
file name."
#'string<))))
(ivy-set-text "")
(setf (ivy-state-directory ivy-last) dir)
- (delete-minibuffer-contents)
- (when (equal dir (car ivy--directory-hist))
- (pop ivy--directory-hist)
- (setf (ivy-state-preselect ivy-last)
- (if ivy--directory-hist
- (file-name-nondirectory
- (directory-file-name
- (car ivy--directory-hist)))
- nil)))))
+ (delete-minibuffer-contents)))
(defun ivy--parent-dir (filename)
"Return parent directory of absolute FILENAME."
@@ -1624,11 +1617,8 @@ minibuffer."
(interactive)
(if (and ivy--directory (= (minibuffer-prompt-end) (point)))
(progn
- (push ivy--directory ivy--directory-hist)
- (if (fboundp 'counsel-up-directory)
- (counsel-up-directory)
- (ivy--cd (ivy--parent-dir (expand-file-name ivy--directory)))
- (ivy--exhibit)))
+ (ivy--cd (ivy--parent-dir (expand-file-name ivy--directory)))
+ (ivy--exhibit))
(setq prefix-arg current-prefix-arg)
(condition-case nil
(call-interactively #'delete-backward-char)
@@ -2223,7 +2213,7 @@ This is useful for recursive `ivy-read'."
(setq preselect nil))
(setq ivy--extra-candidates (ivy--compute-extra-candidates caller))
(setq ivy--directory nil)
- (setq ivy--directory-hist nil)
+ (setq ivy--directory-hist (list default-directory))
(setq ivy-case-fold-search ivy-case-fold-search-default)
(setf (ivy-state-re-builder ivy-last)
(setq ivy--regex-function
- [elpa] externals/ivy-hydra 6f50fca 286/395: ivy.el: When reading file names, take the non-directory part of :initial-input, (continued)
- [elpa] externals/ivy-hydra 6f50fca 286/395: ivy.el: When reading file names, take the non-directory part of :initial-input, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra d452878 291/395: counsel-grep/ag/rg/pt/...: Allow to deplay subprocess creation, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 84dfbf8 296/395: ivy-avy.el: Checkdoc, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 864570a 323/395: ivy.el (ivy--get-multi-action): Fix and add a test, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 05c12fc 310/395: counsel.el (counsel--grep-smart-case-flag): Check if base command is a string, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra b2af619 322/395: ivy.el (ivy--call-marked): Don't call multi-action if non-default action was chosen, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 683a7b7 309/395: ivy.el (ivy-completion-in-region): Fix "^" and C-g, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra ea9bd06 353/395: Encode --pcre switch correctly for ivy-occur, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 63549da 354/395: Fix counsel-descbinds for Emacs 28, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 387390b 312/395: Prefer derived-mode-p for major-mode comparisons, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 8d840b2 317/395: counsel.el (counsel-find-file-undo): Undo changing current directory,
Basil L. Contovounesios <=
- [elpa] externals/ivy-hydra 9bb6841 347/395: counsel.el (counsel-highlight-with-face): Fix preselect on next call, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra dd9c88f 319/395: ivy-avy.el: Fix package-lint warnings, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 544e7de 314/395: ivy.el (ivy-completing-read): Work better with find-file-at-point, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 4f98f97 332/395: targets/plain.el: Install avy automatically, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 6a22192 360/395: ivy.el (ivy--highlight-default): Use match faces consistently, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra f8b1ab8 328/395: Minor fixes for recent additions, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra dd43ab1 346/395: Add Emacs 27 executable-find compatibility shim, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra c76d797 370/395: Clean up some stuff around counsel-locate, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 34a203f 374/395: counsel.el: Add prompt param to counsel-mark--ivy-read, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 71c59ae 377/395: ivy.el (ivy--format-minibuffer-line): Check for annotation-function in one more place, Basil L. Contovounesios, 2021/02/25