[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/iwindow f5cf9ed724 07/13: Don't show raw key code on unbou
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/iwindow f5cf9ed724 07/13: Don't show raw key code on unbound key |
Date: |
Sun, 27 Nov 2022 16:01:12 -0500 (EST) |
branch: elpa/iwindow
commit f5cf9ed7242404b46de9eefc415dcad5b476e3a9
Author: Akib Azmain Turja <akib@disroot.org>
Commit: Akib Azmain Turja <akib@disroot.org>
Don't show raw key code on unbound key
---
iwindow.el | 163 ++++++++++++++++++++++++++++++-------------------------------
1 file changed, 81 insertions(+), 82 deletions(-)
diff --git a/iwindow.el b/iwindow.el
index d744f3230f..b1a9c2dfae 100644
--- a/iwindow.el
+++ b/iwindow.el
@@ -122,27 +122,27 @@ form (OPTION...), whose length of no more than the length
of
(windows nil)
(decorators nil))
(cl-labels ((walk
- (tree keys)
- (if (windowp tree)
- (push (cons tree (reverse keys))
- windows)
- (seq-map-indexed
- (lambda (node index)
- (walk node
- (cons (nth index iwindow-selection-keys)
- keys)))
- tree))))
+ (tree keys)
+ (if (windowp tree)
+ (push (cons tree (reverse keys))
+ windows)
+ (seq-map-indexed
+ (lambda (node index)
+ (walk node
+ (cons (nth index iwindow-selection-keys)
+ keys)))
+ tree))))
(walk tree nil))
(run-hook-wrapped 'iwindow-decoration-functions
(lambda (fn) (ignore (push fn decorators))))
(cl-labels ((call-decorators
- (fns)
- (with-selected-window current-window
- (if fns
- (funcall (car fns) windows
- (lambda ()
- (call-decorators (cdr fns))))
- (funcall payload)))))
+ (fns)
+ (with-selected-window current-window
+ (if fns
+ (funcall (car fns) windows
+ (lambda ()
+ (call-decorators (cdr fns))))
+ (funcall payload)))))
(call-decorators (nreverse decorators)))))
(defun iwindow--ask (tree)
@@ -155,7 +155,7 @@ Return the window chosen."
(redraw-display))
(let ((option nil)
(choices (cl-mapcar #'cons iwindow-selection-keys
- tree)))
+ tree)))
(iwindow--decorate-windows
tree
(lambda ()
@@ -166,7 +166,8 @@ Return the window chosen."
(keyboard-quit)
(if-let ((choice (alist-get key choices)))
(setq option choice)
- (message "Unbound key: %c (press C-g to quit)" key)
+ (message "Unbound key: %s (press C-g to quit)"
+ (key-description (list key)))
(ding)))))))
(iwindow--ask option))))
@@ -196,25 +197,24 @@ WINDOW and ignore WINDOW when PREDICATE returns nil."
WINDOWS and CALLBACK is described in the docstring of
`iwindow-decoration-functions', which see."
(let ((original-mode-lines nil))
- (cl-labels ((setup-windows
- (window-list)
- (with-selected-window (caar window-list)
- (unless (assq (current-buffer) original-mode-lines)
- (push (cons (current-buffer) mode-line-format)
- original-mode-lines))
- (let ((mode-line-format
- `(:eval
- (if-let ((keys
- (alist-get (selected-window)
- ',windows)))
- (mapconcat
- (apply-partially #'string ? )
- keys "")
- ',(alist-get (current-buffer)
- original-mode-lines)))))
- (if (cdr window-list)
- (setup-windows (cdr window-list))
- (funcall callback))))))
+ (cl-labels ((setup-windows (window-list)
+ (with-selected-window (caar window-list)
+ (unless (assq (current-buffer) original-mode-lines)
+ (push (cons (current-buffer) mode-line-format)
+ original-mode-lines))
+ (let ((mode-line-format
+ `(:eval
+ (if-let ((keys
+ (alist-get (selected-window)
+ ',windows)))
+ (mapconcat
+ (apply-partially #'string ? )
+ keys "")
+ ',(alist-get (current-buffer)
+ original-mode-lines)))))
+ (if (cdr window-list)
+ (setup-windows (cdr window-list))
+ (funcall callback))))))
(setup-windows windows))))
(defun iwindow-highlight-window (windows callback)
@@ -225,28 +225,28 @@ WINDOWS and CALLBACK is described in the docstring of
(let ((buffers nil)
(sym (make-symbol "iwindow-parameter")))
(cl-labels ((setup-windows
- (window-list)
- (with-selected-window (caar window-list)
- (cl-letf* (((window-parameter nil sym) sym)
- (payload
- (lambda ()
- (if (cdr window-list)
- (setup-windows (cdr window-list))
- (funcall callback)))))
- (if (memq (current-buffer) buffers)
- (funcall payload)
- (let ((face-remapping-alist
- face-remapping-alist))
- (cl-letf (((symbol-function
- 'make-local-variable)
- #'ignore))
- (dolist (pair iwindow-highlight-faces)
- (face-remap-add-relative
- (car pair)
- `(:filtered (:window ,sym ,sym)
- ,(cdr pair)))))
- (push (current-buffer) buffers)
- (funcall payload)))))))
+ (window-list)
+ (with-selected-window (caar window-list)
+ (cl-letf* (((window-parameter nil sym) sym)
+ (payload
+ (lambda ()
+ (if (cdr window-list)
+ (setup-windows (cdr window-list))
+ (funcall callback)))))
+ (if (memq (current-buffer) buffers)
+ (funcall payload)
+ (let ((face-remapping-alist
+ face-remapping-alist))
+ (cl-letf (((symbol-function
+ 'make-local-variable)
+ #'ignore))
+ (dolist (pair iwindow-highlight-faces)
+ (face-remap-add-relative
+ (car pair)
+ `(:filtered (:window ,sym ,sym)
+ ,(cdr pair)))))
+ (push (current-buffer) buffers)
+ (funcall payload)))))))
(setup-windows windows))))
(defun iwindow-show-keys-for-minibuffer (windows callback)
@@ -254,28 +254,27 @@ WINDOWS and CALLBACK is described in the docstring of
WINDOWS and CALLBACK is described in the docstring of
`iwindow-decoration-functions', which see."
- (cl-labels ((setup-windows
- (window-list)
- (with-selected-window (caar window-list)
- (let ((ov nil))
- (when (minibufferp)
- (setq ov (make-overlay (point-min)
- (point-min)))
- (overlay-put
- ov 'before-string
- (concat (propertize
- (mapconcat #'string (cdar window-list)
- " ")
- 'face '(iwindow-minibuffer-keys-face
- default))
- " "))
- (overlay-put ov 'window (selected-window)))
- (unwind-protect
- (if (cdr window-list)
- (setup-windows (cdr window-list))
- (funcall callback))
- (when ov
- (delete-overlay ov)))))))
+ (cl-labels ((setup-windows (window-list)
+ (with-selected-window (caar window-list)
+ (let ((ov nil))
+ (when (minibufferp)
+ (setq ov (make-overlay (point-min)
+ (point-min)))
+ (overlay-put
+ ov 'before-string
+ (concat (propertize
+ (mapconcat #'string (cdar window-list)
+ " ")
+ 'face '(iwindow-minibuffer-keys-face
+ default))
+ " "))
+ (overlay-put ov 'window (selected-window)))
+ (unwind-protect
+ (if (cdr window-list)
+ (setup-windows (cdr window-list))
+ (funcall callback))
+ (when ov
+ (delete-overlay ov)))))))
(setup-windows windows)))
;;;###autoload
- [nongnu] elpa/iwindow 16c6c97143 09/13: Don't error when PREDICATE is nil, (continued)
- [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, 2022/11/27
- [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 <=
- [nongnu] elpa/iwindow 63426c55a9 08/13: Make window keys more predictable, ELPA Syncer, 2022/11/27