From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: sbaugh@catern.com Newsgroups: gmane.emacs.bugs Subject: bug#64428: [PATCH] Fix flymake mode line scrolling with pixel-scroll-precision-mode Date: Fri, 07 Jul 2023 12:12:32 +0000 (UTC) Message-ID: <87y1jrncnl.fsf@catern.com> References: <87zg4eq8xn.fsf@catern.com> <83ilaxij8c.fsf@gnu.org> <833521i1ag.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5835"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Spencer Baugh , Eli Zaretskii , 64428@debbugs.gnu.org To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jul 07 14:14:01 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1qHkLG-0000sV-Cl for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 07 Jul 2023 14:14:00 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qHkKy-00058o-E6; Fri, 07 Jul 2023 08:13:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qHkKd-00055E-EB for bug-gnu-emacs@gnu.org; Fri, 07 Jul 2023 08:13:08 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qHkKd-0005Vc-5f for bug-gnu-emacs@gnu.org; Fri, 07 Jul 2023 08:13:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qHkKc-0002b3-Jb for bug-gnu-emacs@gnu.org; Fri, 07 Jul 2023 08:13:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: sbaugh@catern.com Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 07 Jul 2023 12:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64428 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 64428-submit@debbugs.gnu.org id=B64428.16887319779969 (code B ref 64428); Fri, 07 Jul 2023 12:13:02 +0000 Original-Received: (at 64428) by debbugs.gnu.org; 7 Jul 2023 12:12:57 +0000 Original-Received: from localhost ([127.0.0.1]:42693 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qHkKR-0002ad-Hj for submit@debbugs.gnu.org; Fri, 07 Jul 2023 08:12:57 -0400 Original-Received: from s.wrqvwxzv.outbound-mail.sendgrid.net ([149.72.154.232]:29144) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qHkKE-0002aA-EN for 64428@debbugs.gnu.org; Fri, 07 Jul 2023 08:12:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catern.com; h=from:subject:in-reply-to:references:mime-version:to:cc:content-type: cc:content-type:from:subject:to; s=s1; bh=di0zrwpFNjz7Nouk71Lf7m72A/DKIcixYaZFS/ZX9BQ=; b=cSoTxPzLAwqIFudAKx8WZ+z+IV0V95rlkChOZ+ATUI7mTZoS4AcEOIuj0JTsih7Nm8Om iQGZQY9AcNoJMMdGWSCpjMYZD7Mw12qUiOoVDWFmXgQ3S1rv7U13/SH7u4cn4kUG88yy1y Vcq2C1M3CSrBL81XoDomMhZ1PXGDvM5c006ld1W7b6MUi2DYwk4yy737dLMjZavdJwe6Lp ALXdfWCqRa7VPCMm72Cu4CB5bmN0z+pNnZxnR/apMvRjHtpn0iWt4+7Qlbh10/keVAABdC COhPBVkGfydywp+gUa1W98jEMguQGawz4cp3VG4aG/uZEHHePotDvtptpqHq7QpQ== Original-Received: by filterdrecv-84b96456cb-zd4xh with SMTP id filterdrecv-84b96456cb-zd4xh-1-64A80130-6 2023-07-07 12:12:32.118821027 +0000 UTC m=+4970058.743608104 Original-Received: from earth.catern.com (unknown) by geopod-ismtpd-15 (SG) with ESMTP id T4T7SMNwTyi1Suwzu8eOeA Fri, 07 Jul 2023 12:12:31.956 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=::1; helo=localhost; envelope-from=sbaugh@catern.com; receiver=gmail.com Original-Received: from localhost (localhost [IPv6:::1]) by earth.catern.com (Postfix) with ESMTPSA id 11C1B62568; Fri, 7 Jul 2023 08:12:31 -0400 (EDT) In-Reply-To: ("=?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?="'s message of "Fri, 7 Jul 2023 12:47:10 +0100") X-SG-EID: ZgbRq7gjGrt0q/Pjvxk7wM0yQFRdOkTJAtEbkjCkHbJtFQAarA1wi9IzsbpUbYuqi4BmWnynmXELmi5I/907kwZWlJVkjYdAdGk4IlwYZjCk0KMkYRwkSvpgqfqsAdu+JW2t3GddQS0/LCtsx4vDHl0Ia2Be2dEUL4C/naCtSGuZ8hpeBaga0xcxpU3tHFDYN+4SuvgXlgxam+Wm7FwWMQ== X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q== X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:264719 Archived-At: --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Jo=E3o T=E1vora writes: > On second thought, here are some comments that I think should be > improved in Spencer's patch: > >> @@ -1479,21 +1505,8 @@ flymake--mode-line-counter >> ((eq type :warning) "warnings") >> ((eq type :note) "notes") >> (t (format "%s diagnostics" type)))) >> - keymap >> - ,(let ((map (make-sparse-keymap))) >> - (define-key map (vector 'mode-line >> - mouse-wheel-down-event) >> - (lambda (event) >> - (interactive "e") >> - (with-selected-window (posn-window (event-start event)) >> - (flymake-goto-prev-error 1 (list type) t)))) >> - (define-key map (vector 'mode-line >> - mouse-wheel-up-event) >> - (lambda (event) >> - (interactive "e") >> - (with-selected-window (posn-window (event-start event)) >> - (flymake-goto-next-error 1 (list type) t)))) >> - map)))))) >> + type ,type > > Spencer, here you are recording the value of the `type` in a `type` > text-property of the affected text. Generally, though this rule > isn't enforced or always followed (at least by me), it's better > to give these package-specific properties some longer > package-specific name like `flymake--diagnostic-type`. This will > prevent any clashes if the less-qualified `type` is ever defined > to mean something else as a text-property. > >> + (interactive "e") >> + (let* ((posn-string (posn-string (event-start event))) >> + (type (get-text-property (cdr posn-string) 'type (car posn-str= ing)))) >> + (with-selected-window (posn-window (event-start event)) >> + (flymake-goto-prev-error 1 (list type) t)))) > > And here, you could consider saving the value of (event-start event) > by adding another early binding to that `let*`, maybe call it `estart`. > This is much less important than the first comment though. > > Jo=E3o Fixed. I have tested in both graphical and tty Emacs. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Fix-flymake-mode-line-scrolling-with-pixel-scroll-pr.patch >From c369c3b99ef1e5f9eab29f99a9d4f354352ef05b Mon Sep 17 00:00:00 2001 From: Spencer Baugh Date: Sun, 2 Jul 2023 17:49:23 -0400 Subject: [PATCH] Fix flymake mode line scrolling with pixel-scroll-precision-mode When pixel-scroll-precision-mode is enabled, scrolling the mouse wheel will yield wheel-{up,down} events. flymake now binds the new events in addition to the old mouse-wheel-{up,down}-event. * lisp/progmodes/flymake.el:(flymake--mode-line-counter-scroll-prev, flymake--mode-line-counter-scroll-next, flymake--mode-line-counter-map): Add. (flymake--mode-line-counter): Use new keymap and include flymake--diagnostic-type as a property in the mode-line. --- lisp/progmodes/flymake.el | 47 ++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 47dc32f9245..17154b646d7 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -1449,6 +1449,36 @@ flymake--mode-line-exception (defun flymake--mode-line-counters () (when (flymake-running-backends) flymake-mode-line-counter-format)) +(defun flymake--mode-line-counter-scroll-prev (event) + (interactive "e") + (let* ((event-start (event-start event)) + (posn-string (posn-string event-start)) + (type (get-text-property + (cdr posn-string) 'flymake--diagnostic-type (car posn-string)))) + (with-selected-window (posn-window event-start) + (flymake-goto-prev-error 1 (list type) t)))) + +(defun flymake--mode-line-counter-scroll-next (event) + (interactive "e") + (let* ((event-start (event-start event)) + (posn-string (posn-string event-start)) + (type (get-text-property + (cdr posn-string) 'flymake--diagnostic-type (car posn-string)))) + (with-selected-window (posn-window event-start) + (flymake-goto-next-error 1 (list type) t)))) + +(defvar flymake--mode-line-counter-map + (let ((map (make-sparse-keymap))) + (define-key map (vector 'mode-line mouse-wheel-down-event) + #'flymake--mode-line-counter-scroll-prev) + (define-key map [mode-line wheel-down] + #'flymake--mode-line-counter-scroll-prev) + (define-key map (vector 'mode-line mouse-wheel-up-event) + #'flymake--mode-line-counter-scroll-next) + (define-key map [mode-line wheel-up] + #'flymake--mode-line-counter-scroll-next) + map)) + (defun flymake--mode-line-counter (type &optional no-space) "Compute number of diagnostics in buffer with TYPE's severity. TYPE is usually keyword `:error', `:warning' or `:note'." @@ -1479,21 +1509,8 @@ flymake--mode-line-counter ((eq type :warning) "warnings") ((eq type :note) "notes") (t (format "%s diagnostics" type)))) - keymap - ,(let ((map (make-sparse-keymap))) - (define-key map (vector 'mode-line - mouse-wheel-down-event) - (lambda (event) - (interactive "e") - (with-selected-window (posn-window (event-start event)) - (flymake-goto-prev-error 1 (list type) t)))) - (define-key map (vector 'mode-line - mouse-wheel-up-event) - (lambda (event) - (interactive "e") - (with-selected-window (posn-window (event-start event)) - (flymake-goto-next-error 1 (list type) t)))) - map)))))) + flymake--diagnostic-type ,type + keymap ,flymake--mode-line-counter-map))))) ;;; Per-buffer diagnostic listing -- 2.41.0 --=-=-=--