From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#38457: 27.0.50; dabbrev-expand regression due to message change Date: Tue, 03 Dec 2019 01:00:40 +0200 Organization: LINKOV.NET Message-ID: <8736e2coyv.fsf@mail.linkov.net> References: <8736e3vve8.fsf@gmx.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="21011"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: 38457@debbugs.gnu.org To: Stephen Berman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Dec 03 00:48:24 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ibvQW-0005KJ-2I for geb-bug-gnu-emacs@m.gmane.org; Tue, 03 Dec 2019 00:48:24 +0100 Original-Received: from localhost ([::1]:45788 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ibvQU-00049B-N6 for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 Dec 2019 18:48:22 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42924) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ibvPI-0003RQ-Uw for bug-gnu-emacs@gnu.org; Mon, 02 Dec 2019 18:47:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ibvPH-0004FU-Nd for bug-gnu-emacs@gnu.org; Mon, 02 Dec 2019 18:47:08 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33152) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ibvPE-0004Db-DU for bug-gnu-emacs@gnu.org; Mon, 02 Dec 2019 18:47:05 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ibvPE-0005Ar-CG for bug-gnu-emacs@gnu.org; Mon, 02 Dec 2019 18:47:04 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 02 Dec 2019 23:47:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38457 X-GNU-PR-Package: emacs Original-Received: via spool by 38457-submit@debbugs.gnu.org id=B38457.157533040719831 (code B ref 38457); Mon, 02 Dec 2019 23:47:04 +0000 Original-Received: (at 38457) by debbugs.gnu.org; 2 Dec 2019 23:46:47 +0000 Original-Received: from localhost ([127.0.0.1]:39120 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ibvOw-00059m-Az for submit@debbugs.gnu.org; Mon, 02 Dec 2019 18:46:47 -0500 Original-Received: from bonobo.birch.relay.mailchannels.net ([23.83.209.22]:3554) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ibvOu-00059b-BW for 38457@debbugs.gnu.org; Mon, 02 Dec 2019 18:46:45 -0500 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id C61FD21DF4; Mon, 2 Dec 2019 23:46:42 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a98.g.dreamhost.com (100-96-4-107.trex.outbound.svc.cluster.local [100.96.4.107]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 3545A21D14; Mon, 2 Dec 2019 23:46:42 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a98.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.18.5); Mon, 02 Dec 2019 23:46:42 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Drop-Bored: 08bb3c133af82ef5_1575330402516_98482903 X-MC-Loop-Signature: 1575330402516:2956078607 X-MC-Ingress-Time: 1575330402515 Original-Received: from pdx1-sub0-mail-a98.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a98.g.dreamhost.com (Postfix) with ESMTP id 025318018D; Mon, 2 Dec 2019 15:46:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=mvtWIyO0sYFoCzoHYyO2gfmjhC4=; b= feoNzSwhsP+roTTo3PIN/+BX1uEwcUS1xYBLSH6pgatBSEd8NdELVqvdTEzoYjv8 1yIybhvAIQycvF3uVMoFR/JwduPI5awrEStWwPrU116d2F0qRkYAZJ2H8471Q5HY esgpchOzBIjw6UXlM5BvVpWEanVPy+SHgo1C778SVvM= Original-Received: from mail.jurta.org (m91-129-96-42.cust.tele2.ee [91.129.96.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a98.g.dreamhost.com (Postfix) with ESMTPSA id 5FC5C8018A; Mon, 2 Dec 2019 15:46:34 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a98 In-Reply-To: <8736e3vve8.fsf@gmx.net> (Stephen Berman's message of "Mon, 02 Dec 2019 12:06:55 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:172793 Archived-At: --=-=-= Content-Type: text/plain > 0. emacs -Q > 1. M-! te M-/ > > => It takes about 4 seconds on my machine for the expansion "text" to > appear, during which the minibuffer displays "[Scanning for > dabbrevs...100%]" and then "[Scanning for dabbrevs...done]". On builds > without this regression, the expansion is virtually instantaneous and no > message is seen in the minibuffer. This is because of the current limitation of minibuffer-message. It uses sit-for to wait for 2 seconds per every message. This should be fixed by using the timer, so there will be no delays anymore: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=minibuffer-message-timer.patch diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index a7bdde478f..3febdeb174 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -702,6 +702,9 @@ minibuffer (defvar minibuffer-message-properties nil "Text properties added to the text shown by `minibuffer-message'.") +(defvar minibuffer-message-timer nil) +(defvar minibuffer-message-overlay nil) + (defun minibuffer-message (message &rest args) "Temporarily display MESSAGE at the end of the minibuffer. The text is displayed for `minibuffer-message-timeout' seconds, @@ -732,24 +735,23 @@ minibuffer-message ;; Don't overwrite the face properties the caller has set (text-properties-at 0 message)) (setq message (apply #'propertize message minibuffer-message-properties))) - (let ((ol (make-overlay (point-max) (point-max) nil t t)) - ;; A quit during sit-for normally only interrupts the sit-for, - ;; but since minibuffer-message is used at the end of a command, - ;; at a time when the command has virtually finished already, a C-g - ;; should really cause an abort-recursive-edit instead (i.e. as if - ;; the C-g had been typed at top-level). Binding inhibit-quit here - ;; is an attempt to get that behavior. - (inhibit-quit t)) - (unwind-protect - (progn - (unless (zerop (length message)) - ;; The current C cursor code doesn't know to use the overlay's - ;; marker's stickiness to figure out whether to place the cursor - ;; before or after the string, so let's spoon-feed it the pos. - (put-text-property 0 1 'cursor t message)) - (overlay-put ol 'after-string message) - (sit-for (or minibuffer-message-timeout 1000000))) - (delete-overlay ol))))) + + (when (timerp minibuffer-message-timer) + (cancel-timer minibuffer-message-timer)) + (when (overlayp minibuffer-message-overlay) + (delete-overlay minibuffer-message-overlay)) + (setq minibuffer-message-overlay + (make-overlay (point-max) (point-max) nil t t)) + (setq minibuffer-message-timer + (run-with-timer (or minibuffer-message-timeout 1) nil + (lambda () (when (overlayp minibuffer-message-overlay) + (delete-overlay minibuffer-message-overlay))))) + (unless (zerop (length message)) + ;; The current C cursor code doesn't know to use the overlay's + ;; marker's stickiness to figure out whether to place the cursor + ;; before or after the string, so let's spoon-feed it the pos. + (put-text-property 0 1 'cursor t message)) + (overlay-put minibuffer-message-overlay 'after-string message))) (defun minibuffer-completion-contents () "Return the user input in a minibuffer before point as a string. --=-=-=--