reddit / emacs

Cannot resize the second scratch window to one pixel

RadonedWasEaten · 2022-06-25 08:07
RadonedWasEaten · 2022-06-25 08:11
I was aiming for a quick posframe buffer that pops up in posframe so you can do a temporary note in it or something but you cannot edit text in a posframe. So I tried a t similar approach to ivy posframe in which you resize the normal buffer to 1 px and then make a new one in posframe. code: (defun quicknote() (interactive) (split-window-below) (other-window 1) (switch-to-buffer "\*scratch\*") (enlarge-window -30) (setq left-margin-width 3) (posframe-show "\*scratch\*" :poshandler 'posframe-poshandler-frame-center :border-color "#ee7b29" :width (round (\* (frame-width) 0.70)) :height (round (\* (frame-height) 0.80)) :border-width 2 :poverride-parameters '((left-fringe . 20) (right-fringe . 20)) ))
Ethan045627 · 2022-06-25 09:34
It might be silly, but can you name the theme you are using
RadonedWasEaten · 2022-06-25 11:14
no question is silly, the theme I use Is called "an old hope" from [doom themes](https://github.com/doomemacs/themes)
Ethan045627 · 2022-06-25 11:15
Thanks alot man I appretiate it 😃😃😃
_viz_ · 2022-06-25 14:33
I'm not too sure but window-min-height and window-min-width could interfere. It might be better to use window-resize instead.
RadonedWasEaten · 2022-06-26 00:56
I added the code below and removed the enlarged window and changed (split window below) to (split-window-right) the result it (window-resize nil (- (truncate (\* 0.06 (frame-width))) (window-width)) t) ​ The result is a 3 character wide window on the side, is there anyway to make it 1px
RadonedWasEaten · 2022-06-26 02:58
It does not work with golden ratio mode Solution: &#x200B; (global-set-key \[f6\] 'quicknote) (defun quicknote() (interactive) (global-unset-key (kbd "<escape>")) (global-set-key (kbd "<escape>") (lambda() (interactive) (setq-local hidething t) (posframe-hide-all) (global-unset-key (kbd "<escape>")) (global-set-key (kbd "<escape>") 'keyboard-escape-quit) (delete-window) (global-set-key \[f6\] 'quicknote) )) (global-unset-key \[f6\]) (global-set-key \[f6\] (lambda() (interactive) (execute-kbd-macro (kbd "<escape>")))) (setq-local window-min-width 0) (when (eq (window-in-direction 'right) nil) (posframe-show "donotmakeabufferwiththisnameplease124" :poshandler 'posframe-poshandler-window-top-right-corner ; :background-color "#ee7b29" :width 3 :height (frame-height) ) ) (split-window-right (- (window-width) 1)) (other-window 1) (switch-to-buffer "\*scratch\*") ; (setq-local window-min-height 1) ; (local-unset-key (kbd "<escape>") 'keyboard-escape-quit) (local-set-key (kbd "<escape>") '(lambda()) (posframe-delete-all)( delete-window ) ;(setq-local window-min-width 0) ;(window-resize nil (- (truncate (\* 0.06 (frame-width))) (window-width)) t) (posframe-show "\*scratch\*" :poshandler 'posframe-poshandler-frame-center :border-color "#ee7b29" :width (round (\* (frame-width) 0.70)) :height (round (\* (frame-height) 0.80)) :border-width 2 :poverride-parameters '((left-fringe . 40) (right-fringe . 20)) ) )
_viz_ · 2022-06-26 16:58
Maybe it would be better to store the window-configuration, close the window, then restore the window-configuration when you're done with the temporary window?
itistheblurstoftimes · 2022-06-27 00:36
Are you sure you can't edit text in a posframe? I know it is messy but I swear I had this half-working for some prototype of something or other random idea I had.