From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: Patch proposal: display symbol source code in help buffers Date: Thu, 23 Sep 2021 10:15:54 +0200 Message-ID: <139ba228-b232-4844-bd21-0a434b6863f1@gmx.at> References: <83bl4n3hys.fsf@gnu.org> <87fstz3g6z.fsf@no.workgroup> <9ada9a31-4e44-7941-e9a2-ada86ba4e36e@gmx.at> <3438b87f-b24a-3bc3-871f-84818868d445@gmx.at> <87lf3q2ahs.fsf@mail.linkov.net> <87ilys28kp.fsf@mail.linkov.net> <61e73f21-5922-52f3-6655-463dd0eb20c5@gmx.at> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------139A26870D3148EA5F7A9A4A" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30142"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Arthur Miller , emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Sep 23 10:19:09 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mTJwj-0007cK-Fp for ged-emacs-devel@m.gmane-mx.org; Thu, 23 Sep 2021 10:19:09 +0200 Original-Received: from localhost ([::1]:44488 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTJwh-0004Rs-BB for ged-emacs-devel@m.gmane-mx.org; Thu, 23 Sep 2021 04:19:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60938) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTJtl-0000Mm-5M for emacs-devel@gnu.org; Thu, 23 Sep 2021 04:16:05 -0400 Original-Received: from mout.gmx.net ([212.227.17.20]:52205) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTJtf-0008V3-Rs for emacs-devel@gnu.org; Thu, 23 Sep 2021 04:16:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=badeba3b8450; t=1632384955; bh=f++/8TQdqp6vCRql0erFi5CBhmFhhsGIRVR139/mZgs=; h=X-UI-Sender-Class:Subject:From:To:Cc:References:Date:In-Reply-To; b=lJO7BGN/KV3d3yalfPY99hQtKKN/mcbStM+NjIkNTZHwvJdKLOwdLLZFeD2APxj2+ 72uIpR1r/vNeHoDrWnhuw7qkn+sPzY0UH+ECZBUwYcpgaGEZqBbAfNI1jRzm1AFqbe tV0DIDgI87kaRGTitC3fGFUjVr1lOKJwso7YKHhc= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [192.168.1.101] ([212.95.5.181]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MdebB-1n2vd40oa1-00Zitf; Thu, 23 Sep 2021 10:15:55 +0200 In-Reply-To: <61e73f21-5922-52f3-6655-463dd0eb20c5@gmx.at> Content-Language: en-US X-Provags-ID: V03:K1:Un72QowO7N5jDW8S7TCK/NWcMc+lP1/s73QWAs0l/MvJEGbaDSq HLi2KQa7Zz7UU+cLZklFUObv0jzfdNWTmg8MZxlUAk+rp50JKexC32Y4QuIV2PL7SL0WriX S71lMtSRBjiO/GLCh0lpap8LDhoUJwF8O2BfrYYpeSL9nZv4q5RK3AyIcc4G7jlR94IH+5a xmpTRqTMNNhZw0CXiOy3Q== X-UI-Out-Filterresults: notjunk:1;V03:K0:+Ld2oK3USlk=:EwN2N9en+ziqJv4kAm4i96 XsNLRBNPbhFS155lU38/o0el1BpreAQW1jyhVLqfwtNDcj7kfApDcYb1Q4T4fpFbjnOR3lmGp wutid6Cf84uf7ZF3tz3o9cZ4O5HHwHgumD2Xr9UHHpA7Fi0cPHQ1Ww7Mx4CzkQFIaFGdWxQJI Y43/IlFac5cKz9leoSgO92r8+xMxYDSSc8nn0BnIhQ6nikaIYL1Y/D7rkmr6Rv2SW2T8wKueG Z29VFksHpJK0lc2Tnawl6UCapgiVCuJ64Ym2gVajc2XzkSKBTFl7cUIpTUrPU+eqdB40YXDEI OAsP1nUJZxm7Od17OqAYQSbL0i8UG6I4pvW0i319AtjwWMH0bPon+Ny8wr2uV2P/Ls22FBsua rtkmKzRtYqcx4Cxcw3gldeET6m9XhHAn9XcgwCT8323Xjwv3ydPyPOUBmm+k/+Mq6Zo2L8/Z5 vrVRzs+rQ7/GM4vtOB6Op1r+IL4aw17CcgUXrIzxluDCDHFfLf+ZymurWNOnVcF4kkZzX+sB7 CsMNzQwEPZq4vWFJJu/SNp5K5ago6c7nTxA2e4yzz8BcGumVJGzgzhC++YTlaopvNj7L1HEBM Hg8wNzDhv2ayDCfnTGa0JC+lCs5+LjC2n+wLbmveIhBuXk8DFDpEukLdDx/5t7bajmxX9ZF5Q Jd57o+jo8lWAuXt3ernUOccaM/78WjopweLfIGIh9tseQAVv3yX/rf+kPtS+SZINhtpDlb+Hq Q8sqW+UmVi6n4S8kupFRRyb0JqH/vY5JeLySf+IEcS8AjYg/H1gKasYa6PQavBG7FeXzGj3a Received-SPF: pass client-ip=212.227.17.20; envelope-from=rudalics@gmx.at; helo=mout.gmx.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:275355 Archived-At: This is a multi-part message in MIME format. --------------139A26870D3148EA5F7A9A4A Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit > 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 --------------139A26870D3148EA5F7A9A4A Content-Type: text/x-patch; name="resize-temp-buffer-window.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="resize-temp-buffer-window.diff" diff --git a/lisp/help.el b/lisp/help.el index 29ae340481..b67b5a4237 100644 =2D-- 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 automaticall= y. +`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 buffe= r))) (and (window-combined-p window t) - fit-window-to-buffer-horizontally))) + fit-window-to-buffer-horizontally + (not (resize-temp-buffer-window-inhibit buffe= r 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. --------------139A26870D3148EA5F7A9A4A--