[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/golden-ratio 134156bbff 42/95: * golden-ratio.el: Allow ru
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/golden-ratio 134156bbff 42/95: * golden-ratio.el: Allow running golden-ratio when switching with other commands than other-window. |
Date: |
Thu, 7 Sep 2023 22:02:12 -0400 (EDT) |
branch: elpa/golden-ratio
commit 134156bbff0f76b1b29b5889c4830e0981d1e3c1
Author: Thierry Volpiatto <thierry.volpiatto@gmail.com>
Commit: Thierry Volpiatto <thierry.volpiatto@gmail.com>
* golden-ratio.el: Allow running golden-ratio when switching with other
commands than other-window.
---
golden-ratio.el | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/golden-ratio.el b/golden-ratio.el
index 77e31fa51d..825d4d2043 100644
--- a/golden-ratio.el
+++ b/golden-ratio.el
@@ -49,8 +49,14 @@ will not cause the window to be resized to the golden ratio."
Switching to a buffer, if any of these functions returns non-nil
will not cause the window to be resized to the golden ratio."
:group 'golden-ratio
- :type 'hook)
+ :type '(repeat symbol))
+(defcustom golden-ratio-extra-commands
+ '(windmove-left windmove-right windmove-down windmove-up)
+ "List of extra commands used to jump to other window."
+ :group 'golden-ratio
+ :type '(repeat symbol))
+
;;; Compatibility
;;
(unless (fboundp 'window-resizable-p)
@@ -62,8 +68,10 @@ will not cause the window to be resized to the golden ratio."
(defun golden-ratio--resize-window (dimensions &optional window)
(with-selected-window (or window (selected-window))
- (let ((nrow (floor (- (first dimensions)
(golden-ratio--window-height-after-balance))))
- (ncol (floor (- (second dimensions)
(golden-ratio--window-width-after-balance)))))
+ (let ((nrow (floor (- (first dimensions)
+ (golden-ratio--window-height-after-balance))))
+ (ncol (floor (- (second dimensions)
+ (golden-ratio--window-width-after-balance)))))
(when (window-resizable-p (selected-window) nrow)
(enlarge-window nrow))
(when (window-resizable-p (selected-window) ncol t)
@@ -114,6 +122,14 @@ will not cause the window to be resized to the golden
ratio."
(around golden-ratio-resize-window)
(prog1 ad-do-it (golden-ratio)))
+(defun golden-ratio--post-command-hook ()
+ (when (or (memq this-command golden-ratio-extra-commands)
+ (and (consp this-command)
+ (loop for com in golden-ratio-extra-commands
+ thereis (or (memq com this-command)
+ (memq (car-safe com) this-command)))))
+ (golden-ratio)))
+
;;;###autoload
(define-minor-mode golden-ratio-mode
"Enable automatic window resizing with golden ratio."
@@ -122,9 +138,11 @@ will not cause the window to be resized to the golden
ratio."
(if golden-ratio-mode
(progn
(add-hook 'window-configuration-change-hook 'golden-ratio)
+ (add-hook 'post-command-hook 'golden-ratio--post-command-hook)
(ad-activate 'other-window)
(ad-activate 'pop-to-buffer))
(remove-hook 'window-configuration-change-hook 'golden-ratio)
+ (remove-hook 'post-command-hook 'golden-ratio--post-command-hook)
(ad-deactivate 'other-window)
(ad-activate 'pop-to-buffer)))
- [nongnu] elpa/golden-ratio d877ceec2c 30/95: Remove commented line., (continued)
- [nongnu] elpa/golden-ratio d877ceec2c 30/95: Remove commented line., ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio f547dee6ad 31/95: (golden-ratio-mode): fix lighter., ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio 0d7e18325d 33/95: Merge pull request #1 from thierryvolpiatto/exp, ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio 7646627bbf 34/95: * golden-ratio.el: Add group., ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio 07fc7d7f7b 35/95: Merge branch 'master' of github.com:thierryvolpiatto/golden-ratio.el, ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio 4871294c94 36/95: * golden-ratio.el (pop-to-buffer): Advice also pop-to-buffer., ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio 6e58cc5871 37/95: Merge branch 'origin-exp', ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio a19b9b0a3b 39/95: * golden-ratio.el: Fix window-resizable-p compatibility with 24.2., ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio 19bacbeaee 40/95: * golden-ratio.el (golden-ratio--resize-window): Remove unuseful nil arg., ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio e66acd10ae 41/95: * golden-ratio.el (window-height-after-balance, window-width-after-balance): Prefix with golden-ratio., ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio 134156bbff 42/95: * golden-ratio.el: Allow running golden-ratio when switching with other commands than other-window.,
ELPA Syncer <=
- [nongnu] elpa/golden-ratio 5411fb2798 45/95: Merge pull request #23 from thierryvolpiatto/master, ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio 38948457fd 48/95: Merge remote-tracking branch 'refs/remotes/upstream/master', ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio 25e95f7833 49/95: Merge pull request #27 from thierryvolpiatto/master, ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio 1df894012e 51/95: Merge pull request #28 from thierryvolpiatto/master, ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio 12b57a3904 53/95: * golden-ratio.el: Fix Issue #29, a typo., ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio 86ffa26952 54/95: Merge pull request #31 from thierryvolpiatto/master, ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio 0b90ffbf02 59/95: Delay window reconfig to fix autofollow, ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio 73e9bd7f94 57/95: Merge remote-tracking branch 'upstream/master', ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio 7da7dd7d53 60/95: * golden-ratio.el (golden-ratio-recenter): New user var, allow recentering, ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio 892e668685 55/95: * golden-ratio.el (golden-ratio): Fix Issue #32 don't recenter and scroll-right., ELPA Syncer, 2023/09/07