From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#33740: [PATCH] Customizable flymake mode-line indicator Date: Fri, 20 Sep 2019 14:32:00 +0200 Message-ID: <87k1a3b133.fsf@gnus.org> References: <87bm4wjhgy.fsf@gmail.com> <87h85bq3u7.fsf@gnus.org> <83lfunwj1x.fsf@gnu.org> <871rwfnnip.fsf@gnus.org> <837e67w26m.fsf@gnu.org> <87o8zjm7ss.fsf@gnus.org> <834l1bw0r5.fsf@gnu.org> <87pnjxlo6u.fsf@gnus.org> <87woe5k86v.fsf@gnus.org> <87blvgjoev.fsf@gnus.org> <8736gsjn6z.fsf@gnus.org> <87sgosi7bu.fsf@gnus.org> <83lfuktcxy.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="159973"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 33740@debbugs.gnu.org, joaotavora@gmail.com, andreyk.mad@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Sep 20 14:34:11 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 1iBI6x-000fKb-Ch for geb-bug-gnu-emacs@m.gmane.org; Fri, 20 Sep 2019 14:34:07 +0200 Original-Received: from localhost ([::1]:58912 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBI6v-0006ww-Bn for geb-bug-gnu-emacs@m.gmane.org; Fri, 20 Sep 2019 08:34:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46540) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBI5z-0006uL-Dp for bug-gnu-emacs@gnu.org; Fri, 20 Sep 2019 08:33:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBI5u-0004su-AN for bug-gnu-emacs@gnu.org; Fri, 20 Sep 2019 08:33:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48097) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iBI5t-0004sW-P0 for bug-gnu-emacs@gnu.org; Fri, 20 Sep 2019 08:33:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iBI5t-0003RU-J0 for bug-gnu-emacs@gnu.org; Fri, 20 Sep 2019 08:33:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 20 Sep 2019 12:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33740 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 33740-submit@debbugs.gnu.org id=B33740.156898272813163 (code B ref 33740); Fri, 20 Sep 2019 12:33:01 +0000 Original-Received: (at 33740) by debbugs.gnu.org; 20 Sep 2019 12:32:08 +0000 Original-Received: from localhost ([127.0.0.1]:56918 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iBI52-0003QE-BY for submit@debbugs.gnu.org; Fri, 20 Sep 2019 08:32:08 -0400 Original-Received: from quimby.gnus.org ([80.91.231.51]:54016) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iBI4z-0003Q0-M8 for 33740@debbugs.gnu.org; Fri, 20 Sep 2019 08:32:06 -0400 Original-Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iBI4v-0000VE-8R; Fri, 20 Sep 2019 14:32:03 +0200 In-Reply-To: <83lfuktcxy.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 19 Sep 2019 20:26:17 +0300") 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:166758 Archived-At: Eli Zaretskii writes: > It is. Redrawing the mode line is a very frequent redisplay thing, so > optimizing the heck out of it is justified. In the simple case where the mode line element is a string, I can definitely see that it's warranted. In the Flymake case, where the value is (:eval (flymake--mode-line-format)), which returns a long and complex (:propertize) form that's then interpreted by this machinery -- it's pessimal. > That's what I meant when I said "wisely": you need to create faces in > advance, and take care to have each individual string you use to be of > a uniform face. And don't use propertize. Most modes do not have dynamic lighters, and using (:propertize) forms is a fine solution. For something like Flymake, that updates its lighter every time the mode line is redrawn, it just doesn't make much sense. If Flymake could just return a properly propertized string, then that would be a lot more efficient (both cons-wise and time wise) having it return this form (which I've lightly edited to elide the keymaps): ((:propertize " Flymake" mouse-face mode-line-highlight help-echo "3 known backends\n2 running\n1 disabled\nmouse-1: Display minor mode menu\nmouse-2: Show help for minor mode" keymap ...) (:propertize "[") (:propertize "0" face compilation-error mouse-face mode-line-highlight keymap .. help-echo #("0 diagnostics of type :error\nmouse-4/mouse-5: previous/next of this type" 0 1 (face compilation-error) 22 28 (face compilation-error))) (:propertize " ") (:propertize "0" face compilation-warning mouse-face mode-line-highlight keymap ... help-echo #("0 diagnostics of type :warning\nmouse-4/mouse-5: previous/next of this type" 0 1 (face compilation-warning) 22 30 (face compilation-warning))) (:propertize " ") (:propertize "14" face compilation-info mouse-face mode-line-highlight keymap ... help-echo #("14 diagnostics of type :note\nmouse-4/mouse-5: previous/next of this type" 0 2 (face compilation-info) 23 28 (face compilation-info))) (:propertize "]")) If there was a way to tell display_mode_element "don't do the caching stuff on this element", then Flymake could just return a propertized string and display_mode_element would have to do a whole lot less processing. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no