[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/swsw 51fcc776bd 081/146: ; Reorganize swsw.el
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/swsw 51fcc776bd 081/146: ; Reorganize swsw.el |
Date: |
Wed, 25 May 2022 02:59:48 -0400 (EDT) |
branch: elpa/swsw
commit 51fcc776bdb89bc5a5e2852b3eec7e11ae97e91e
Author: Daniel Semyonov <cmstr@dsemy.com>
Commit: Daniel Semyonov <cmstr@dsemy.com>
; Reorganize swsw.el
---
swsw.el | 96 ++++++++++++++++++++++++++++++++---------------------------------
1 file changed, 48 insertions(+), 48 deletions(-)
diff --git a/swsw.el b/swsw.el
index d53d85979e..ec78a2fc27 100644
--- a/swsw.el
+++ b/swsw.el
@@ -209,6 +209,54 @@ If set to ‘lighter’, use the mode line lighter of
‘swsw-mode’."
(setq acc (1+ acc))))
(walk-windows #'swsw-update-window nil (swsw--get-scope)))
+;;;; Display functions:
+
+(defun swsw-format-id (window)
+ "Format an ID string for WINDOW."
+ (format swsw-id-format
+ (apply #'string (window-parameter window 'swsw-id))))
+
+(defun swsw--mode-line-display ()
+ "Display window IDs at the beginning of the mode line."
+ (setq-default mode-line-format
+ `((swsw-mode
+ (:eval (swsw-format-id (selected-window))))
+ ,@(assq-delete-all
+ `swsw-mode
+ (default-value `mode-line-format))))
+ (force-mode-line-update t))
+
+(defun swsw--mode-line-hide ()
+ "Remove window IDs from the beginning of the mode line."
+ (setq-default mode-line-format
+ (assq-delete-all
+ 'swsw-mode
+ (default-value 'mode-line-format)))
+ (force-mode-line-update t))
+
+(defun swsw-mode-line-display-function (switch)
+ "Display window IDs at the beginning of the mode line.
+Display window IDs if SWITCH isn't nil, and disable displaying window
+IDs if SWITCH is nil.
+This display function respects ‘swsw-id-format’."
+ (if switch
+ (swsw--mode-line-display)
+ (swsw--mode-line-hide)))
+
+(defun swsw-mode-line-conditional-display-function (switch)
+ "Display window IDs at the beginning of the mode line, conditionally.
+Add a hook to ‘swsw-before-command-hook’ which displays window IDs on
+the mode line and add a hook to ‘swsw-after-command-hook’ which hides
+window IDs from the mode line if SWITCH isn't nil, and remove those
+hooks if SWITCH is nil.
+This display function respects ‘swsw-id-format’."
+ (if switch
+ (progn
+ (add-hook 'swsw-before-command-hook #'swsw--mode-line-display)
+ (add-hook 'swsw-after-command-hook #'swsw--mode-line-hide))
+ (remove-hook 'swsw-before-command-hook #'swsw--mode-line-display)
+ (remove-hook 'swsw-after-command-hook #'swsw--mode-line-hide)))
+
;;;; Window commands:
(defun swsw--run-window-command (fun)
@@ -265,11 +313,6 @@ selection.")
;;;; Simple window switching mode:
-(defun swsw-format-id (window)
- "Format an ID string for WINDOW."
- (format swsw-id-format
- (apply #'string (window-parameter window 'swsw-id))))
-
;;;###autoload
(define-minor-mode swsw-mode
"Minor mode for managing windows using an ID assigned to them
@@ -295,49 +338,6 @@ automatically."
(remove-hook 'minibuffer-exit-hook #'swsw-update)
(remove-hook 'after-delete-frame-functions #'swsw-update)))
-;;;; Display functions:
-
-(defun swsw--mode-line-display ()
- "Display window IDs at the beginning of the mode line."
- (setq-default mode-line-format
- `((swsw-mode
- (:eval (swsw-format-id (selected-window))))
- ,@(assq-delete-all
- `swsw-mode
- (default-value `mode-line-format))))
- (force-mode-line-update t))
-
-(defun swsw--mode-line-hide ()
- "Remove window IDs from the beginning of the mode line."
- (setq-default mode-line-format
- (assq-delete-all
- 'swsw-mode
- (default-value 'mode-line-format)))
- (force-mode-line-update t))
-
-(defun swsw-mode-line-display-function (switch)
- "Display window IDs at the beginning of the mode line.
-Display window IDs if SWITCH isn't nil, and disable displaying window
-IDs if SWITCH is nil.
-This display function respects ‘swsw-id-format’."
- (if switch
- (swsw--mode-line-display)
- (swsw--mode-line-hide)))
-
-(defun swsw-mode-line-conditional-display-function (switch)
- "Display window IDs at the beginning of the mode line, conditionally.
-Add a hook to ‘swsw-before-command-hook’ which displays window IDs on
-the mode line and add a hook to ‘swsw-after-command-hook’ which hides
-window IDs from the mode line if SWITCH isn't nil, and remove those
-hooks if SWITCH is nil.
-This display function respects ‘swsw-id-format’."
- (if switch
- (progn
- (add-hook 'swsw-before-command-hook #'swsw--mode-line-display)
- (add-hook 'swsw-after-command-hook #'swsw--mode-line-hide))
- (remove-hook 'swsw-before-command-hook #'swsw--mode-line-display)
- (remove-hook 'swsw-after-command-hook #'swsw--mode-line-hide)))
-
(provide 'swsw)
;;; swsw.el ends here
- [nongnu] elpa/swsw c08a9b1e58 024/146: ; Fix a docstring, (continued)
- [nongnu] elpa/swsw c08a9b1e58 024/146: ; Fix a docstring, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw b6277eb31f 037/146: ; Indicate that version 1.1 is still in development in the NEWS file, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw a5b25e075f 032/146: Allow setting the scope to the selected frame, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 082e03382e 033/146: * swsw.el (swsw-select): Ensure 'swsw-after-select-hook' runs., ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 40f7a25f82 047/146: ; Add license information to the title page of the Info node, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 3a9848deac 042/146: Add an Info node for the package, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw c2c579a3c9 061/146: Construct multi-character IDs without pre-computing all possible IDs, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 7d82ffeef4 076/146: ; Small modifications to the NEWS file, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 4ceacd0330 132/146: Indicate that some functions are for interactive use only, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw eba70478e0 065/146: Update window information after 'swsw-scope' is customized, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 51fcc776bd 081/146: ; Reorganize swsw.el,
ELPA Syncer <=
- [nongnu] elpa/swsw 2f7500636d 098/146: ; Add 'swsw' to .gitignore, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw db5cd237a7 125/146: ; Documentation improvements, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 6a70afa84f 097/146: ; Documentation fixes, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 384dae5d45 128/146: ; Move local mode declaration to the top of NEWS, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 220c023a2a 088/146: ; Update copyright years, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 73a241cf38 064/146: Ensure 'swsw-id-chars' is set correctly when customized, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 3261f323e9 077/146: ; Bump version to 1.1.2, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw e43021aa7e 112/146: * swsw.el (swsw-format-id): Use 'format-spec' instead of 'format', ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw c864e6d524 144/146: ; Add change log for version 2.1.1, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw d7fe615c3f 049/146: ; Fix inconsistency between requirements in swsw.el and swsw-pkg.el, ELPA Syncer, 2022/05/25