From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.devel Subject: Re: Intelligent stacking of messages in the echo area Date: Wed, 25 Dec 2019 12:21:53 +0800 Message-ID: <87fth9dogu.fsf@localhost> References: <87sgldfi9j.fsf@mail.linkov.net> <878sn3g0o7.fsf@gmail.com> <83imm7xiu9.fsf@gnu.org> <87sgladqk2.fsf@localhost> <83d0cdwx9j.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="133192"; mail-complaints-to="usenet@blaine.gmane.org" Cc: emacsuser@freemail.hu, emacs-devel@gnu.org, juri@linkov.net To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Dec 25 05:24:14 2019 Return-path: Envelope-to: ged-emacs-devel@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 1ijyDS-000YW1-Tr for ged-emacs-devel@m.gmane.org; Wed, 25 Dec 2019 05:24:11 +0100 Original-Received: from localhost ([::1]:43780 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ijyDR-0006mZ-4p for ged-emacs-devel@m.gmane.org; Tue, 24 Dec 2019 23:24:09 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48501) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ijyDL-0006lA-9p for emacs-devel@gnu.org; Tue, 24 Dec 2019 23:24:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ijyDK-0000x1-40 for emacs-devel@gnu.org; Tue, 24 Dec 2019 23:24:03 -0500 Original-Received: from mail-yw1-xc36.google.com ([2607:f8b0:4864:20::c36]:43566) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ijyDI-0000so-34; Tue, 24 Dec 2019 23:24:00 -0500 Original-Received: by mail-yw1-xc36.google.com with SMTP id v126so9010278ywc.10; Tue, 24 Dec 2019 20:24:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=ZF99e7IYB7/XbhaaSjJIWnetVh9NpGEETktrU9V8ORg=; b=rUUp9bhEqeZdroOKGJH602dgmLmvvoEpR/RACTvsHYQmlmrEAcHPjtiyixVVL8+X3v +/fNPOp+dCuqxOSgHJrLTrTWw+F18zTcHuBa6qU3/7iXCLn7jCXdnB4dpmVf5ulN9DP6 T1otKFKBkeUQK4lLm5BSmT8Y6IYLYxYUS9jq4GVn+5pl9nc68wJf0IzUy7yPAK/24Yum cXJkU7aVECZqDd+/YFvhhhQlz4HoXzdnNR75ZypJK2t8eFAuv9HHxSA4zIsLGVHrbOKH W7uKcFi+5fkYAel9apdeibGBdNMbZm01yXqGKjhefejgz1wjEXZ55zYDV12mnvA5V8Rv ketQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=ZF99e7IYB7/XbhaaSjJIWnetVh9NpGEETktrU9V8ORg=; b=BHGXwznmCHutj8rOA1nWAJluaPy6MMmCrKmy02j2pU8B7cJkiT5aAudFS5phfi5ZGm Dwt5BdaWNqWxuRF+8Jq3Kdxvx9TsKaAXYniC1q/l0LnzwFJcJfG3lQn5p3ub7/FFCBUm Qx0eCAanudnvFxxYKTm2xTPlHTRotzo2fv8mED6Zo/hiN+eESXnCVTfA6GrYgMLKNnw1 vqKgIv3pUv3m6sfebagbuLVrsAM5E7DRkEJcn9th4Fj7WWGYbzUhLXRBCd/u816OTkZ5 71Y6z5oUCoM0J1bTpGMp8fKIu9wAsBJSKrrq5oSyilz7bX3m8czlIOaOBfPpNH/gDaVU qalA== X-Gm-Message-State: APjAAAVQsAKNuwGqbyr3dwCZPJ+nFJSM6Lib2GOM8RkaqUIH1C4sH0oB H9ZGqAKYsLe4qb6iagfmZk6N4XZ7AyM= X-Google-Smtp-Source: APXvYqzVMI1HNs/3GBfrkam7vxz+J6QKxuF/y0TjLzFj+2KANZbcOnh05DBe64c9xIYO4nPrMBZRig== X-Received: by 2002:a81:9141:: with SMTP id i62mr28355033ywg.273.1577247838988; Tue, 24 Dec 2019 20:23:58 -0800 (PST) Original-Received: from localhost ([5.226.137.4]) by smtp.gmail.com with ESMTPSA id m16sm10113182ywa.90.2019.12.24.20.23.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Dec 2019 20:23:58 -0800 (PST) In-Reply-To: <83d0cdwx9j.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::c36 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:243624 Archived-At: --=-=-= Content-Type: text/plain > Then maybe we should allow a function as well. Good idea. Instead of piling up heuristics into set-multi-message, it may be better to run an abnormal hook. See the attached. > The idea about filtering driven by regular expressions. Do you know a good regexp to match a keystroke sequence? It seems easier for me to compare with this-command-keys. Best, Ihor --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=multi-message.el Content-Transfer-Encoding: quoted-printable (defcustom multi-message-timeout 2 "Number of seconds between messages before clearing the accumulated list." :type 'number :group 'minibuffer :version "28.1") (defcustom multi-message-max 8 "Max size of the list of accumulated messages." :type 'number :group 'minibuffer :version "28.1") (defun multi-message--ellipsis-p (message) "Return non nil when MESSAGE ends with ellipsis." (string-match-p "\\.\\.\\.\\'" message)) (defun multi-message--keystroke-echo-p (message) "Return non nil when MESSAGE is a currently entered keystroke." (string=3D message (key-description (this-command-keys-vector)))) (defcustom multi-message-transient-functions '(multi-message--ellipsis-p mu= lti-message--keystroke-echo-p) "List of functions to filter out transient messages that should not be st= acked. Each function is called in sequence with message string as an only argument. If any of the functions returns non nil, the message is filtered out." :type 'list :group 'minibuffer :version "28.1") (defvar multi-message-separator "\n") (defvar multi-message-list nil) (defun set-multi-message (message) "Return recent messages as one string to display in the echo area. Note that this feature works best only when `resize-mini-windows' is at its default value `grow-only'." (let ((last-message (car multi-message-list))) (unless (and last-message (equal message (aref last-message 1))) (when last-message (cond ((> (float-time) (+ (aref last-message 0) multi-message-timeout)) (setq multi-message-list nil)) ((or ;; `message-log-max' was nil, potential clutter. (aref last-message 2) (run-hook-with-args-until-success 'multi-message-transient-funct= ions (aref last-message 1))) (setq multi-message-list (cdr multi-message-list))))) (push (vector (float-time) message (not message-log-max)) multi-messa= ge-list) (when (> (length multi-message-list) multi-message-max) (setf (nthcdr multi-message-max multi-message-list) nil))) (mapconcat (lambda (m) (aref m 1)) (reverse multi-message-list) multi-message-separator))) (setq set-message-function 'set-multi-message) --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Ihor Radchenko >> Cc: juri@linkov.net, emacsuser@freemail.hu, emacs-devel@gnu.org >> Date: Tue, 24 Dec 2019 17:24:29 +0800 >> >> > I'd rather think a better way would be to have a variable which allows >> > to filter messages by regular expressions: any message that matches a >> > regexp in a list will not be stacked. >> >> It is a good idea. However, generating a universal regexp for, say, eldoc >> may be challenging. > > Then maybe we should allow a function as well. > >> >> Also, it would be great to avoid stacking the echo-keystrokes, but I >> >> have no clue how to detect them. >> > >> > See above. >> >> I cannot find what you refer to. > > The idea about filtering driven by regular expressions. --=-=-=--