[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ivy-hydra 49335d2 060/395: Allow to use window configur
From: |
Basil L. Contovounesios |
Subject: |
[elpa] externals/ivy-hydra 49335d2 060/395: Allow to use window configurations for ivy views |
Date: |
Thu, 25 Feb 2021 08:31:31 -0500 (EST) |
branch: externals/ivy-hydra
commit 49335d2c1d257a23b300f1a28a68d620de370fdf
Author: Clemens Radermacher <clemera@posteo.net>
Commit: Oleh Krehel <ohwoeowho@gmail.com>
Allow to use window configurations for ivy views
Fixes #903
Fixes #2336
---
ivy.el | 46 ++++++++++++++++++++++++++++------------------
1 file changed, 28 insertions(+), 18 deletions(-)
diff --git a/ivy.el b/ivy.el
index 4de6c01..d885515 100644
--- a/ivy.el
+++ b/ivy.el
@@ -4105,10 +4105,13 @@ possible match. See `all-completions' for further
information."
The default value is given as an example.
-Each element is a list of (NAME TREE). NAME is a string, it's
+Each element is a list of (NAME VIEW). NAME is a string, it's
recommended to end it with a distinctive snippet e.g. \"{}\" so
that it's easy to distinguish the window configurations.
+VIEW is either a TREE or a window-configuration (see
+`ivy--get-view-config').
+
TREE is a nested list with the following valid cars:
- vert: split the window vertically
- horz: split the window horizontally
@@ -4150,6 +4153,22 @@ TREE can be nested multiple times to have multiple
window splits.")
(t
default-view-name))))
+(defun ivy--get-view-config ()
+ "Get `current-window-configuration' for `ivy-views'."
+ (dolist (w (window-list))
+ (set-window-parameter w 'ivy-view-data
+ (with-current-buffer (window-buffer w)
+ (cond (buffer-file-name
+ (list 'file buffer-file-name (point)))
+ ((eq major-mode 'dired-mode)
+ (list 'file default-directory (point)))
+ (t
+ (list 'buffer (buffer-name) (point)))))))
+ (let ((window-persistent-parameters
+ (append window-persistent-parameters
+ (list (cons 'ivy-view-data t)))))
+ (current-window-configuration)))
+
(defun ivy-push-view (&optional arg)
"Push the current window tree on `ivy-views'.
@@ -4159,22 +4178,7 @@ Currently, the split configuration (i.e. horizontal or
vertical)
and point positions are saved, but the split positions aren't.
Use `ivy-pop-view' to delete any item from `ivy-views'."
(interactive "P")
- (let* ((view (cl-labels
- ((ft (tr)
- (if (consp tr)
- (if (eq (car tr) t)
- (cons 'vert
- (mapcar #'ft (cddr tr)))
- (cons 'horz
- (mapcar #'ft (cddr tr))))
- (with-current-buffer (window-buffer tr)
- (cond (buffer-file-name
- (list 'file buffer-file-name (point)))
- ((eq major-mode 'dired-mode)
- (list 'file default-directory (point)))
- (t
- (list 'buffer (buffer-name) (point))))))))
- (ft (car (window-tree)))))
+ (let* ((view (ivy--get-view-config))
(view-name
(if arg
(ivy-read "Update view: " ivy-views)
@@ -4212,7 +4216,13 @@ Use `ivy-pop-view' to delete any item from `ivy-views'."
(defun ivy-set-view-recur (view)
"Set VIEW recursively."
- (cond ((eq (car view) 'vert)
+ (cond ((window-configuration-p view)
+ (set-window-configuration view)
+ (dolist (w (window-list))
+ (with-selected-window w
+ (ivy-set-view-recur
+ (window-parameter w 'ivy-view-data)))))
+ ((eq (car view) 'vert)
(let* ((wnd1 (selected-window))
(wnd2 (split-window-vertically))
(views (cdr view))
- [elpa] externals/ivy-hydra 5f430f4 198/395: ivy.el (ivy-switch-buffer-transformer): Fix for virtual buffers, (continued)
- [elpa] externals/ivy-hydra 5f430f4 198/395: ivy.el (ivy-switch-buffer-transformer): Fix for virtual buffers, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 9e0803c 226/395: ivy.el (ivy--remote-name): Extract and use the file name, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 7ed3d85 223/395: Move recent varalias before its referent, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 136ae0e 194/395: Add command for play/pause current song, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra a0063ce 224/395: ivy.el (ivy--done): Revert ivy-set-text, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 5c951e2 245/395: * counsel.el: Add comment on xor compatibility, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 1396d7b 024/395: counsel.el (counsel-grep): Obey ivy-case-fold-search-default, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 2ccda7e 044/395: ivy.el (ivy--directory-done): Fix "Host name must not match method ssh", Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra a7ae5f0 058/395: counsel.el (counsel-geiser-doc-look-up-manual): Add., Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 13a1b87 059/395: ivy.el (ivy-minibuffer-map): Bind "M-a" to ivy-toggle-marks, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 49335d2 060/395: Allow to use window configurations for ivy views,
Basil L. Contovounesios <=
- [elpa] externals/ivy-hydra 0f61cc5 065/395: Add support for browising compilation errors, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 2fb4c9f 061/395: Update test instructions, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 3d9c222 069/395: swiper.el (swiper--query-replace-updatefn): Fix, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra c7973a8 083/395: counsel.el (counsel-set-variable): Fix killing the expression, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra e7eca37 085/395: counsel.el (counsel-switch-buffer-preview-virtual-buffers): Add, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra eae1ccf 086/395: ivy.el (ivy-auto-shrink-minibuffer): New defcustom, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra f16e6e2 094/395: counsel.el (counsel-flycheck-errors-cands): Show the error, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 400a900 265/395: ivy.el (ivy-backward-delete-char): Forward to counsel-up-directory, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra edccbd7 270/395: ivy.el (ivy-completion-in-region): Use collection in place of all-completions, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 0f4cb44 051/395: ivy.el (ivy-add-prompt-count): Account for :dynamic-collection returning 0, Basil L. Contovounesios, 2021/02/25