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: Mon, 16 Dec 2019 01:59:45 +0200 Organization: LINKOV.NET Message-ID: <878snd2liu.fsf@mail.linkov.net> References: <8736e3vve8.fsf@gmx.net> <83y2vujd0y.fsf@gnu.org> <87blspm0sm.fsf@mail.linkov.net> <837e3ckbem.fsf@gnu.org> <871rtjn0kt.fsf@mail.linkov.net> <83lfrrigj8.fsf@gnu.org> <87eexiqps5.fsf@mail.linkov.net> <83lfrphp94.fsf@gnu.org> <87wob7g2jk.fsf@mail.linkov.net> <83k177ebs0.fsf@gnu.org> <87muc27prn.fsf@mail.linkov.net> <83tv6acgq5.fsf@gnu.org> <87eexdoygh.fsf@mail.linkov.net> <83tv68c0nb.fsf@gnu.org> <87d0cubfxx.fsf@mail.linkov.net> <83a77y9k35.fsf@gnu.org> <87eex9jf14.fsf@mail.linkov.net> <83d0cs8uw8.fsf@gnu.org> <87a77uh5a5.fsf@mail.linkov.net> <83r21561qd.fsf@gnu.org> 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="128289"; 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: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Dec 16 01:02:19 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 1igdq4-000X9N-2u for geb-bug-gnu-emacs@m.gmane.org; Mon, 16 Dec 2019 01:02:16 +0100 Original-Received: from localhost ([::1]:44814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1igdq2-00024d-C4 for geb-bug-gnu-emacs@m.gmane.org; Sun, 15 Dec 2019 19:02:14 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50147) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1igdpr-00022P-LT for bug-gnu-emacs@gnu.org; Sun, 15 Dec 2019 19:02:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1igdpq-0001Ug-91 for bug-gnu-emacs@gnu.org; Sun, 15 Dec 2019 19:02:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59787) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1igdpq-0001Uc-5V for bug-gnu-emacs@gnu.org; Sun, 15 Dec 2019 19:02:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1igdpq-0000so-31 for bug-gnu-emacs@gnu.org; Sun, 15 Dec 2019 19:02:02 -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, 16 Dec 2019 00:02:02 +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.15764544723300 (code B ref 38457); Mon, 16 Dec 2019 00:02:02 +0000 Original-Received: (at 38457) by debbugs.gnu.org; 16 Dec 2019 00:01:12 +0000 Original-Received: from localhost ([127.0.0.1]:37527 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1igdp2-0000r8-0G for submit@debbugs.gnu.org; Sun, 15 Dec 2019 19:01:12 -0500 Original-Received: from black.elm.relay.mailchannels.net ([23.83.212.19]:7049) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1igdoz-0000qn-Jd for 38457@debbugs.gnu.org; Sun, 15 Dec 2019 19:01:10 -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 76FB11A15D9; Mon, 16 Dec 2019 00:01:08 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a34.g.dreamhost.com (100-96-15-224.trex.outbound.svc.cluster.local [100.96.15.224]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id DDE011A1741; Mon, 16 Dec 2019 00:01:07 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a34.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, 16 Dec 2019 00:01:08 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Cooing-Continue: 15a891ca7179da03_1576454468149_3049199648 X-MC-Loop-Signature: 1576454468149:862318028 X-MC-Ingress-Time: 1576454468149 Original-Received: from pdx1-sub0-mail-a34.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a34.g.dreamhost.com (Postfix) with ESMTP id CAC107F5F6; Sun, 15 Dec 2019 16:01:04 -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=cDhrsLJw/mCjxfXWF0e3X0WG6S8=; b= oArOG+90Fc4PQqK6vS9g7pmN8oTPVKXboo80pTGpMceQ0Wug/OABZgyGOACRVl5u vWpqPWv6ujf15T7pHgeY/3Qx4ICXEXKZM8pXsiWkWNflsXqt+Y/stY8NaoSNzKWk fsvX6lSMEd+/OdZ5wwdDjTOe95C8pC/gDm1jOn1DXAo= Original-Received: from mail.jurta.org (m91-129-107-186.cust.tele2.ee [91.129.107.186]) (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-a34.g.dreamhost.com (Postfix) with ESMTPSA id 47D2D7F5F4; Sun, 15 Dec 2019 16:01:02 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a34 In-Reply-To: <83r21561qd.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 15 Dec 2019 17:35:22 +0200") X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: -100 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrvddtgedgudejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufhofhffjgfkfgggtgesmhdtreertdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucfkphepledurdduvdelrddutdejrddukeeinecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddtjedrudekiedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopegvlhhiiiesghhnuhdrohhrghenucevlhhushhtvghrufhiiigvpedt 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:173408 Archived-At: --=-=-= Content-Type: text/plain >> The main problem with 'minibuffer-message' is that it uses 'sit-for'. >> If a new function will use the same 'sit-for' to detect when input is >> available, then it will bring the same problems. Here's is an example >> of the problems it causes: I call 'select-window' from 'post-command-hook' >> to select an output window, but 'sit-for' delays selecting the window >> for 2 seconds until 'execute-extended-command' finishes displaying >> the message "You can run the command `%s' with %s" using 'sit-for'. >> The output window becomes selected only after 2 seconds because >> a customized function in 'post-command-hook' doesn't run earlier >> than returning from 'sit-for' in 'execute-extended-command'. >> >> 'sit-for' is used in many places, but it's inappropriate for these tasks. >> What is a possible replacement for 'sit-for'? For a delay of specified >> seconds, one solution is to run a timer. But how to replace another >> aspect of 'sit-for', namely an ability to stop when input is available? I'd like to add that the biggest drawback of sit-for is that no message is displayed when input is available like is in e.g. do-after-load-evaluation after start, or when the user is typing in the minibuffer, the user might miss an important message. > What I had in mind was to go with your idea, viz.: > >> Then your proposed implementation should be activated when >> minibuffer-message-timeout is set to a non-nil value. >> Otherwise, when it's a number, it should use the timer. > > IOW, introduce a new option, which will affect the new function we > were talking about, a near-clone of minibuffer-message (and will not > affect minibuffer-message itself). When that new option's value is > not a number, the near-clone of minibuffer-message should not call > sit-for at all; and when that value is a number, use a timer to remove > the message after that many seconds if no input arrives before that. > > In any case, I thought we agreed not to call minibuffer-message from > 'message', but define a new function, similar but not identical to > minibuffer-message (what I call a "near-clone"). And > minibuffer-message-timeout should not affect that new function, it > should be a separate option. I agree that a new function needs to be created, and agree not to call minibuffer-message from 'message'. >> > Assuming you agree, once this change is made, some of the recent >> > changes related to these issues should be reverted. Can I ask you to >> > review those related changesets and publish a list of those which need >> > to be reverted or augmented? >> >> Here's is a list of related changesets: >> >> 8693611136 >> aa89c84e00 >> 54c792ece6 >> >> Please revert them if you want. > > Thanks. Let's revisit these after the implementation of the > minibuffer-message's clone is finalized, so that we could know which > ones of these are still needed and which aren't. Since a new near-clone of minibuffer-message is needed, and we agreed to not call minibuffer-message from 'message', I reverted all previous changes. Now a new feature could be implemented from scratch. I created a new ELPA package attached below that implements this feature. So everyone who like it can use it even after release. Also this package could be used for experimentation to find the best way to use it, that later could be moved to core in Emacs 28. I think now we have no moral right to delay the Emacs 27 pretest anymore. --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=minimess.el Content-Transfer-Encoding: quoted-printable ;;; minimess.el --- Use function like minibuffer-message in active minibuff= er -*- lexical-binding: t; -*- ;; Copyright (C) 2019 Free Software Foundation, Inc. ;; Author: Juri Linkov ;; Keywords: minibuffer ;; Version: 0.1 ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . ;;; Commentary: ;; When the minibuffer is active, use the function like `minibuffer-message' ;; to display the message temporarily at the end of the minibuffer. ;;; Code: (defgroup minimess () "Use the function like `minibuffer-message' in the active minibuffer." :group 'minibuffer) (defcustom minimess-timeout 2 "How long to display an echo-area message when the minibuffer is active. If the value is a number, it should be specified in seconds. If the value is not a number, such messages never time out." :type 'integer) (defvar minimess-timer nil) (defvar minimess-overlay nil) (defvar minimess-properties nil "Text properties added to the text shown by `minimess-minibuffer-message'= .") (defun minimess-minibuffer-message (message &rest args) "Temporarily display MESSAGE at the end of the minibuffer. The text is displayed for `minimess-timeout' seconds, or until the next input event arrives, whichever comes first. Enclose MESSAGE in [...] if this is not yet the case. If ARGS are provided, then pass MESSAGE through `format-message'." (if (not (minibufferp (current-buffer))) (progn (if args (apply #'message message args) (message "%s" message)) (prog1 (sit-for (or minimess-timeout 1000000)) (message nil))) ;; Record message in the *Messages* buffer (let ((inhibit-message t)) (if args (apply #'message message args) (message "%s" message))) (if (or (null args) (member (car args) '("" nil))) ;; The caller decided to clear the message (progn (when (timerp minimess-timer) (cancel-timer minimess-timer)) (when (overlayp minimess-overlay) (delete-overlay minimess-overlay))) (setq message (if (and (null args) (string-match-p "\\` *\\[.+\\]\\'" message)) ;; Make sure we can put-text-property. (copy-sequence message) (concat " [" message "]"))) (when args (setq message (apply #'format-message message args))) (unless (or (null minimess-properties) ;; Don't overwrite the face properties the caller has set (text-properties-at 0 message)) (setq message (apply #'propertize message minimess-properties))) (when (timerp minimess-timer) (cancel-timer minimess-timer)) (when (overlayp minimess-overlay) (delete-overlay minimess-overlay)) (setq minimess-overlay (make-overlay (point-max) (point-max) nil t t)) (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 minimess-overlay 'after-string message) (when (numberp minimess-timeout) (setq minimess-timer (run-with-timer minimess-timeout nil (lambda () (when (overlayp minimess-overlay) (delete-overlay minimess-overlay= )))))) (when (and (stringp debug-on-message) (stringp message) (string-match-p debug-on-message message)) (debug message))))) (defun minimess-message (orig-fun format-string &rest args) (if (and ;; When `inhibit-message' is non-nil, the intention was to just ;; log the message to the *Messages* buffer using `message'. (null inhibit-message) (window-live-p (active-minibuffer-window)) (window-live-p (old-selected-window)) (bufferp (window-buffer (old-selected-window))) (minibufferp (window-buffer (old-selected-window)))) (with-current-buffer (window-buffer (old-selected-window)) (apply #'minimess-minibuffer-message format-string args)) (apply orig-fun format-string args))) (defun minimess-unload-function () "Get free of advices." (advice-remove 'message #'minimess-message) nil) (advice-add 'message :around #'minimess-message) (provide 'minimess) ;;; minimess.el ends here --=-=-=--