Giter VIP home page Giter VIP logo

zoom's Introduction

MELPA Stable MELPA

Zoom

This minor mode takes care of managing the window sizes by enforcing a fixed and automatic balanced layout where the currently selected window is resized according to zoom-size which can be an absolute value in lines/columns, a ratio between the selected window and frame size or even a custom callback.

Screencast

Installation

MELPA package

M-x package-install RET zoom

Local package

M-x package-install-file RET /path/to/zoom.el

Manual

(require 'zoom "/path/to/zoom.el")

Usage

Enable Zoom with M-x zoom-mode otherwise use M-x zoom to manually rearrange windows just once.

Load it automatically with:

(custom-set-variables
 '(zoom-mode t))

See the FAQ.

Example configurations

For a complete reference see M-x customize-group RET zoom.


Resize the selected window using the golden ratio:

(custom-set-variables
 '(zoom-size '(0.618 . 0.618)))

Resize the selected window according to the frame width, for example:

  • 90 columns and 75% of the frame height if the frame width is larger than 1024 pixels;
  • half the frame size otherwise.
(defun size-callback ()
  (cond ((> (frame-pixel-width) 1280) '(90 . 0.75))
        (t                            '(0.5 . 0.5))))

(custom-set-variables
 '(zoom-size 'size-callback))

Override the key binding of balance-windows:

(global-set-key (kbd "C-x +") 'zoom)

Prevent some windows from being resized, for example:

  • dired and markdown major modes;
  • zoom.el init.el buffer names;
  • calculator-related windows;
  • any buffer containing less than 20 lines.
(custom-set-variables
 '(zoom-ignored-major-modes '(dired-mode markdown-mode))
 '(zoom-ignored-buffer-names '("zoom.el" "init.el"))
 '(zoom-ignored-buffer-name-regexps '("^*calc"))
 '(zoom-ignore-predicates '((lambda () (> (count-lines (point-min) (point-max)) 20)))))

(Please note that ignored windows are not resized when selected but all the windows are nevertheless arranged with balance-windows.)

FAQ

What about golden-ratio.el?

I have been a more or less happy golden-ratio.el user for some time when I stared noticing some bugs and sadly I discovered that it is apparently a dead project now, so I decided to write a new and improved minor mode from scratch that implements the same basic idea of automatic window layout as my first attempt at Emacs mode development.

Why when there are several horizontal splits the completions buffer is very small?

This happens when zoom-minibuffer-preserve-layout is non-nil (the default) because most of the space is probably occupied by the zoomed window. The solution (apart from setting the aforementioned variable to nil) is to enable the temp-buffer-resize-mode minor mode:

(custom-set-variables
 '(temp-buffer-resize-mode t))

Why windows are resized even when they are ignored?

When a window is ignored it is simply not resized when the user selects it.

In order to maintain a stable layout, windows are always balanced, then the selected window, unless ignored, is zoomed according to the user preference.

This may cause weird layouts with windows that are designed to be small, e.g., imenu-list. Unfortunately there is no universal solution to this.

The workaround is to set window-size-fixed to t for the buffers whose window must preserve the current size, for example the following fixes the size of the imenu-list window to 30 columns:

(defun my/fix-imenu-size ()
  (with-selected-window (get-buffer-window "*Ilist*")
    (setq window-size-fixed t)
    (window-resize (selected-window) (- 30 (window-total-width)) t t)))

(add-hook 'imenu-list-update-hook 'my/fix-imenu-size)

zoom's People

Contributors

cyrus-and avatar karatasfurkan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

zoom's Issues

Custom zoom levels per mode

I use navi-mode a lot and I would like to always have it zoom to a "narrow" view. So basically it would be the opposite of what most people would want zoom for. Is this possible with zoom?

the top window shrinks too much when a larger minibuffer appears

It's a great emacs package! (I used to use golden-ratio.el before, but it is a bit slow unfortunately)

However I face an unexpected behavior, when i have two split windows and open a minibuffer, the top window will shrink too much (even the top window is selected) as bellow.

untitled3

Of course, i know one of the reasons is my higher minibuffer height (I widen the minibuffer height using (setq ivy-height 30) for ivy ).
If the minibuffer height is default (10 lines), the top window will not be shrink too much.

Do you have any solutions to prevent this behavior?

And my zoom.el setting is

(custom-set-variables
 '(zoom-mode t))
(custom-set-variables
 '(zoom-size '(0.618 . 0.618)))

Let zoom support ignore company-box

Hi @cyrus-and , nice to see you again.

When I complete code with company-box, I found it's slow, Then I profiled it. Found when company-box popup, zoom is also invoked. I hope zoom can ignore company-box. It take many resources. Especially slow down the company completion popup which brain feels more sensitive.

I try to check out company-box whether has buffer name of something else so that I can apply zoom filters. But I have not found clue. Then I check out zoom-handler. I think it should detect whether in company-box frame, if yes, then don't execute zoom.

Trouble cloning

You may want to check your repo permissions, I'm having trouble cloning.

Mouse window select causes region selection

I have the following in the init.el

(use-package zoom
  :defer 5
  :config
  (setq zoom-size '(90 . 30))
  (zoom-mode))

Having 2 windows whenever I mouse click the one on the right I get region selected:

image

`balance-windows` calls changes layout of ignored windows (Treemacs) in an undesirable way

Hello,
First of all, thank you for your work providing a decent alternative to a golden-ratio-mode.
Here's my case:
In my init.el I've added a list of the following zoom options

(with-eval-after-load 'zoom
    (setq zoom-size '(0.6 . 0.6)
          zoom-ignored-major-modes '(treemacs-mode))

But I haven't achieved the desired effect of keeping treemacs window ignored once the zoom mode is turned on.
However, I've taken a look into a code of zoom.el and found out that on every call of zoom--update it balances the window with balance-windows, and since zoom reacts on every window change it also keeps rebalancing treemacs window every time keeping it undesirably large. I'm not entirely sure if it's essential for a zoom to call balance-windows in zoom--update and zoom--off in order to work properly, but I've made a couple of experiments in the fork and it looks like that without these calls it works just as I expected - everything is affected by zoom but treemacs keeps the initial size.
Well, is it then possible to either make balance-windows calls optional or to forward the same set of ignoring conditions that zoom accepts?

I suppose that since balance-windows accepts the window-or-frame optional argument, window-list can be called on an every passing frame, and each buffer of the (window-buffer window) call can probably be tested against something similar to zoom--window-ignored-p.

Calling `avy-goto-char` with several windows open triggers the following error

I'm using avy-mode and I ran into an issue in conjunction with zoom!.

Calling avy-goto-char with several windows open triggers the following error

Debugger entered--Lisp error: (args-out-of-range 0 1)
  add-text-properties(0 1 (line-prefix #("**" 0 2 (face org-indent))) "")
  avy--overlay("" 7362 7361 #<window 302 on org/todo.org> #f(compiled-function (str old-str) #<bytecode 0x4c2c53dd>))
  avy--overlay-at-full((105) ((7362 . 7363) . #<window 302 on org/todo.org>))
  avy-read(((97 leaf (85164 . 85165) . #<window 305 on org/notes.org>) (115 leaf (85164 . 85165) . #<window 290 on org/notes.org>) (100 leaf (85164 . 85165) . #<window 304 on org/notes.org>) (102 leaf (85228 . 85229) . #<window 305 on org/notes.org>) (106 leaf (85346 . 85347) . #<window 305 on org/notes.org>) (107 leaf (8206 . 8207) . #<window 302 on org/todo.org>) (108 leaf (8142 . 8143) . #<window 302 on org/todo.org>) (119 leaf (7960 . 7961) . #<window 302 on org/todo.org>) (101 leaf (7912 . 7913) . #<window 302 on org/todo.org>) (114 leaf (7765 . 7766) . #<window 302 on org/todo.org>) (117 leaf (7514 . 7515) . #<window 302 on org/todo.org>) (105 leaf (7362 . 7363) . #<window 302 on org/todo.org>) (111 (97 leaf (7361 . 7362) . #<window 302 on org/todo.org>) (115 leaf (151 . 152) . #<window 300 on *Backtrace*>) (100 leaf (21 . 22) . #<window 300 on *Backtrace*>))) avy--overlay-at-full avy--remove-leading-chars)
  avy--process-1((((85164 . 85165) . #<window 305 on org/notes.org>) ((85164 . 85165) . #<window 290 on org/notes.org>) ((85164 . 85165) . #<window 304 on org/notes.org>) ((85228 . 85229) . #<window 305 on org/notes.org>) ((85346 . 85347) . #<window 305 on org/notes.org>) ((8206 . 8207) . #<window 302 on org/todo.org>) ((8142 . 8143) . #<window 302 on org/todo.org>) ((7960 . 7961) . #<window 302 on org/todo.org>) ((7912 . 7913) . #<window 302 on org/todo.org>) ((7765 . 7766) . #<window 302 on org/todo.org>) ((7514 . 7515) . #<window 302 on org/todo.org>) ((7362 . 7363) . #<window 302 on org/todo.org>) ((7361 . 7362) . #<window 302 on org/todo.org>) ((151 . 152) . #<window 300 on *Backtrace*>) ((21 . 22) . #<window 300 on *Backtrace*>)) avy--overlay-at-full)
  avy--process((((85164 . 85165) . #<window 305 on org/notes.org>) ((85164 . 85165) . #<window 290 on org/notes.org>) ((85164 . 85165) . #<window 304 on org/notes.org>) ((85228 . 85229) . #<window 305 on org/notes.org>) ((85346 . 85347) . #<window 305 on org/notes.org>) ((8206 . 8207) . #<window 302 on org/todo.org>) ((8142 . 8143) . #<window 302 on org/todo.org>) ((7960 . 7961) . #<window 302 on org/todo.org>) ((7912 . 7913) . #<window 302 on org/todo.org>) ((7765 . 7766) . #<window 302 on org/todo.org>) ((7514 . 7515) . #<window 302 on org/todo.org>) ((7362 . 7363) . #<window 302 on org/todo.org>) ((7361 . 7362) . #<window 302 on org/todo.org>) ((151 . 152) . #<window 300 on *Backtrace*>) ((21 . 22) . #<window 300 on *Backtrace*>)) avy--overlay-at-full)
  avy--generic-jump(")" nil at-full)
  avy-goto-char(41 nil)
  funcall-interactively(avy-goto-char 41 nil)
  call-interactively(avy-goto-char nil nil)
  command-execute(avy-goto-char)

Let me know if you can make any sense of this gobbledigook.

flickering on ess-display-help-on-object

When calling help on an object in an ess buffer (via ess-display-help-on-object), I get some weird flickering in the Emacs window. Not sure how else to describe it, but I see there have been some similar issues experiences previously (#1 and #2).

I'm on:

Doom v2.0.9 (HEAD -> develop 315ae1624 2020-11-17 12:46:10 -0500)
ProductName:	Mac OS X
ProductVersion:	10.15.7
BuildVersion:	19H15

Any help is greatly appreciated. Thanks.

EDIT

Actually, this seems to also be in other help buffers too... not at noticeable as in ess (which I use regularly), but still there.

Creating windows with C-x 3 causes Emacs to freeze and hang

H-hi...

I have the following zoom! configuration:

;; Zoom!
(use-package zoom
  :config
  (zoom-mode t)
  (setf zoom-size '(0.52 . 0.55))
  )

Looks good, right? Well the problem is that creating windows with C-x 3 causes Emacs to freeze and hang. With (80 . 0.55) instead, this doesn't happen.

Perhaps related is the following: resizing the frame so that the widths of some windows are below window-min-width (which I set to 25) causes Emacs to freeze and hang. This doesn't happen without zoom enabled.

Let me know if there's anything you need from me to help debug this damned bug.

Clicking on the current buffer zooms the previously selected window

This happens with Emacs version 24 and 25 but not with version 26.

This is caused by the following check which is used to defer the zooming of another window when the user select some text there (introduced by 40e03c3 which actually fixed #4, but for Emacs 26 only breaking Zoom for prior versions).

zoom/zoom.el

Line 165 in 8668caa

(if (or track-mouse

The point seems to be that in the above context with Emacs 26 track-mouse is nil when the event happens in the current buffer and t otherwise, conversely to what happens with 24 and 25. This looks like a lucky bug with version 26 or maybe it's just a matter of when the handler is called (by the window-size-change-functions)...

Weird error when doing a soft reset from magit?

Not sure what this is about, but I tried to do a soft reset from magit (with evil-magit that's O s from magit-status buffer, I suppose that's the function magit-reset-soft), and got the following error and some weird behavior:

Debugger entered--Lisp error: (wrong-type-argument window-valid-p #<window 158>)
  window-frame(#<window 158>)
  internal--before-with-selected-window(#<window 158>)
  zoom--hook-handler()
  read-from-minibuffer("Soft reset to: " nil (keymap keymap (S-down . ivy-next-history-element) (S-up . ivy-previous-history-element) (11 . ivy-previous-line) (C-return . ivy-immediate-done) (S-return . ivy-dispatching-done-hydra) (67108911 . keyboard-escape-quit) (escape . keyboard-escape-quit) (3 keymap (19 . ivy-rotate-sort) (1 . ivy-toggle-ignore) (15 . ivy-occur)) (67108903 . ivy-avy) (33554464 . ivy-restrict-to-matches) (15 . hydra-ivy/body) (22 . ivy-scroll-up-command) (prior . ivy-scroll-down-command) (next . ivy-scroll-up-command) (7 . minibuffer-keyboard-quit) (32 . self-insert-command) (18 . ivy-reverse-i-search) (19 . ivy-next-line-or-history) (remap keymap (describe-mode . ivy-help) (kill-ring-save . ivy-kill-ring-save) (kill-line . ivy-kill-line) (scroll-down-command . ivy-scroll-down-command) (scroll-up-command . ivy-scroll-up-command) (end-of-buffer . ivy-end-of-buffer) (beginning-of-buffer . ivy-beginning-of-buffer) (kill-word . ivy-kill-word) (forward-char . ivy-forward-char) (delete-char . ivy-delete-char) (backward-kill-word . ivy-backward-kill-word) (backward-delete-char-untabify . ivy-backward-delete-char) (delete-backward-char . ivy-backward-delete-char) (previous-line . ivy-previous-line) (next-line . ivy-next-line)) (9 . ivy-partial-or-done) (10 . ivy-next-line) (27 keymap (1 . ivy-read-action) (15 . ivy-dispatching-call) (111 . ivy-dispatching-done-hydra) (105 . ivy-insert-current) (106 . ivy-yank-word) (114 . ivy-toggle-regexp-quote) (16 . ivy-previous-line-and-call) (14 . ivy-next-line-and-call) (118 . ivy-scroll-down-command) (112 . ivy-previous-history-element) (110 . ivy-next-history-element) (10 . ivy-immediate-done) (13 . ivy-call)) (13 . ivy-done)) nil magit-revision-history)
  ivy-read("Soft reset to: " #f(compiled-function (string pred action) #<bytecode 0x1ef0a85>) :predicate nil :require-match nil :initial-input nil :preselect "master" :def "master" :history magit-revision-history :keymap nil :sort t :caller nil)
  ivy-completing-read("Soft reset to: " #f(compiled-function (string pred action) #<bytecode 0x1ef0a85>) nil nil nil magit-revision-history "master" nil)
  completing-read("Soft reset to: " #f(compiled-function (string pred action) #<bytecode 0x1ef0a85>) nil nil nil magit-revision-history "master")
  magit-builtin-completing-read("Soft reset to: " ("HEAD" "bind-map" "ccud" "general" "master" "organization" "straight" "origin/HEAD" "origin/bind-map" "origin/emacs-bind-map-test" "origin/general" "origin/idea-grouping" "origin/master" "origin/straight") nil nil nil magit-revision-history "master")
  magit-completing-read("Soft reset to" ("HEAD" "bind-map" "ccud" "general" "master" "organization" "straight" "origin/HEAD" "origin/bind-map" "origin/emacs-bind-map-test" "origin/general" "origin/idea-grouping" "origin/master" "origin/straight") nil nil nil magit-revision-history "master")
  magit-read-branch-or-commit("Soft reset to")
  byte-code("\300\301!C\207" [magit-read-branch-or-commit "Soft reset to"] 2)
  call-interactively(magit-reset-soft)
  magit-invoke-popup-action(115)
  funcall-interactively(magit-invoke-popup-action 115)
  call-interactively(magit-invoke-popup-action nil nil)
  command-execute(magit-invoke-popup-action)

Excluded buffer weirdness

I'm using doom emacs on the native-comp branch. Maybe that means all bets are off, but I'll give this a shot since the latest gccemacs updates indicate that compatibility is almost 100%.

If I enable zoom-mode and add helpful-mode and "^*mu4e" to the exclusion list, the result is that most windows zoom except mu4e and helpful buffers. However, if a helpful-mode buffer is open, I can't open other help buffers in the same window.

I get this error:

Error during redisplay: (#[128 "\300\302๏ฟฝ\"\300\301๏ฟฝ\"\210\207" [apply zoom--handler #[128 "\300\301๏ฟฝ\"\210\300\302๏ฟฝ\"\207" [apply redisplay--pre-redisplay-functions ignore nil] 4 nil nil] nil] 5 nil nil] t) signaled (wrong-type-argument window-valid-p #<window 24607>)

Relatedly, mu4e buffers seem to get resized to exactly half the frame even though they should be left alone.

Odd behavior of zoom

Steps: C-x 3 C-x 2 C-down (windmove-down) C-x 3
Last window shrinks way much, but there are lots of space...
Now do C-up (windmove-up) - layout gets fixed.

zoom

Used (setq zoom-size '(0.618 . 0.618))

How can I ignore Minimap's buffer in Zoom-Mode?

I have been use zoom for managing window size.

I want to use minimap like sublime, vscode, kate ..etc
So I install minimap.el(https://github.com/dengste/minimap).

But I have problem. Minimap buffer's window is too big!!

  • Minimap with Zoom mode

withzoom
The numbers at the bottom of the window are removed.

  • Minimap without Zoom mode

withoutzoom

I try ignored buffer-name, " *MINIMAP*".(All minimap have same name.)

(defcustom minimap-buffer-name " *MINIMAP*" "Buffer name of minimap sidebar." :type 'string :group 'minimap)

But this problem doesn't solved.

How can I ignore Minimap's buffer in Zoom-Mode?

zoom-mode caused weird behavior in image-mode

When I use [C-x C-f] to open filename.jpg or open jpg image file from Dired. The buffer displays empty. But open filename.png is fine. But in opened jpg image buffer, I press M-< , the image is displayed. I guess the image is correctly opened and displayed, just zoom-mode caused point offset position. Then I verified this bug with minimal Emacs config emacs -q.

ispell and hydra windows are getting resized

When using ispell and hydra the windows are resized like so:

hydra

ispell

Using zoom-ignored-buffer-names doesn't seem to solve the issue nor does zoom-ignore-predicates. I know that setting hydra-lv to nil will fix the issue for hydra but ideally I'd like to be able to properly exclude windows.

woes with helm and which-key

This is more of a feature request than anything else, since the behavior that is annoying me is zoom--update working as expected (and this is way I dispensed myself from filling the issue template)

I use which-key and helm, both of which create temporary windows with the right dimensions (for an opportune definition of right). I was able to make zoom ignore them by defining an opportune predicates but, as expected, zoom balances them an the result is not niceโ„ข.

Workaround like the one suggested in the FAQ for imenu can't be used, because both packages resize their own window when the content changes, so making them fixed-size is not an option.

As I see it there are two possible solutions to this problem:

  1. add a customization that allows to disable windows balancing altogether
  2. add a way to specify that some windows should not balanced (i.e. they should be considered as of fixed size as far as ``balance-windows` is concerned

While the first solution is easy to implement (I may submit a pull-request if you're interested) it is surely an overkill. I'm thinking about a way to implement the second solution but, for now, I'm not even sure it would work. Should I find a way to implement it I'll post a pull request in a follow-up to this issue (If you're interested, that is).

Zoom does not work with LSP buffers (dap-mode)

As this screenshot shows:

image

And here is my config:

(use-package zoom
  :ensure t
  :hook (after-init . zoom-mode)
  :config (setq zoom-size '(0.618 . 0.618))
  
  (add-to-list 'zoom-ignored-major-modes 'helm-major-mode)
  (add-to-list 'zoom-ignored-major-modes 'ediff-mode)

  ;; Helm
  (add-to-list 'zoom-ignored-buffer-name-regexps " *Minibuf-1*")
  (add-to-list 'zoom-ignored-buffer-name-regexps "^*helm")
  (add-to-list 'zoom-ignored-buffer-name-regexps "*helm org inbuffer*")
  (add-to-list 'zoom-ignored-buffer-name-regexps "*Org Help*")
  
  ;; (add-to-list 'zoom-ignored-buffer-name-regexps "^*.pdf")

  ;; (setq zoom-ignore-predicates (quote ((lambda nil (window-minibuffer-p)))))
  ;; (setq zoom-ignore-predicates '((lambda () (< (count-lines (point-min) (point-max)) 20))))
  
  ;; FIXME
  ;; Ediff
  (add-to-list 'zoom-ignored-buffer-name-regexps "*Diff*")
  (add-to-list 'zoom-ignored-buffer-name-regexps "^*Ediff")
  (add-to-list 'zoom-ignored-buffer-name-regexps "^*Ediff Control Panel*")
  (add-to-list 'zoom-ignored-buffer-name-regexps "^*Ediff Registry*")
  ;; don't resize ediff control panel window.
  (defun my/fix-ediff-size ()
    (with-selected-window (get-buffer-window "*Ediff Control Panel*")
      (setq window-size-fixed t)
      (window-resize (selected-window) (- 5 (window-total-height)) nil t)))
  (add-hook 'ediff-after-setup-windows-hook 'my/fix-ediff-size))

My Emacs version: GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.17.3) of 2020-06-20
zoom-mode version: 20200106.1204 from MELPA

How to ignore ediff control panel buffer?

When I open ediff 3-ways diff. I found I can't ignore throgh following settings:

(add-to-list 'zoom-ignored-major-modes 'ediff-mode)
  (add-to-list 'zoom-ignored-buffer-name-regexps "^*Ediff Control Panel*")
  (add-to-list 'zoom-ignored-buffer-name-regexps "^*Ediff Registry*")

Dired-sidebar unusable with zoom enabled

I can't use Dired-sidebar when I have zoom enabled.

Edit:
When I have both enabled, If I focus on the dired-sidebar windows buffer by clicking on it, It focus there for like 200ms, then focus back to the previous window buffer.
And after debugging, this happens only when I use zoom. if I delete the zoom, the issue disappear, and come back if I add it back.

Occupying memory when typing continuously

Hi! Thanks for treating this issue before!

I have a question about Memory Usage.

When I split two buffers and input characters continuously, the operation is very heavy as bellow (keep pressing a in this example)

untitled4

And I got a Profiler-report (M-x profiler-report)

- redisplay_internal (C function)                       2,263,433,900  94%
 - zoom--handler                                        2,229,488,180  93%
  - zoom--update                                        2,229,449,108  93%
   - balance-windows                                    1,186,711,412  49%
    - apply                                             1,186,711,412  49%
     - ad-Advice-balance-windows                        1,186,711,412  49%
      + #<compiled 0x4009ec51>                          1,186,711,412  49%
   - zoom--resize                                       1,042,575,784  43%
    - zoom--resize-one-dimension                        1,042,569,400  43%
     - window-resize                                    1,041,707,832  43%
      + window--resize-siblings                             1,579,432   0%
      + run-window-configuration-change-hook                  358,484   0%
      + window--resizable-p                                    23,232   0%
       frame-height                                           429,720   0%
       frame-width                                            414,952   0%
     + window-resizable                                        16,896   0%
     zoom--window-ignored-p                                   161,912   0%
  + #<compiled 0x44947517>                                     11,616   0%
 + eval                                                    33,058,980   1%
 + jit-lock-function                                          554,568   0%
 + keymap-canonicalize                                        131,040   0%
 + page-break-lines--update-display-tables                     81,312   0%
 + menu-bar-update-buffers                                     31,316   0%
 + #<compiled 0x40c13c45>                                      19,008   0%
   file-remote-p                                                5,120   0%
   undo-tree-update-menu-bar                                    2,112   0%

Do you know the reason why zoom--handler occupies memory a lot ?

Zoom font-size together with windows?

Lovely people from internet, thank you for this package ^w^

I wonder about adding font-size increase/decrease - main window with larger font, side windows with smaller ones. Would anyone find something like this useful? Well, and even if not, would you have any hints or thoughts on how it could be implemented?

Cheers!

Doom-emacs: wrong-type-argument stringp nil

I'm using doom-emacs, and config like this:

(use-package zoom
  :after-call pre-command-hook
  :config
  (remove-hook 'window-configuration-change-hook #'zoom)
  (add-hook 'doom-switch-window-hook #'zoom)
  (custom-set-variables
   '(zoom-size '(0.7 . 0.7))
   '(zoom-ignored-major-modes '(dired-mode vterm-mode help-mode helpful-mode rxt-help-mode help-mode-menu org-mode))
   '(zoom-ignored-buffer-names '("*doom:scratch*" "*info*" "*helpful variable: argv*"))
   '(zoom-ignored-buffer-name-regexps '("^*calc" "\\*helpful variable: .*\\*"))
   '(zoom-ignore-predicates '((lambda () (> (count-lines (point-min) (point-max)) 20))))
   ))

This happens when open helpful-mode or org-mode edit-src

image

Backtrace
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  doom-run-switch-buffer-hooks-a(#f(compiled-function (buffer-or-name &optional action frame) "Display BUFFER-OR-NAME in some window, without selecting it.\nBUFFER-OR-NAME must be a buffer or a string naming a live buffer.\nReturn the window chosen for displaying that buffer, or nil if no\nsuch window is found.\n\nOptional argument ACTION, if non-nil, should specify a buffer\ndisplay action of the form (FUNCTIONS . ALIST).  FUNCTIONS is\neither an \"action function\" or a possibly empty list of action\nfunctions.  ALIST is a possibly empty \"action alist\".\n\nAn action function is a function that accepts two arguments: the\nbuffer to display and an action alist.  Based on those arguments,\nit should try to display the buffer in a window and return that\nwindow.  An action alist is an association list mapping symbols\nto values.  Action functions use the action alist passed to them\nto fine-tune their behaviors.\n\n`display-buffer' builds a list of action functions and an action\nalist by combining any action functions and alists specified by\n`display-buffer-overriding-action', `display-buffer-alist', the\nACTION argument, `display-buffer-base-action', and\n`display-buffer-fallback-action' (in order).  Then it calls each\nfunction in the combined function list in turn, passing the\nbuffer as the first argument and the combined action alist as the\nsecond argument, until one of the functions returns non-nil.\n\nAction functions and the action they try to perform are:\n `display-buffer-same-window' -- Use the selected window.\n `display-buffer-reuse-window' -- Use a window already showing\n    the buffer.\n `display-buffer-in-previous-window' -- Use a window that did\n    show the buffer before.\n `display-buffer-use-some-window' -- Use some existing window.\n `display-buffer-pop-up-window' -- Pop up a new window.\n `display-buffer-below-selected' -- Use or pop up a window below\n    the selected one.\n `display-buffer-at-bottom' -- Use or pop up a window at the\n    bottom of the selected frame.\n `display-buffer-pop-up-frame' -- Show the buffer on a new frame.\n `display-buffer-in-child-frame' -- Show the buffer in a\n    child frame.\n `display-buffer-no-window' -- Do not display the buffer and\n    have `display-buffer' return nil immediately.\n\nAction alist entries are:\n `inhibit-same-window' -- A non-nil value prevents the same\n    window from being used for display.\n `inhibit-switch-frame' -- A non-nil value prevents any frame\n    used for showing the buffer from being raised or selected.\n `reusable-frames' -- The value specifies the set of frames to\n    search for a window that already displays the buffer.\n    Possible values are nil (the selected frame), t (any live\n    frame), visible (any visible frame), 0 (any visible or\n    iconified frame) or an existing live frame.\n `pop-up-frame-parameters' -- The value specifies an alist of\n    frame parameters to give a new frame, if one is created.\n `window-height' -- The value specifies the desired height of the\n    window chosen and is either an integer (the total height of\n    the window), a floating point number (the fraction of its\n    total height with respect to the total height of the frame's\n    root window) or a function to be called with one argument -\n    the chosen window.  The function is supposed to adjust the\n    height of the window; its return value is ignored.  Suitable\n    functions are `shrink-window-if-larger-than-buffer' and\n    `fit-window-to-buffer'.\n `window-width' -- The value specifies the desired width of the\n    window chosen and is either an integer (the total width of\n    the window), a floating point number (the fraction of its\n    total width with respect to the width of the frame's root\n    window) or a function to be called with one argument - the\n    chosen window.  The function is supposed to adjust the width\n    of the window; its return value is ignored.\n `preserve-size' -- The value should be either (t . nil) to\n    preserve the width of the chosen window, (nil . t) to\n    preserve its height or (t . t) to preserve its height and\n    width in future changes of the window configuration.\n `window-parameters' -- The value specifies an alist of window\n    parameters to give the chosen window.\n `allow-no-window' -- A non-nil value means that `display-buffer'\n    may not display the buffer and return nil immediately.\n\nThe entries `window-height', `window-width' and `preserve-size'\nare applied only when the window used for displaying the buffer\nnever showed another buffer before.\n\nThe ACTION argument can also have a non-nil and non-list value.\nThis means to display the buffer in a window other than the\nselected one, even if it is already displayed in the selected\nwindow.  If called interactively with a prefix argument, ACTION\nis t.  Non-interactive calls should always supply a list or nil.\n\nThe optional third argument FRAME, if non-nil, acts like a\n(reusable-frames . FRAME) entry appended to the action alist\nspecified by the ACTION argument." ... #<bytecode 0x44239489>) #<buffer *helpful variable: helm-ff-avfs-directory*> nil)
  apply(doom-run-switch-buffer-hooks-a #f(compiled-function (buffer-or-name &optional action frame) "Display BUFFER-OR-NAME in some window, without selecting it.\nBUFFER-OR-NAME must be a buffer or a string naming a live buffer.\nReturn the window chosen for displaying that buffer, or nil if no\nsuch window is found.\n\nOptional argument ACTION, if non-nil, should specify a buffer\ndisplay action of the form (FUNCTIONS . ALIST).  FUNCTIONS is\neither an \"action function\" or a possibly empty list of action\nfunctions.  ALIST is a possibly empty \"action alist\".\n\nAn action function is a function that accepts two arguments: the\nbuffer to display and an action alist.  Based on those arguments,\nit should try to display the buffer in a window and return that\nwindow.  An action alist is an association list mapping symbols\nto values.  Action functions use the action alist passed to them\nto fine-tune their behaviors.\n\n`display-buffer' builds a list of action functions and an action\nalist by combining any action functions and alists specified by\n`display-buffer-overriding-action', `display-buffer-alist', the\nACTION argument, `display-buffer-base-action', and\n`display-buffer-fallback-action' (in order).  Then it calls each\nfunction in the combined function list in turn, passing the\nbuffer as the first argument and the combined action alist as the\nsecond argument, until one of the functions returns non-nil.\n\nAction functions and the action they try to perform are:\n `display-buffer-same-window' -- Use the selected window.\n `display-buffer-reuse-window' -- Use a window already showing\n    the buffer.\n `display-buffer-in-previous-window' -- Use a window that did\n    show the buffer before.\n `display-buffer-use-some-window' -- Use some existing window.\n `display-buffer-pop-up-window' -- Pop up a new window.\n `display-buffer-below-selected' -- Use or pop up a window below\n    the selected one.\n `display-buffer-at-bottom' -- Use or pop up a window at the\n    bottom of the selected frame.\n `display-buffer-pop-up-frame' -- Show the buffer on a new frame.\n `display-buffer-in-child-frame' -- Show the buffer in a\n    child frame.\n `display-buffer-no-window' -- Do not display the buffer and\n    have `display-buffer' return nil immediately.\n\nAction alist entries are:\n `inhibit-same-window' -- A non-nil value prevents the same\n    window from being used for display.\n `inhibit-switch-frame' -- A non-nil value prevents any frame\n    used for showing the buffer from being raised or selected.\n `reusable-frames' -- The value specifies the set of frames to\n    search for a window that already displays the buffer.\n    Possible values are nil (the selected frame), t (any live\n    frame), visible (any visible frame), 0 (any visible or\n    iconified frame) or an existing live frame.\n `pop-up-frame-parameters' -- The value specifies an alist of\n    frame parameters to give a new frame, if one is created.\n `window-height' -- The value specifies the desired height of the\n    window chosen and is either an integer (the total height of\n    the window), a floating point number (the fraction of its\n    total height with respect to the total height of the frame's\n    root window) or a function to be called with one argument -\n    the chosen window.  The function is supposed to adjust the\n    height of the window; its return value is ignored.  Suitable\n    functions are `shrink-window-if-larger-than-buffer' and\n    `fit-window-to-buffer'.\n `window-width' -- The value specifies the desired width of the\n    window chosen and is either an integer (the total width of\n    the window), a floating point number (the fraction of its\n    total width with respect to the width of the frame's root\n    window) or a function to be called with one argument - the\n    chosen window.  The function is supposed to adjust the width\n    of the window; its return value is ignored.\n `preserve-size' -- The value should be either (t . nil) to\n    preserve the width of the chosen window, (nil . t) to\n    preserve its height or (t . t) to preserve its height and\n    width in future changes of the window configuration.\n `window-parameters' -- The value specifies an alist of window\n    parameters to give the chosen window.\n `allow-no-window' -- A non-nil value means that `display-buffer'\n    may not display the buffer and return nil immediately.\n\nThe entries `window-height', `window-width' and `preserve-size'\nare applied only when the window used for displaying the buffer\nnever showed another buffer before.\n\nThe ACTION argument can also have a non-nil and non-list value.\nThis means to display the buffer in a window other than the\nselected one, even if it is already displayed in the selected\nwindow.  If called interactively with a prefix argument, ACTION\nis t.  Non-interactive calls should always supply a list or nil.\n\nThe optional third argument FRAME, if non-nil, acts like a\n(reusable-frames . FRAME) entry appended to the action alist\nspecified by the ACTION argument." ... #<bytecode 0x44239489>) (#<buffer *helpful variable: helm-ff-avfs-directory*> nil))
  display-buffer(#<buffer *helpful variable: helm-ff-avfs-directory*> nil)
  #f(compiled-function (buffer-or-name &optional action norecord) "Display buffer specified by BUFFER-OR-NAME and select its window.\nBUFFER-OR-NAME may be a buffer, a string (a buffer name), or nil.\nIf it is a string not naming an existent buffer, create a buffer\nwith that name.  If BUFFER-OR-NAME is nil, choose some other\nbuffer.  In either case, make that buffer current and return it.\n\nThis uses `display-buffer' as a subroutine.  The optional ACTION\nargument is passed to `display-buffer' as its ACTION argument.\nSee `display-buffer' for more information.  ACTION is t if called\ninteractively with a prefix argument, which means to pop to a\nwindow other than the selected one even if the buffer is already\ndisplayed in the selected window.\n\nIf a suitable window is found, select that window.  If it is not\non the selected frame, raise that window's frame and give it\ninput focus.\n\nOptional third arg NORECORD non-nil means do not put this buffer\nat the front of the list of recently selected ones." (interactive #f(compiled-function () #<bytecode 0x1ffbdb1f1385>)) #<bytecode 0x43fd3f95>)(#<buffer *helpful variable: helm-ff-avfs-directory*>)
  apply(#f(compiled-function (buffer-or-name &optional action norecord) "Display buffer specified by BUFFER-OR-NAME and select its window.\nBUFFER-OR-NAME may be a buffer, a string (a buffer name), or nil.\nIf it is a string not naming an existent buffer, create a buffer\nwith that name.  If BUFFER-OR-NAME is nil, choose some other\nbuffer.  In either case, make that buffer current and return it.\n\nThis uses `display-buffer' as a subroutine.  The optional ACTION\nargument is passed to `display-buffer' as its ACTION argument.\nSee `display-buffer' for more information.  ACTION is t if called\ninteractively with a prefix argument, which means to pop to a\nwindow other than the selected one even if the buffer is already\ndisplayed in the selected window.\n\nIf a suitable window is found, select that window.  If it is not\non the selected frame, raise that window's frame and give it\ninput focus.\n\nOptional third arg NORECORD non-nil means do not put this buffer\nat the front of the list of recently selected ones." (interactive #f(compiled-function () #<bytecode 0x1ffbdb1a26c5>)) #<bytecode 0x43fd3f95>) #<buffer *helpful variable: helm-ff-avfs-directory*>)
  pop-to-buffer(#<buffer *helpful variable: helm-ff-avfs-directory*>)
  helpful-variable(helm-ff-avfs-directory)
  #f(compiled-function (x) #<bytecode 0x1ffbda7262d9>)("helm-ff-avfs-directory")
  ivy-call()
  ivy-read("Describe variable: " [:all-files hasNextPage ansi-color-apply-overlay-face epg-context-signers locals 0 -is-infix\? message-all-epg-keys-available-p magit-submodule-update edebug-trace epg--status-VALIDSIG magit-reflog-commit help-variable 0 org-emphasis-regexp-components mml-secure-smime-sign-with-sender url-cookie-multiple-line vc-hg--read-u8 no-activate nsm-permanent-host-settings doom-modeline-eldoc-bar 0 dired-at-point avl-tree--stack-store--cmacro cl-print--preprocess which-key-side-window-max-height selinux-context hide-mode-line-mode-map wicon content-type 0 0 cl--struct-epg-signature-p evil-visual-exchange-corners \" f-directory\? Edebug\ All\ Defs time-format Info-apropos-find-file \' :name-match helm-grep-mode-jump-other-window-forward tramp-cache-data org-babel-results-keyword gorepl-run-load-current-file magit-diff-wash-hunk not-at-beginning-of-line log-edit-set-header expired calendar-debug-sexp ...] :predicate counsel--variable-p :require-match t :history counsel-describe-symbol-history :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :preselect "" :action #f(compiled-function (x) #<bytecode 0x1ffbda7262d9>) :caller counsel-describe-variable)
  counsel-describe-variable()
  funcall-interactively(counsel-describe-variable)
  call-interactively(counsel-describe-variable nil nil)
  command-execute(counsel-describe-variable)
Versions
  • emacs:
    GNU Emacs 27.0.91
    Copyright (C) 2020 Free Software Foundation, Inc.
    GNU Emacs comes with ABSOLUTELY NO WARRANTY.
    You may redistribute copies of GNU Emacs
    under the terms of the GNU General Public License.
    For more information about these matters, see the file named COPYING.

  • doom-emacs: v2.0.9

How do I zoom to resize when frame is less than a particular width and/or height?

What I want is for zoom to kick in when I have less screen real estate (my laptop in particular). I have the following config:

(use-package! zoom
  :hook (doom-first-input . zoom-mode)
  :config
  (defun size-callback ()
    "Set the zoom-size by frame width"
    (cond ((< (frame-pixel-width) 1280) '(0.618 . 0.618))
          (t                            '(0.5 . 0.5))))
  (setq zoom-size 'size-callback
        ;; zoom-size '(0.618 . 0.618)
        zoom-ignored-major-modes '(dired-mode vterm-mode help-mode helpful-mode rxt-help-mode help-mode-menu org-mode)
        zoom-ignored-buffer-names '("*doom:scratch*" "*info*" "*helpful variable: argv*")
        zoom-ignored-buffer-name-regexps '("^\\*calc" "\\*helpful variable: .*\\*")
        zoom-ignore-predicates (list (lambda () (< (count-lines (point-min) (point-max)) 20))))
  )

This works as you would expect, but only when there are 3 or more frames, regardless of the frame width or height.

Is what I want possible? If so, if you could help me configure this that would be greatly appreciated.

helm flicker when typing

Hi,

I experience flickering doubled buffer text whenever I type in a helm selection.

I've currently got:

(setq zoom-size '(0.58 . 0.618))
(setq zoom-ignored-buffer-name-regexps '("^*helm" "^helm"))

Here is a webm of Helm m-x: https://u.teknik.io/d78Yn.webm

Emacs Crashes When Opening Certain Buffers

System: Arch Linux
Emacs Version: 27.0.50

Using the popular Doom-Emacs, opening certain buffers immediately causes emacs to crash. For instance, when in Zoom-Mode and opening neotree Emacs stops responding and is subsequently killed.

Window sizes change when dropping into minibuffer

When using e.g. eval-expression, windows change size (they get balanced). Is this intended behavior? It's pretty distracting as when I go to search a buffer with evil-ex-search-forward, the window sizes change.

With zoom mode on entire buffer contents deleted

A while ago, I started having issues with zoom where it would stop working and my entire buffer contents would be deleted (very annoying when used in combination with undo-tree where the history is corrupted and then I have to go in and restore the file from a backup, but I haven't been using undo tree for a while). Afterwards, I have to disable zoom mode for anything to work right. I've mostly stopped using zoom because I couldn't easily debug this (it's hard to quickly replicate and I haven't been able to get it to show up when edebugging balance-windows-2), but maybe someone else has encountered this? I can try to look into this further at some point when I have time. I'm sure this is probably related to interaction with some other package or configuration.

Here's an example backtrace:

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  balance-windows-2(#<window 80> t)
  balance-windows-1(#<window 80> t)
  balance-windows()
  zoom--update()
  zoom--handler(#<window 10 on log.org>)
  apply(zoom--handler #<window 10 on log.org>)
  select-window(#<window 10 on log.org>)
  windmove-do-window-select(left nil)
  windmove-left(nil)
  funcall-interactively(windmove-left nil)
  call-interactively(windmove-left nil nil)
  command-execute(windmove-left)

Add a predicate for balancing windows?

First I want to thank you for this great package.

However, sometimes the behavior of balancing windows is not ideal. For example, I have (setq ediff-window-setup-function 'ediff-setup-windows-plain) in my config, and when I open the ediff window with zoom-mode enabled, the four windows including the bottom control panel will be all balanced. Another example is the calendar window in org mode.

Currently I advise the zoom--update function to let it do nothing in certain major modes and buffers. I wonder if you want to add a option for not balancing windows in certain cases.

Delay and flicker with eshell-smart

If you do a M-x customize-variable eshell-modules-list RET and check eshell-smart and set/save, some weird flickering happens when opening another window from eshell using something like find-file-other-window init.el. Specifically, it seems to kind of oscillate between two sizes, eventually settling on the correct one. This is sort of odd, but is perhaps due to the fact that the functions eshell-smart-scroll-window and eshell-smart-redisplay deal with window displaying/selection. I haven't yet pinpointed the problem more specifically.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.