[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/iwindow 6c5ea91142 02/13: Allow to use any arbitrary face
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/iwindow 6c5ea91142 02/13: Allow to use any arbitrary face to highlight |
Date: |
Sun, 27 Nov 2022 16:01:12 -0500 (EST) |
branch: elpa/iwindow
commit 6c5ea911425b3be09ce5e8b7320ebba0b969c6a0
Author: Akib Azmain Turja <akib@disroot.org>
Commit: Akib Azmain Turja <akib@disroot.org>
Allow to use any arbitrary face to highlight
---
iwindow.el | 47 +++++++++++++++++++++++++++++------------------
1 file changed, 29 insertions(+), 18 deletions(-)
diff --git a/iwindow.el b/iwindow.el
index caba983a16..90775e4ae6 100644
--- a/iwindow.el
+++ b/iwindow.el
@@ -74,8 +74,18 @@ CALLBACK and revert the changes it has done."
:options (list #'iwindow-show-keys-on-mode-line
#'iwindow-highlight-window))
-(defface iwindow-highlight-face '((t :background "blue"))
- "Face to use to highlight candidate windows.")
+(defcustom iwindow-highlight-faces
+ '((default . iwindow-highlight-default)
+ (fringe . iwindow-highlight-fringe))
+ "Alist of face and their replacements in candidate windows."
+ :type '(alist :key-type (face :tag "Face")
+ :value-type (face :tag "Replacement")))
+
+(defface iwindow-highlight-default '((t :background "blue"))
+ "`default' face for highlighted windows.")
+
+(defface iwindow-highlight-fringe '((t :background "blue"))
+ "`fringe' face for highlighted windows.")
(defun iwindow--make-decision-tree (windows start end)
"Make a decision tree from window in WINDOWS from START to END.
@@ -131,13 +141,16 @@ form (OPTION...), whose length of no more than the length
of
Return the window chosen."
(if (windowp tree)
- tree
+ (prog1
+ tree
+ (redraw-display))
(let ((option nil)
(choices (cl-mapcar #'cons iwindow-selection-keys
tree)))
(iwindow--decorate-windows
tree
(lambda ()
+ (redraw-display)
(while (not option)
(let ((key (read-key)))
(if (eql key ?\C-g)
@@ -162,9 +175,11 @@ WINDOW and ignore WINDOW when PREDICATE returns nil."
(seq-filter predicate (window-list))
(window-list))))
(when windows
- (let* ((tree (iwindow--make-decision-tree (vconcat windows)
- 0 (length windows))))
- (iwindow--ask tree)))))
+ (if (cdr windows) ; (> (length windows) 1)
+ (let* ((tree (iwindow--make-decision-tree
+ (vconcat windows) 0 (length windows))))
+ (iwindow--ask tree))
+ (car windows)))))
(defun iwindow-show-keys-on-mode-line (windows callback)
"Change mode line of windows to show the keys to choose the window.
@@ -203,19 +218,15 @@ WINDOWS and CALLBACK is described in the docstring of
(cl-labels ((setup-windows
(window-list)
(with-selected-window (caar window-list)
- (cl-letf* ((remap-p (not (memq (current-buffer)
- buffers)))
- ((window-parameter nil sym) sym)
+ (cl-letf* (((window-parameter nil sym) sym)
(face-remapping-alist
- (if remap-p
- (append
- `((default
- (:filtered
- (:window ,sym ,sym)
- iwindow-highlight-face)
- default))
- face-remapping-alist)
- face-remapping-alist)))
+ face-remapping-alist))
+ (unless (memq (current-buffer) buffers)
+ (dolist (pair iwindow-highlight-faces)
+ (face-remap-add-relative
+ (car pair)
+ `(:filtered (:window ,sym ,sym)
+ ,(cdr pair)))))
(push (current-buffer) buffers)
(if (cdr window-list)
(setup-windows (cdr window-list))
- [nongnu] branch elpa/iwindow created (now 144c402d5f), ELPA Syncer, 2022/11/27
- [nongnu] elpa/iwindow bfc5e97dfe 03/13: Add iwindow-swap, ELPA Syncer, 2022/11/27
- [nongnu] elpa/iwindow 16c6c97143 09/13: Don't error when PREDICATE is nil, ELPA Syncer, 2022/11/27
- [nongnu] elpa/iwindow 89989ad071 10/13: Minor cleanup, ELPA Syncer, 2022/11/27
- [nongnu] elpa/iwindow fc092c6b64 12/13: Lower Emacs minimum requirement to 24.3, ELPA Syncer, 2022/11/27
- [nongnu] elpa/iwindow cbbcdb32b2 05/13: Suppress runtime warning, ELPA Syncer, 2022/11/27
- [nongnu] elpa/iwindow f7b47e3bd8 04/13: Show keys for minibuffer on minibuffer, ELPA Syncer, 2022/11/27
- [nongnu] elpa/iwindow 13b9c558bf 11/13: Replace cl-labels with named-let, use Compat if needed, ELPA Syncer, 2022/11/27
- [nongnu] elpa/iwindow 144c402d5f 13/13: Add .dir-locals.el, ELPA Syncer, 2022/11/27
- [nongnu] elpa/iwindow 6c5ea91142 02/13: Allow to use any arbitrary face to highlight,
ELPA Syncer <=
- [nongnu] elpa/iwindow 285f40ff09 01/13: Add iwindow-select, ELPA Syncer, 2022/11/27
- [nongnu] elpa/iwindow a32c522f80 06/13: Add iwindow-delete and iwindow-delete-others, ELPA Syncer, 2022/11/27
- [nongnu] elpa/iwindow f5cf9ed724 07/13: Don't show raw key code on unbound key, ELPA Syncer, 2022/11/27
- [nongnu] elpa/iwindow 63426c55a9 08/13: Make window keys more predictable, ELPA Syncer, 2022/11/27