From: martin rudalics <rudalics@gmx.at>
To: Juri Linkov <juri@linkov.net>
Cc: Arthur Miller <arthur.miller@live.com>, emacs-devel@gnu.org
Subject: Re: Patch proposal: display symbol source code in help buffers
Date: Thu, 23 Sep 2021 10:15:54 +0200 [thread overview]
Message-ID: <139ba228-b232-4844-bd21-0a434b6863f1@gmx.at> (raw)
In-Reply-To: <61e73f21-5922-52f3-6655-463dd0eb20c5@gmx.at>
[-- Attachment #1: Type: text/plain, Size: 199 bytes --]
> We can't. We'd have to provide a white- or blacklist for that purpose.
Actually we have such a blacklist already - it's 'display-buffer-alist'.
Please have a look at the attached diffs.
martin
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: resize-temp-buffer-window.diff --]
[-- Type: text/x-patch; name="resize-temp-buffer-window.diff", Size: 3113 bytes --]
diff --git a/lisp/help.el b/lisp/help.el
index 29ae340481..b67b5a4237 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -1589,6 +1589,16 @@ temp-buffer-resize-mode
(add-hook 'temp-buffer-show-hook 'resize-temp-buffer-window 'append)
(remove-hook 'temp-buffer-show-hook 'resize-temp-buffer-window)))
+(defun resize-temp-buffer-window-inhibit (buffer &optional horizontal)
+ "Return non-nil if windows on BUFFER should not be resized automatically.
+`resize-temp-buffer-window' calls this function to check whether
+`display-buffer-alist' contains a setting that inhibits
+auto-resizing of any window showing BUFFER."
+ (assq
+ (if horizontal 'window-width 'window-height)
+ (display-buffer-assq-regexp
+ (buffer-name buffer) display-buffer-alist nil)))
+
(defun resize-temp-buffer-window (&optional window)
"Resize WINDOW to fit its contents.
WINDOW must be a live window and defaults to the selected one.
@@ -1607,26 +1617,33 @@ resize-temp-buffer-window
This function may call `preserve-window-size' to preserve the
size of WINDOW."
(setq window (window-normalize-window window t))
- (let ((height (if (functionp temp-buffer-max-height)
+ (let* ((buffer (window-buffer window))
+ (height (if (functionp temp-buffer-max-height)
+ (with-selected-window window
+ (funcall temp-buffer-max-height buffer))
+ temp-buffer-max-height))
+ (width (if (functionp temp-buffer-max-width)
(with-selected-window window
- (funcall temp-buffer-max-height (window-buffer)))
- temp-buffer-max-height))
- (width (if (functionp temp-buffer-max-width)
- (with-selected-window window
- (funcall temp-buffer-max-width (window-buffer)))
- temp-buffer-max-width))
- (quit-cadr (cadr (window-parameter window 'quit-restore))))
+ (funcall temp-buffer-max-width buffer))
+ temp-buffer-max-width))
+ (quit-cadr (cadr (window-parameter window 'quit-restore))))
;; Resize WINDOW iff it was made by `display-buffer'.
(when (or (and (eq quit-cadr 'window)
(or (and (window-combined-p window)
(not (eq fit-window-to-buffer-horizontally
'only))
- (pos-visible-in-window-p (point-min) window))
+ (pos-visible-in-window-p
+ (with-current-buffer buffer (point-min))
+ window)
+ (not (resize-temp-buffer-window-inhibit buffer)))
(and (window-combined-p window t)
- fit-window-to-buffer-horizontally)))
+ fit-window-to-buffer-horizontally
+ (not (resize-temp-buffer-window-inhibit buffer t)))))
(and (eq quit-cadr 'frame)
fit-frame-to-buffer
- (eq window (frame-root-window window))))
+ (eq window (frame-root-window window))
+ (not (resize-temp-buffer-window-inhibit buffer))
+ (not (resize-temp-buffer-window-inhibit buffer t))))
(fit-window-to-buffer window height nil width nil t))))
;;; Help windows.
next prev parent reply other threads:[~2021-09-23 8:15 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-19 19:50 Patch proposal: display symbol source code in help buffers Arthur Miller
2021-09-20 5:46 ` Lars Ingebrigtsen
2021-09-20 6:09 ` Stefan Kangas
2021-09-20 6:14 ` Lars Ingebrigtsen
2021-09-20 7:17 ` Ihor Radchenko
2021-09-20 7:43 ` Stefan Kangas
2021-09-20 8:29 ` martin rudalics
2021-09-20 9:04 ` Ihor Radchenko
2021-09-20 23:45 ` Arthur Miller
2021-09-21 4:16 ` Lars Ingebrigtsen
2021-09-21 6:59 ` Ihor Radchenko
2021-09-21 7:41 ` Stefan Kangas
2021-09-21 8:38 ` Eli Zaretskii
2021-09-21 9:17 ` Ihor Radchenko
2021-09-21 16:49 ` Lars Ingebrigtsen
2021-10-01 7:05 ` Ihor Radchenko
2021-10-01 7:09 ` Lars Ingebrigtsen
2021-10-01 7:21 ` Ihor Radchenko
2021-10-01 7:21 ` Lars Ingebrigtsen
2021-10-01 9:04 ` Ihor Radchenko
2021-10-01 12:20 ` Lars Ingebrigtsen
2021-10-01 7:24 ` Eli Zaretskii
2021-10-01 9:08 ` Ihor Radchenko
2021-10-01 10:24 ` Eli Zaretskii
2021-10-01 14:14 ` Ihor Radchenko
2021-09-21 8:34 ` martin rudalics
2021-09-20 15:01 ` Arthur Miller
2021-09-21 7:41 ` Stefan Kangas
2021-09-20 15:27 ` Arthur Miller
2021-09-20 6:47 ` Eli Zaretskii
2021-09-20 15:27 ` Arthur Miller
2021-09-20 14:55 ` Arthur Miller
2021-09-21 4:18 ` Lars Ingebrigtsen
2021-09-21 10:26 ` Arthur Miller
2021-09-20 15:23 ` Arthur Miller
2021-09-20 5:59 ` Eli Zaretskii
2021-09-20 6:37 ` Gregor Zattler
2021-09-20 7:01 ` Eli Zaretskii
2021-09-20 15:21 ` Arthur Miller
2021-09-20 8:21 ` martin rudalics
2021-09-20 18:13 ` Arthur Miller
2021-09-21 8:34 ` martin rudalics
2021-09-21 10:24 ` Arthur Miller
2021-09-21 16:52 ` martin rudalics
2021-09-21 18:56 ` Arthur Miller
2021-09-21 17:30 ` Juri Linkov
2021-09-21 19:13 ` Arthur Miller
2021-09-22 7:49 ` martin rudalics
2021-09-22 16:04 ` Juri Linkov
2021-09-22 17:52 ` martin rudalics
2021-09-23 8:15 ` martin rudalics [this message]
2021-09-23 15:52 ` Juri Linkov
2021-09-26 9:10 ` martin rudalics
2021-09-22 22:38 ` Arthur Miller
2021-09-23 8:22 ` martin rudalics
2021-09-20 12:19 ` Dmitry Gutov
2021-09-20 15:13 ` Arthur Miller
2021-09-20 15:11 ` Arthur Miller
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=139ba228-b232-4844-bd21-0a434b6863f1@gmx.at \
--to=rudalics@gmx.at \
--cc=arthur.miller@live.com \
--cc=emacs-devel@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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).