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.devel Subject: [PATCH] completions-max-height Date: Mon, 7 Mar 2022 22:07:40 +0100 Message-ID: <20220307210740.veiocemir46mmerk@Ergus> References: <20220307210740.veiocemir46mmerk.ref@Ergus> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="dvir7hy6wyjfmy7j" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39624"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Mar 07 22:09:05 2022 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 1nRKbI-000AAu-Fj for ged-emacs-devel@m.gmane-mx.org; Mon, 07 Mar 2022 22:09:04 +0100 Original-Received: from localhost ([::1]:35542 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRKbH-0005bV-At for ged-emacs-devel@m.gmane-mx.org; Mon, 07 Mar 2022 16:09:03 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:33384) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRKah-0004vZ-TF for emacs-devel@gnu.org; Mon, 07 Mar 2022 16:08:27 -0500 Original-Received: from sonic316-12.consmr.mail.bf2.yahoo.com ([74.6.130.122]:33043) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRKaf-0007YU-3Z for emacs-devel@gnu.org; Mon, 07 Mar 2022 16:08:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1646687303; bh=PsVPH3eMAmXJN2xiD77SN/tieyGADbeWkUBEJlULmBs=; h=Date:From:To:Subject:References:From:Subject:Reply-To; b=bqobucQIof9KwcqDCl6Nr8V1JBtupsghNzZlUJ60mjxwXrFSWclGbGjOgJOALwXbsIzhHMxwltsNkmmRwlk+nLPu9lNOhoODgrLVvefMJ+Ja9AH1pWcspcezqDNUSS1biMjna7KmsziD7i0RzekwGm5Ynl9k788iupwv+JlO6CDnephSHgkgsL5aiFkgcVM50Wtxi3QgRUhhbUTio0mTUknSbX/R6SafvO2ozQknLrktmB84nQufQKbwxEU9riC7ZK71K6hGdEIcGq1wQUsOqjV71VIMYf/sinR7V2y7IhbELlBLe4GoIQ+UPgSdK+ccENDY1RR1JzOuwusDXBNWjw== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1646687303; bh=PNJMnO5ghEg4rLSUNQB1lOmmRkstt3AtFIVSE7RuvLk=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=NDBrVeUJrq7MTWtfVV4LsDklaB2GBMlURZm0212MBvwvjlti2fxdc5KHET9VIMX7wPZL6CwjvxX7w38N2PW30nb5oVNcr4XLyetWh9BYuVeF2U2OarN04pf6wtPhWuLPeV3SfiVe9OnQ6rVvAbB8CJ5o/P4oXl1FZlY0079p3IVzKhCz2/seCTiBudb6hDmfb5YCgDwGNCAwPUKEryTr5PM7rqLJXG0o/Lxm4goit3p7Pj/BRHypan5aR5odWFPNAawuL1fkFiUB2k9bq7c2LOLaPsUrKTZjY7HwyVFfBn/VE8ysARAkrx/pC734fHSfn4RcNl5zwC5bMs+X3SIP9w== X-YMail-OSG: cgjXC4gVM1l3MzZPYztczp9QaQfy8He4WPZP0h2nCPlnfNj42YIBuXirJ66CMlp M0t2XBcWFcg0k7Xen3WM76hKUW1Lui.WqOpmaidOXy46Y1lU0rKeJ6KtMOtgOZtyfo2FhL5X0TEe rmDxJJvdcPXCxAwKb8hoUMLkWr5DtbPaUq7GUsecBT2rer6daxlQch83YBxbOqeU2fU7uYO0lGWk fZC2yvUP0744eioCNkcMhn4fIsmq_5ab2OKORGaGc9d5Betl3U1mKSiAKUXgPJO8ONyPlT.W8chP 6I5YesdFXUB.LPCRpwkyzw5efgsHpXmtjra3rYdNl3s739tKOow9SFGnOhNksfJT.m4fVxSJ1yUK wpa7uqG3z8HQTwytqsKSswFsn1qDAuEf7a9rDRYrdK8Qry8cdVJV_ytuZ81HR5mnD2mHVDbyQm6k GsxFTvlD86rSDOmvfbu3JyhYG.N5glM5nrfj7HQXU1w1czPVR4qZYgRx9NxwvhdpDgsMX0L.O3ks F6FFtI1F.sjOJgZF4BRHchSALy7zYK82xcBlBeB4ytLR15q1Sz5c1T_2O0nkbghdIS8sArSnILVY p.mqs3lhjFD.0nJ6qLQTnlfRUoWMfADuqOD14FE.wZio4wSB6zFejr6fL6sfNvbATM3JiqK3qzAr R6gUUwlNpd8hjPa57TuCIRw7qcJn9gKHahVWGMuI5W91Ovtx9OGZn8atJv8tpwuvfUT9dFJxRPSh R_Tkm2.A8AeMIZcObr0ZmIXrG0ynvgq_EAonI8oMo62Oj.QHs_rAiUjW7fjgzGPFRt3gDT84qxpi F2B_N_BXCE2Dp.E9cgjqX_PixZKsDD5TTbmGWOqqfC X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic316.consmr.mail.bf2.yahoo.com with HTTP; Mon, 7 Mar 2022 21:08:23 +0000 Original-Received: by kubenode502.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID ab0d2063407db5be3118769baf7ee4b5; Mon, 07 Mar 2022 21:08:20 +0000 (UTC) Content-Disposition: inline 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.130.122; envelope-from=spacibba@aol.com; helo=sonic316-12.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: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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:286904 Archived-At: --dvir7hy6wyjfmy7j Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline Hi: Do you think that this may be added to vanilla? Best, Ergus --dvir7hy6wyjfmy7j Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="completions-max-height.patch" diff --git a/etc/NEWS b/etc/NEWS index 587e7f6ade..78f41de2ea 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -554,6 +554,10 @@ This option controls the sorting of the completion candidates in the "*Completions*" buffer. Available styles are no sorting, alphabetical (the default), or a custom sort function. +*** New user option 'completions-max-height'. +This option limits the height of the "*Completions*" buffer. + + ** Isearch and Replace +++ diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 798cba0ac2..a06986fdb7 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -2212,6 +2212,19 @@ completion--done (equal pre-msg (and exit-fun (current-message)))) (completion--message message)))) +(defcustom completions-max-height nil + "Maximum height for *Completions* buffer." + :type 'natnum + :version "29.1") + +(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))) + (defun minibuffer-completion-help (&optional start end) "Display a list of possible completions of the current minibuffer contents." (interactive) @@ -2275,9 +2288,7 @@ minibuffer-completion-help ,(if (eq (selected-window) (minibuffer-window)) 'display-buffer-at-bottom 'display-buffer-below-selected)) - ,(if temp-buffer-resize-mode - '(window-height . resize-temp-buffer-window) - '(window-height . fit-window-to-buffer)) + (window-height . completions--fit-window-to-buffer) ,(when temp-buffer-resize-mode '(preserve-size . (nil . t))) (body-function --dvir7hy6wyjfmy7j--