What are you trying to achieve?
I've been able to install the package, and it resizes the new windows when I create them. However, when I change windows, it does not resize correctly. However, it resizes after a which-key buffer is opened and closed.
What have you tried?
I've tried adding a hook to prog-mode, to call the golden-ratio function. However, that hasn't worked
Additional information
This is how it's supposed to work

System information
emacs version 26.3
features XAW3D XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GLIB NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS LUCID X11 XDBE XIM THREADS LIBSYSTEMD LCMS2
build Sep 23, 2019
buildopts (--build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --enable-libsystemd --with-pop=yes --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/26.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/26.3/site-lisp:/usr/share/emacs/site-lisp --with-sound=alsa --without-gconf --with-mailutils --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --enable-libsystemd --with-pop=yes --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/26.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/26.3/site-lisp:/usr/share/emacs/site-lisp --with-sound=alsa --without-gconf --with-mailutils --with-x=yes --with-x-toolkit=lucid --with-toolkit-scroll-bars --without-gsettings 'CFLAGS=-g -O2 -fdebug-prefix-map=/build/emacs-wvqver/emacs-26.3+1=. -fstack-protector-strong -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro')
windowsys x
daemonp server-running
doom version 2.0.9
build HEAD -> develop, origin/develop, origin/HEAD 18edebe9c 2019-12-21 04:21:43 -0500
system type gnu/linux
config x86_64-pc-linux-gnu
shell /usr/bin/zsh
uname Linux 5.3.0-24-generic #26-Ubuntu SMP Thu Nov 14 01:33:18 UTC 2019 x86_64
path (~/miniconda3/bin/ ~/miniconda3/condabin/ ~/.cargo/bin/ ~/.local/bin/ /usr/local/sbin/ /usr/local/bin/ /usr/sbin/ /usr/bin/ /sbin/ /bin/ /usr/games/ /usr/local/games/ /snap/bin/ /usr/lib/jvm/jdk-13.0.1+9/bin/ ~/.scripts/ ~/.antigen/bundles/robbyrussell/oh-my-zsh/lib/ ~/.antigen/bundles/romkatv/powerlevel10k/ ~/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/command-not-found/ ~/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/pip/ ~/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/python/ ~/.antigen/bundles/esc/conda-zsh-completion/ ~/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/git/ ~/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/common-aliases/ ~/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/web-search/ ~/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/sudo/ ~/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/vi-mode/ ~/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/z/ ~/.antigen/bundles/zdharma/fast-syntax-highlighting/ ~/.antigen/bundles/zsh-users/zsh-completions/ ~/.fzf/bin/ /usr/lib/emacs/26.3/x86_64-linux-gnu/)
config envfile envvar-file
elc-files 0
modules (:completion company ivy :ui doom doom-dashboard doom-quit hl-todo hydra nav-flash ophints (popup +all +defaults) treemacs unicode vc-gutter vi-tilde-fringe window-select workspaces :editor (evil +everywhere) file-templates fold (format +onsave) multiple-cursors rotate-text snippets :emacs (dired +icons) electric ibuffer vc :term eshell :tools (eval +overlay) flycheck flyspell (lookup +docsets) lsp magit pdf :lang (cc +lsp) data emacs-lisp (java +lsp) (javascript +lsp) lua markdown (org +dragndrop +pandoc +present) (php +lsp) (python +lsp) (sh +lsp) (web +lsp) :config (default +bindings +smartparens))
packages (evil-escape doom-modeline move-text (golden-ratio :recipe (:host github :repo "roman/golden-ratio.el")))
elpa (n/a)
This should work:
;; add to ~/.doom.d/config.el
(use-package! golden-ratio
:after-call pre-command-hook
:config
(golden-ratio-mode +1)
;; Using this hook for resizing windows is less precise than
;; `doom-switch-window-hook'.
(remove-hook 'window-configuration-change-hook #'golden-ratio)
(add-hook 'doom-switch-window-hook #'golden-ratio))
This works very well for me. However, I have one doubt - will it cause an issue if I keep the original hook as well? Because the original hook runs golden-ratio when new windows are created, which doom-switch-window-hook does not cover i.e, the windows are resized only when I switch to the new window for the first time.
Also, thank you for the prompt reply! I switched over from spacemacs very recently and love your work!
I'm also having an issue with popup buffers after adding this to my config. They all fail to open, with the following message : Wrong type argument: stringp, nil . I've tried foe eshell and help popups so far, and both have the same issue
will it cause an issue if I keep the original hook as well? Because the original hook runs golden-ratio when new windows are created...
It should be fine to keep the old hook. I hadn't thought it through.
Wrong type argument: stringp, nil
Could you create a backtrace from this error?
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
set-buffer(nil)
(save-current-buffer (set-buffer (if (windowp buffer) (window-buffer buffer) buffer)) (run-hooks (quote doom-switch-buffer-hook)))
(progn (save-current-buffer (set-buffer (if (windowp buffer) (window-buffer buffer) buffer)) (run-hooks (quote doom-switch-buffer-hook))) buffer)
(if buffer (progn (save-current-buffer (set-buffer (if (windowp buffer) (window-buffer buffer) buffer)) (run-hooks (quote doom-switch-buffer-hook))) buffer) nil)
(let* ((buffer (and t (apply orig-fn buffer-or-name args)))) (if buffer (progn (save-current-buffer (set-buffer (if (windowp buffer) (window-buffer buffer) buffer)) (run-hooks (quote doom-switch-buffer-hook))) buffer) nil))
(let ((doom-inhibit-switch-buffer-hooks t)) (let* ((buffer (and t (apply orig-fn buffer-or-name args)))) (if buffer (progn (save-current-buffer (set-buffer (if (windowp buffer) (window-buffer buffer) buffer)) (run-hooks (quote doom-switch-buffer-hook))) buffer) nil)))
(if (or doom-inhibit-switch-buffer-hooks (eq (current-buffer) (get-buffer buffer-or-name)) (and (eq orig-fn (function switch-to-buffer)) (car args))) (apply orig-fn buffer-or-name args) (let ((doom-inhibit-switch-buffer-hooks t)) (let* ((buffer (and t (apply orig-fn buffer-or-name args)))) (if buffer (progn (save-current-buffer (set-buffer (if ... ... buffer)) (run-hooks (quote doom-switch-buffer-hook))) buffer) nil))))
(let ((gc-cons-threshold most-positive-fixnum)) (if (or doom-inhibit-switch-buffer-hooks (eq (current-buffer) (get-buffer buffer-or-name)) (and (eq orig-fn (function switch-to-buffer)) (car args))) (apply orig-fn buffer-or-name args) (let ((doom-inhibit-switch-buffer-hooks t)) (let* ((buffer (and t (apply orig-fn buffer-or-name args)))) (if buffer (progn (save-current-buffer (set-buffer ...) (run-hooks ...)) buffer) 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." (interactive #f(compiled-function () #<bytecode 0x2c33111>)) #<bytecode 0x1b2b93>) #<buffer *doom:eshell-popup:main*> 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." (interactive #f(compiled-function () #<bytecode 0x2c33251>)) #<bytecode 0x1b2b93>) (#<buffer *doom:eshell-popup:main*> nil))
display-buffer(#<buffer *doom:eshell-popup:main*> 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 0x2c333c9>)) #<bytecode 0x1b2fa7>)(#<buffer *doom:eshell-popup:main*> nil nil)
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 0x2c38881>)) #<bytecode 0x1b2fa7>) (#<buffer *doom:eshell-popup:main*> nil nil))
#f(advice-wrapper :after #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 0x2c389dd>)) #<bytecode 0x1b2fa7>) doom-modeline-update-buffer-file-name)(#<buffer *doom:eshell-popup:main*> nil nil)
ad-Advice-pop-to-buffer(#f(advice-wrapper :after #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 0x2c38b8d>)) #<bytecode 0x1b2fa7>) doom-modeline-update-buffer-file-name) #<buffer *doom:eshell-popup:main*>)
apply(ad-Advice-pop-to-buffer #f(advice-wrapper :after #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 0x2c3c5bd>)) #<bytecode 0x1b2fa7>) doom-modeline-update-buffer-file-name) #<buffer *doom:eshell-popup:main*>)
pop-to-buffer(#<buffer *doom:eshell-popup:main*>)
(set-buffer (pop-to-buffer eshell-buffer))
(save-current-buffer (set-buffer (pop-to-buffer eshell-buffer)) (doom-mark-buffer-as-real-h) (if (eq major-mode (quote eshell-mode)) (run-hooks (quote eshell-mode-hook)) (eshell-mode)) (if command (progn (+eshell-run-command command eshell-buffer))))
(if win (if (eq (selected-window) win) (let (confirm-kill-processes) (delete-window win) (condition-case nil (progn (kill-buffer eshell-buffer)) (error nil))) (select-window win) (if (and (boundp (quote evil-local-mode)) evil-local-mode) (progn (evil-change-to-initial-state))) (goto-char (point-max))) (save-current-buffer (set-buffer (pop-to-buffer eshell-buffer)) (doom-mark-buffer-as-real-h) (if (eq major-mode (quote eshell-mode)) (run-hooks (quote eshell-mode-hook)) (eshell-mode)) (if command (progn (+eshell-run-command command eshell-buffer)))))
(let* ((win (and t (get-buffer-window eshell-buffer)))) (if win (if (eq (selected-window) win) (let (confirm-kill-processes) (delete-window win) (condition-case nil (progn (kill-buffer eshell-buffer)) (error nil))) (select-window win) (if (and (boundp (quote evil-local-mode)) evil-local-mode) (progn (evil-change-to-initial-state))) (goto-char (point-max))) (save-current-buffer (set-buffer (pop-to-buffer eshell-buffer)) (doom-mark-buffer-as-real-h) (if (eq major-mode (quote eshell-mode)) (run-hooks (quote eshell-mode-hook)) (eshell-mode)) (if command (progn (+eshell-run-command command eshell-buffer))))))
(let ((eshell-buffer (get-buffer-create (format "*doom:eshell-popup:%s*" (if (and (boundp ...) persp-mode) (safe-persp-name (get-current-persp)) "main")))) confirm-kill-processes current-prefix-arg) (if arg (progn (let* ((win (and t (get-buffer-window eshell-buffer)))) (if win (delete-window win) nil)) (if (buffer-live-p eshell-buffer) (progn (save-current-buffer (set-buffer eshell-buffer) (fundamental-mode) (erase-buffer)))))) (let* ((win (and t (get-buffer-window eshell-buffer)))) (if win (if (eq (selected-window) win) (let (confirm-kill-processes) (delete-window win) (condition-case nil (progn (kill-buffer eshell-buffer)) (error nil))) (select-window win) (if (and (boundp (quote evil-local-mode)) evil-local-mode) (progn (evil-change-to-initial-state))) (goto-char (point-max))) (save-current-buffer (set-buffer (pop-to-buffer eshell-buffer)) (doom-mark-buffer-as-real-h) (if (eq major-mode (quote eshell-mode)) (run-hooks (quote eshell-mode-hook)) (eshell-mode)) (if command (progn (+eshell-run-command command eshell-buffer)))))))
+eshell/toggle(nil)
funcall-interactively(+eshell/toggle nil)
call-interactively(+eshell/toggle nil nil)
command-execute(+eshell/toggle)
Is this the right way to do it? It's my first time, so not really sure.
Is this the right way to do it? It's my first time, so not really sure.
Well working for me currently.
Is this the right way to do it? It's my first time, so not really sure.
@anihm136 Try to add this config, for example, ignore the *info* buffer, would avoid the Wrong type argument: stringp, nil error when type SPC h i.
(setq golden-ratio-exclude-modes
'("calendar-mode"
"org-agenda-mode"
"help-mode"
"helpful-mode"
"rxt-help-mode"
"treemacs-mode" ))
(setq golden-ratio-exclude-buffer-names
'("*Org tags*"
"*Org todo*"
"*info*"
"*Messages*"))
For anyone with the same problem, you might want to check 鉃★笍 Zoom
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.
Peace!
Thank you! From the time I posted this issue, I've been on and off Doom (currently on). Haven't been using golden-ratio-mode recently, but this package looks good. Maybe I'll try it again
@lroolle how did you setup this?
@blasterpistol My config is 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))
'(zoom-ignored-buffer-names '())
'(zoom-ignored-buffer-name-regexps '("^*calc"))
'(zoom-ignore-predicates '((lambda () (> (count-lines (point-min) (point-max)) 20))))
))
But recently I suffered from wrong-type-argument stringp nil again...
The error is mainly because of these two 'hooks.
(remove-hook 'window-configuration-change-hook #'zoom)
(add-hook 'doom-switch-window-hook #'zoom)
Remove these two lines the Error never occurs. But zoom's automatic window resize won't work, you'll have to zoom by M-x zoom manually
Details:
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 0x44050889>) #<buffer *Org Src README.org[ go ]*> 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 0x44050889>) (#<buffer *Org Src README.org[ go ]*> nil))
display-buffer(#<buffer *Org Src README.org[ go ]*> 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 0x1ffe7369241d>)) #<bytecode 0x43deb395>)(#<buffer *Org Src README.org[ go ]*> nil nil)
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 0x1ffe748c3725>)) #<bytecode 0x43deb395>) (#<buffer *Org Src README.org[ go ]*> nil nil))
pop-to-buffer(#<buffer *Org Src README.org[ go ]*> nil nil)
+popup--org-pop-to-buffer-a(#f(compiled-function (&rest args) "Switch to buffer in a second window on the current frame.\nIn particular, do not allow pop-up frames.\nReturns the newly created buffer." #<bytecode 0x1ffe73196989>) #<buffer *Org Src README.org[ go ]*>)
apply(+popup--org-pop-to-buffer-a #f(compiled-function (&rest args) "Switch to buffer in a second window on the current frame.\nIn particular, do not allow pop-up frames.\nReturns the newly created buffer." #<bytecode 0x1ffe73196989>) #<buffer *Org Src README.org[ go ]*>)
org-switch-to-buffer-other-window(#<buffer *Org Src README.org[ go ]*>)
#f(compiled-function (buffer context) #<bytecode 0x1ffe73877215>)(#<buffer *Org Src README.org[ go ]*> edit)
apply(#f(compiled-function (buffer context) #<bytecode 0x1ffe73877215>) (#<buffer *Org Src README.org[ go ]*> edit))
+popup--org-src-switch-to-buffer-a(#f(compiled-function (buffer context) #<bytecode 0x1ffe73877215>) #<buffer *Org Src README.org[ go ]*> edit)
apply(+popup--org-src-switch-to-buffer-a #f(compiled-function (buffer context) #<bytecode 0x1ffe73877215>) (#<buffer *Org Src README.org[ go ]*> edit))
org-src-switch-to-buffer(#<buffer *Org Src README.org[ go ]*> edit)
org-src--edit-element((src-block (:language "go" :switches nil :parameters nil :begin 2257 :end 2397 :number-lines nil :preserve-indent nil :retain-labels t :use-labels t :label-fmt nil :value "import \"fmt\"\n\nfunc main() {\n\11fmt.Printf(\"%f %f %e ..." :post-blank 0 :post-affiliated 2257 :parent nil)) "*Org Src README.org[ go ]*" go-mode #f(compiled-function () #<bytecode 0x1ffe73877411>) nil)
org-edit-src-code()
org-edit-special(nil)
funcall-interactively(org-edit-special nil)
call-interactively(org-edit-special nil nil)
command-execute(org-edit-special)
@hlissner
In case anyone else searches for setting up zoom for Doom, to build on @lroolle's answer, use the following:
;; in ~/.doom.d/packages.el
(package! zoom)
;; in ~/.doom.d/config.el
(use-package zoom
:hook (doom-first-input . zoom-mode)
:config
(setq 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 (list (lambda () (> (count-lines (point-min) (point-max)) 20))))
Thanks a lot, that works fine finally.
But recently I've given up the auto zoom mode, since the auto mode some times really make annoying things......Anyway, so I made my own map to zoom like C-w-z.
Yes, It's quite like the doom/window-enlargen command, which is C-w-o, but a little more space for the minimized window.
So, I've got another idea or question? Is there any possible to config the zoom size like zoom for doom's command doom/window-enlargen? 馃榾
This wasn't working consistently for me until I removed: zoom-ignore-predicates (list (lambda () (> (count-lines (point-min) (point-max)) 20)))
Edit: Actually, it looks like ">" should be "<".
So the correct line would be:
zoom-ignore-predicates (list (lambda () (< (count-lines (point-min) (point-max)) 20)))
Besides that, very happy to have this feature in my setup, thanks everyone
Most helpful comment
In case anyone else searches for setting up zoom for Doom, to build on @lroolle's answer, use the following: