[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/window-commander 51fcc776bd 081/170: ; Reorganize swsw.
From: |
ELPA Syncer |
Subject: |
[elpa] externals/window-commander 51fcc776bd 081/170: ; Reorganize swsw.el |
Date: |
Wed, 28 Jun 2023 19:00:28 -0400 (EDT) |
branch: externals/window-commander
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
- [elpa] externals/window-commander d5ab98b9db 044/170: ; Bump version to 1.1, (continued)
- [elpa] externals/window-commander d5ab98b9db 044/170: ; Bump version to 1.1, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 04ace20d03 063/170: ; Fix indentation and compact structure in some places, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander eba70478e0 065/170: Update window information after 'swsw-scope' is customized, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander d195e574c0 066/170: ; Add latest changes to the news file, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander cf70d1d22c 071/170: ; Make an if statement more readable, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander b3e00165f2 073/170: ; Add latest changes to the NEWS file and indicate that 1.1.2 is WIP, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 522bfb2da0 074/170: ; Add versioning scheme information to the NEWS file, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 3261f323e9 077/170: ; Bump version to 1.1.2, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander ccf0d780a5 078/170: Add support for custom window commands, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander b10ff98f3d 079/170: Add a window deletion command, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 51fcc776bd 081/170: ; Reorganize swsw.el,
ELPA Syncer <=
- [elpa] externals/window-commander 69dfbd08de 083/170: ; Bump version to 2.0, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 8febd864f9 085/170: ; Remove old reference to 'swsw-minibuffer-id', ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 220c023a2a 088/170: ; Update copyright years, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander c884983ae2 090/170: ; Fix makefile for OpenBSD, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 3882424448 099/170: ; Bump to version 2.0.2, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 09bb140ee3 096/170: * swsw.el (swsw-update): Use 'dotimes' instead of 'while', ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 7db205a145 105/170: ; Change all instances of "‘" and "’" to "`" and "'" respectively, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 384dae5d45 128/170: ; Move local mode declaration to the top of NEWS, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander a0c339fbb4 118/170: ; Small documentation change, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 7d6968aa65 093/170: ; Bump version to 2.0.1, ELPA Syncer, 2023/06/28