From: martin rudalics <rudalics@gmx.at>
To: Juri Linkov <juri@linkov.net>
Cc: 51062@debbugs.gnu.org
Subject: bug#51062: Customizable window resizing
Date: Tue, 4 Jan 2022 11:27:11 +0100 [thread overview]
Message-ID: <7c39d839-3405-dad3-4e45-90152744e48f@gmx.at> (raw)
In-Reply-To: <86bl0rgas3.fsf@mail.linkov.net>
>> "shrink-buffer-if-larger-than-buffer"? Maybe this should become
>> 'shrink-buffer-window-if-larger-than-buffer' then.
>
> Should such a function be added to window.el?
Maybe. But we could also rename the first argument of
'shrink-window-if-larger-than-buffer' to WINDOW-OR-BUFFER.
>> With the usual problem what to do when there are two windows showing
>> that buffer.
>
> It's understandable why vc-diff-internal and vc-diff-finish
> use get-buffer-window to get a window:
>
> vc-diff-internal:
> (pop-to-buffer (current-buffer))
> (let ((buf (current-buffer)))
> (vc-run-delayed (vc-diff-finish buf ...
>
> vc-diff-finish:
> (let ((window (get-buffer-window buffer t)))
> (with-current-buffer buffer
> ...
> (when window
> (shrink-window-if-larger-than-buffer window))))
>
> This is needed to handle the case when the window was deleted
> before the vc command finished.
>
> But why vc-log-internal-common doesn't so the same?
>
> vc-log-internal-common:
> (pop-to-buffer buffer)
> (vc-run-delayed
> ...
> (shrink-window-if-larger-than-buffer)
>
> So I posted a patch in bug#52855 to use the same function
> that relies on get-buffer-window in both cases.
>
> But it seems you propose to remember the window with e.g.
>
> (setq window (pop-to-buffer (current-buffer)))
>
> then to use it in:
>
> (run-hook-with-args 'vc-diff-finish-functions window)
>
> where the defalut value of 'vc-diff-finish-functions' is:
>
> '(shrink-window-if-larger-than-buffer)
>
> Then 'shrink-buffer-window-if-larger-than-buffer' is not needed.
Personally I dislike abusing hooks like that. But I probably do not use
vc-... much either. So do whatever you like more.
martin
next prev parent reply other threads:[~2022-01-04 10:27 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-06 17:31 bug#51062: Customizable window resizing Juri Linkov
2021-10-07 9:08 ` martin rudalics
2021-10-13 8:36 ` martin rudalics
2021-10-13 18:46 ` Juri Linkov
2021-10-14 9:13 ` martin rudalics
2021-10-14 16:01 ` Juri Linkov
2021-10-14 17:01 ` martin rudalics
2021-10-14 17:14 ` Juri Linkov
2021-10-14 17:47 ` martin rudalics
2021-10-18 16:10 ` Juri Linkov
2021-10-18 17:44 ` martin rudalics
2021-10-19 6:54 ` Juri Linkov
2021-12-29 17:27 ` Juri Linkov
2021-12-29 19:12 ` bug#51062: [External] : " Drew Adams
2021-12-31 9:12 ` martin rudalics
2021-12-31 15:55 ` bug#51062: [External] : " Drew Adams
2022-01-04 8:33 ` Juri Linkov
2022-01-04 10:27 ` martin rudalics [this message]
2022-01-11 17:35 ` Juri Linkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7c39d839-3405-dad3-4e45-90152744e48f@gmx.at \
--to=rudalics@gmx.at \
--cc=51062@debbugs.gnu.org \
--cc=juri@linkov.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.