[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ivy-hydra 1b6f3cf 244/395: Improve ivy-switch-buffer-tr
From: |
Basil L. Contovounesios |
Subject: |
[elpa] externals/ivy-hydra 1b6f3cf 244/395: Improve ivy-switch-buffer-transformer |
Date: |
Thu, 25 Feb 2021 08:32:12 -0500 (EST) |
branch: externals/ivy-hydra
commit 1b6f3cf24027f4de749564a3ed6eb96a64b73abe
Author: Basil L. Contovounesios <contovob@tcd.ie>
Commit: Oleh Krehel <ohwoeowho@gmail.com>
Improve ivy-switch-buffer-transformer
* ivy.el (ivy--remote-name): Remove as it doesn't make sense to
expand a buffer name against its default-directory.
(ivy--remote-buffer-p): New function.
(ivy-switch-buffer-transformer): Use it to annotate remote buffer
names during completion.
Re #2532
Fixes #2538
---
ivy.el | 33 ++++++++++++++++++---------------
1 file changed, 18 insertions(+), 15 deletions(-)
diff --git a/ivy.el b/ivy.el
index bf01f20..8b2aaa7 100644
--- a/ivy.el
+++ b/ivy.el
@@ -4587,25 +4587,28 @@ Skip buffers that match `ivy-ignore-buffers'."
(add-face-text-property 0 (length str) face t str))
str)
-(defun ivy--remote-name (str dir)
- (ivy-append-face (expand-file-name str dir) 'ivy-remote))
+(defun ivy--remote-buffer-p (buffer)
+ "Return non-nil if BUFFER object is visiting a remote file.
+If that is the case, value is a string identifying the remote
+connection."
+ (let ((dir (buffer-local-value 'default-directory buffer)))
+ (ignore-errors (file-remote-p dir))))
(defun ivy-switch-buffer-transformer (str)
"Transform candidate STR when switching buffers."
(let ((buf (get-buffer str)))
- (if buf
- (let ((dir (buffer-local-value 'default-directory buf))
- (mode (buffer-local-value 'major-mode buf)))
- (cond
- ((and dir (ignore-errors (file-remote-p dir)))
- (ivy--remote-name str dir))
- ((not (verify-visited-file-modtime buf))
- (ivy-append-face str 'ivy-modified-outside-buffer))
- ((buffer-modified-p buf)
- (ivy-append-face str 'ivy-modified-buffer))
- (t
- (ivy-append-face str (cdr (assq mode
ivy-switch-buffer-faces-alist))))))
- str)))
+ (cond ((not buf) str)
+ ((let ((remote (ivy--remote-buffer-p buf)))
+ (when remote
+ (format "%s (%s)" (ivy-append-face str 'ivy-remote) remote))))
+ ((not (verify-visited-file-modtime buf))
+ (ivy-append-face str 'ivy-modified-outside-buffer))
+ ((buffer-modified-p buf)
+ (ivy-append-face str 'ivy-modified-buffer))
+ (t
+ (let* ((mode (buffer-local-value 'major-mode buf))
+ (face (cdr (assq mode ivy-switch-buffer-faces-alist))))
+ (ivy-append-face str face))))))
(defun ivy-switch-buffer-occur (cands)
"Occur function for `ivy-switch-buffer' using `ibuffer'.
- [elpa] externals/ivy-hydra 764b978 378/395: Revert last change to ivy-update-candidates, (continued)
- [elpa] externals/ivy-hydra 764b978 378/395: Revert last change to ivy-update-candidates, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra dab134d 229/395: ivy.el (ivy-read): Don't clear the first item of history, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 83ba4bd 089/395: counsel.el (counsel--switch-buffer-update-fn): Allow marking, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra c83f6bc 088/395: ivy.el (ivy-call): Don't modify ivy-marked-candidates, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra baac6e1 090/395: swiper.el (swiper--re-builder): Fix "^$" for swiper, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra cdd3995 100/395: ivy.el (ivy--buffer-list): Avoid unnecessarily touching remote connections, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 69fedaa 098/395: counsel.el (counsel-esh-history, counsel-shell-history): Set indices, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 32019df 102/395: ivy.el (ivy-read-action-by-key): Allow to read e.g. C-d, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 6941b8a 214/395: Revert ".dir-locals.el (outline-regexp): "^(" is not an outline start", Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 93929ec 257/395: * ivy.el (ivy--shorter-matches-first): Simplify, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 1b6f3cf 244/395: Improve ivy-switch-buffer-transformer,
Basil L. Contovounesios <=
- [elpa] externals/ivy-hydra 68ce6e6 384/395: Mention caveats for non-exiting commands in manual, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 1deef76 394/395: Bump version to point release 0.13.2, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 4235010 387/395: Re-revert last change to ivy-update-candidates, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra d8ed11e 388/395: Make ivy-switch-buffer-kill respect current predicate, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra c1a61dc 084/395: ivy-test.el (ivy-empty-directory-open): Test opening empty directory, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 316d4dd 232/395: counsel-kmacro: Create actions for cycling the ring and setting a saved counter value., Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 38c90e8 196/395: ivy.el (ivy-switch-buffer-transformer): Move ivy-remote logic here, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra fff899a 237/395: counsel.el (counsel--sync-sentinel-on-exit): Try not to reset index to 0, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra a2c86c0 273/395: ivy.el (ivy-completion-in-region): Fixup, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra da0b272 281/395: ivy.el (ivy--call-marked): Handle alists, Basil L. Contovounesios, 2021/02/25