From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: A solution to display completion candidates after point in a minibuffer Date: Fri, 02 Oct 2020 19:04:56 +0300 Message-ID: <83r1qgehqv.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33105"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Gregory Heytings Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Oct 02 18:14:57 2020 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 1kONhv-0008Ul-Ez for ged-emacs-devel@m.gmane-mx.org; Fri, 02 Oct 2020 18:14:55 +0200 Original-Received: from localhost ([::1]:57046 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kONhu-0001C7-I0 for ged-emacs-devel@m.gmane-mx.org; Fri, 02 Oct 2020 12:14:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53096) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kONYL-0006UK-2x for emacs-devel@gnu.org; Fri, 02 Oct 2020 12:05:01 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:33789) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kONYK-0007mQ-3z; Fri, 02 Oct 2020 12:05:00 -0400 Original-Received: from [176.228.60.248] (port=4967 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kONYJ-0007O7-1Z; Fri, 02 Oct 2020 12:04:59 -0400 In-Reply-To: (emacs-devel@gnu.org) 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:256950 Archived-At: > Date: Fri, 02 Oct 2020 15:36:37 +0000 > From: Gregory Heytings via "Emacs development discussions." > > (defvar-local start-display-at-beginning-of-minibuffer nil) > (defun start-display-at-beginning-of-minibuffer (&rest args) > (when (and start-display-at-beginning-of-minibuffer (minibufferp)) > (set-window-start-at-begin 1 (point)))) > (defun set-window-start-at-begin (beg end) > (set-window-start nil beg) > (unless (pos-visible-in-window-p end nil t) (set-window-start-at-begin (+ beg (/ (- end beg) 2)) end))) > (setq window-scroll-functions (cons 'start-display-at-beginning-of-minibuffer window-scroll-functions)) > (add-hook 'post-command-hook 'start-display-at-beginning-of-minibuffer) > > This works with at least Emacs 24, 25, 26, 27 and 28. Thanks, but I don't like such solutions, because they attempt to work around the display engine in order to do something, instead of asking the display engine itself to do that for us. In bug#43572, a solution that would allow us to ask the display engine to do this is being discussed. I'd favor one of the solutions proposed there lately, namely, to indicate in the text to be displayed that this text wants to be displayed with the window-start set at BOB.