From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ergus Newsgroups: gmane.emacs.help Subject: Re: Set max size for *Completions* Date: Mon, 7 Mar 2022 21:50:51 +0100 Message-ID: <20220307205051.f4r6lkhybwtpkbnc@Ergus> References: <8735jtn6ug.fsf.ref@aol.com> <8735jtn6ug.fsf@aol.com> <87sfrtaj1i.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33450"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: Philip Kaludercic Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Mar 07 21:52:25 2022 Return-path: Envelope-to: geh-help-gnu-emacs@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 1nRKLB-0008US-NQ for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 07 Mar 2022 21:52:25 +0100 Original-Received: from localhost ([::1]:47874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRKLA-0002op-A2 for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 07 Mar 2022 15:52:24 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:58216) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRKKR-0002oT-2g for help-gnu-emacs@gnu.org; Mon, 07 Mar 2022 15:51:39 -0500 Original-Received: from sonic311-14.consmr.mail.bf2.yahoo.com ([74.6.131.124]:45671) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRKKO-0004m7-PE for help-gnu-emacs@gnu.org; Mon, 07 Mar 2022 15:51:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1646686294; bh=g2lFAAg/82MJbT7KWCpVJozWMZ/LaBlgd7nv6VPgFZc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject:Reply-To; b=jv/62jpnCDXbrHuOAyao+7KEV65JRnd9mnEJpWRNc6m7kJ8t+HdXGyIWQ2ojAOf5rNsYU+grfUObTq7pmWU/h8zX0ZMp9yKLlZfGx8GKKQ7ptgWP8932A6/Ww+ZLJUg6h4Gno3z79rPdfj6ZeUWv62pRemQ1eqCMN45zxeprW12I6zSOy6EfRfW+lAJs6wgok4THjrbPKTVu8uMlPYNcTXYkT9lQ3ahsG3tpCligtvV8ELo2zdJ5eruLSj3bovhkxBjYs6+d1slKl1e4VDYtZXlBWytwBMCect+WT9VlMVDGApQUxtViReDipUhTCgk+B6PAmca7sOiYat59hBaCOA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1646686294; bh=wq5JgWG+VVlegjCwOhpYfiMMSMT/7WeX9bxvqGIgfEi=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=WqEvSNeI+Wubi72bLXDB+0zT2QT2AQfehjZ5CjoQKMJeMZWqB/v0TnmohhX9PZC4CcpVPWeoe/a0J5V0VUYd4jbSuKsbHh1/1E+kztz7tT+7hF4nz/HLcKuzdVwX+mn9Exj9fw5T2ULk7mzhIqz3iiLm5ks+XikLxCssgIp+TlJxRJmyrvaar+k1TAN43BDLFkokb/m/iqzOJFUR+u46GALqpzFXfhH2Msp1D/w0r3CRDxJ7G+qIjWdAe0TjLlhBQkQzAiAu1LzPbLP9SxukowoSJW9AI3tZC4B2LeycmZaRwcyT2D0AHVtGzBC7cJIe8FjuHCzdMY3EEG4uTlY3RA== X-YMail-OSG: oqxh3ZgVM1nnQHJVZZfJEFO8QE8fpdhBXpM2zHNLL549He2BPrNN8sda94nQJ0W mxwxjhQWfYh2lsd3Jc_x8rUIrsQ8D5ZE76f29KEP_ThPxrkKsKKO3k4Nj3vHxrM20QP6K4WvcRkQ M1bv7w_pTLXtxq2Pd_qbHt_XCDm3Z5gm8JvhLY1VZUKd2E.LNF.PDe1GgLDb.k8roPvcdzcEZtss xbrDKapG54J7oFjm0nyMNzRMqm_wj.o.T3kCLbDirI.BYVQ7NUoGxyoKjNZhVAD5OO16JNwl5C.l jdKyOewWD3PmSLTjgXf9iBnmLTebe8EFh64ex3OpJ23brphqlxdmoEpgVTiNrQ9pOUXW8p0KBb78 BrVGH23g9QSnwfRweqGDUDjUlNop1cYMq6rZuXoqrLmzBHb1dJxbcbRciZ5YbMSFBjVleH4enZv. aaZ_BcHH9BAO_CvPAjHFX7exHSyF5R8WjmWyjMGsnhcrJP3vktLrOD9.Z7KrzUmdh.jjjfUdkuqJ CFy7CwpnKIdXolxuPlkQmVKrKh2gJKqrZlQiP02iGF3ccQ33FfitmkY2XHmJWjOsT4x8hz6Pq_p4 wCul283tJIUsWRMckPa6BOrOgrz3HwA.RpHmnPBIEpsSa9mAnbBPDvk2VK9wOn77zUoXJ0kbzpXs CYERsUASvt4DHn9B6T_2Ouo9udRrmobFr6.YLfItKTyGFyPOEaQ2.LD_pHTopB4vV7RhgdEUFAXv 0_JHxKFZrdDL4_0C11pQdSWA7O678Q3OpKGJf_bWkgsDQQf3CWBwGaN4kzIPw4mn14ruakCZD..O YbnbaZbLTUScERCeGXDNoyp3MgvcUBqRCU7Q9utBYv X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.bf2.yahoo.com with HTTP; Mon, 7 Mar 2022 20:51:34 +0000 Original-Received: by kubenode507.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 6cbecac3dfc793afe3b0b2359fbc24ee; Mon, 07 Mar 2022 20:51:31 +0000 (UTC) Content-Disposition: inline In-Reply-To: <87sfrtaj1i.fsf@posteo.net> X-Mailer: WebService/1.1.19797 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Received-SPF: pass client-ip=74.6.131.124; envelope-from=spacibba@aol.com; helo=sonic311-14.consmr.mail.bf2.yahoo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:136390 Archived-At: On Mon, Mar 07, 2022 at 03:17:45PM +0000, Philip Kaludercic wrote: >Ergus writes: > >> Hi: >> >> Do we have any way to specify a max size/height for the *Completions* >> window?? > >One way it to enable temp-buffer-resize-mode and then set >temp-buffer-max-height to whatever size you want. This might have the >unintended side effect that other windows are also affected. I manged >to solve this by setting temp-buffer-max-height to a function: > > (lambda (buf) > (if (string-match-p > (rx bos (or "*Completions*") eos) > (buffer-name buf)) > 10 (window-height))) > >-- > Philip Kaludercic > Thanks for your reply I actually did this: (defcustom completions-max-height 10 "Maximum height for *Completions* buffer.") (defun my/completions-advise (&optional win &rest _) "Advise for completion resize." (when-let* (((windowp win)) (bname (buffer-name (window-buffer win)))) (when (string= bname "*Completions*") (fit-window-to-buffer win completions-max-height)))) (advice-add #'fit-window-to-buffer :after-until #'my/completions-advise) So I don't need to set temp-buffer-resize-mode or override a funtion... But of course, this only works with temp-buffer-resize-mode disabled, maybe adding a custom for this in minibuffer.el changing these lines: 2278 ,(if temp-buffer-resize-mode 2279 '(window-height . resize-temp-buffer-window) 2280 '(window-height . fit-window-to-buffer)) And use a wrapper only for completions. (defcustom completions-max-height 10 "Maximum height for *Completions* buffer.") (defun completions--fit-window-to-buffer (&optional win &rest _) "Resize completions." (if temp-buffer-resize-mode (let ((temp-buffer-max-height (or completions-max-height temp-buffer-max-height))) (resize-temp-buffer-window win)) (fit-window-to-buffer win completions-max-height))) 2278 '(window-height . completions--fit-window-to-buffer)