emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/switchy-window 682bcec0a6: Release 1.2: no code changes


From: ELPA Syncer
Subject: [elpa] externals/switchy-window 682bcec0a6: Release 1.2: no code changes but don't suggest adding lambdas to hooks
Date: Tue, 11 Apr 2023 11:00:46 -0400 (EDT)

branch: externals/switchy-window
commit 682bcec0a63280c149d164c03f63bfdc78a1b08f
Author: Tassilo Horn <tsdh@gnu.org>
Commit: Tassilo Horn <tsdh@gnu.org>

    Release 1.2: no code changes but don't suggest adding lambdas to hooks
---
 README.md         | 20 ++++++++++++--------
 switchy-window.el | 28 ++++++++++++++++------------
 2 files changed, 28 insertions(+), 20 deletions(-)

diff --git a/README.md b/README.md
index 590b6dd1e8..749454f863 100644
--- a/README.md
+++ b/README.md
@@ -27,12 +27,14 @@ globally.  Here are is a sample configuration:
 (keymap-set switchy-window-minor-mode-map "C-<" #'switchy-window)
 
 ;; Or as a substitute for `other-window'.
+(defun my-switchy-window-set-or-unset-key ()
+  (if switchy-window-minor-mode
+      (keymap-global-set "<remap> <other-window>"
+                         #'switchy-window)
+    (keymap-global-unset "<remap> <other-window>")))
+
 (add-hook 'switchy-window-minor-mode-hook
-          (lambda ()
-            (if switchy-window-minor-mode
-                (keymap-global-set "<remap> <other-window>"
-                                   #'switchy-window)
-              (keymap-global-unset "<remap> <other-window>"))))
+          #'my-switchy-window-set-or-unset-key)
 ```
 
 **Hint**: Since the order of window switching is not as obvious as it is with
@@ -40,10 +42,12 @@ globally.  Here are is a sample configuration:
 helpful.  That can be done easily with the stock Emacs `pulse.el`, e.g.:
 
 ```elisp
+(defun my-pulse-line-on-window-selection-change (frame)
+  (when (eq frame (selected-frame))
+    (pulse-momentary-highlight-one-line)))
+
 (add-hook 'window-selection-change-functions
-          (lambda (frame)
-            (when (eq frame (selected-frame))
-              (pulse-momentary-highlight-one-line))))
+          #'my-pulse-line-on-window-selection-change)
 ```
 
 ## Installation
diff --git a/switchy-window.el b/switchy-window.el
index 145b023d5b..758ad87f1c 100644
--- a/switchy-window.el
+++ b/switchy-window.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2023 Free Software Foundation, Inc
 ;;
 ;; Author: Tassilo Horn <tsdh@gnu.org>
-;; Version: 1.1
+;; Version: 1.2
 ;; Keywords: windows
 ;; Homepage: https://sr.ht/~tsdh/switchy-window/
 ;; Repository: https://git.sr.ht/~tsdh/switchy-window
@@ -49,10 +49,12 @@
 ;; `other-window', adding a bit visual feedback to window selection changes can
 ;; be helpful.  That can be done easily with the stock Emacs pulse.el, e.g.:
 ;;
-;;  (add-hook 'window-selection-change-functions
-;;            (lambda (frame)
-;;              (when (eq frame (selected-frame))
-;;                (pulse-momentary-highlight-one-line))))
+;; (defun my-pulse-line-on-window-selection-change (frame)
+;;   (when (eq frame (selected-frame))
+;;     (pulse-momentary-highlight-one-line)))
+;;
+;; (add-hook 'window-selection-change-functions
+;;           #'my-pulse-line-on-window-selection-change)
 
 ;;; Code:
 
@@ -106,16 +108,18 @@ arranged by `switchy-window-minor-mode'."
 No keys are bound by default.  Bind the main command
 `switchy-window' to a key of your liking, e.g.,
 
-  ;; That\\='s what I use.
+  ;; That's what I use.
   (keymap-set switchy-window-minor-mode-map \"C-<\" #\\='switchy-window)
 
   ;; Or as a substitute for `other-window'.
-  (add-hook \\='switchy-minor-mode-hook
-            (lambda ()
-              (if switchy-window-minor-mode
-                  (keymap-global-set \"<remap> <other-window>\"
-                                     #\\='switchy-window)
-                (keymap-global-unset \"<remap> <other-window>\"))))")
+  (defun my-switchy-window-set-or-unset-key ()
+    (if switchy-window-minor-mode
+        (keymap-global-set \"<remap> <other-window>\"
+                           #\\='switchy-window)
+      (keymap-global-unset \"<remap> <other-window>\")))
+
+  (add-hook \\='switchy-window-minor-mode-hook
+            #\\='my-switchy-window-set-or-unset-key)")
 
 ;;;###autoload
 (define-minor-mode switchy-window-minor-mode



reply via email to

[Prev in Thread] Current Thread [Next in Thread]