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: Sun, 02 Jul 2023 21:51:01 +0000 (UTC) Message-ID: <87zg4eq8xn.fsf@catern.com> 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="23996"; mail-complaints-to="usenet@ciao.gmane.io" To: 64428@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 02 23:52:26 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 1qG4zZ-000608-GK for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 02 Jul 2023 23:52:26 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qG4zF-0002da-ED; Sun, 02 Jul 2023 17:52:05 -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 1qG4zC-0002dF-Rx for bug-gnu-emacs@gnu.org; Sun, 02 Jul 2023 17:52:02 -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 1qG4zC-0000Yg-Je for bug-gnu-emacs@gnu.org; Sun, 02 Jul 2023 17:52:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qG4zC-0002cu-F2 for bug-gnu-emacs@gnu.org; Sun, 02 Jul 2023 17:52: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: Sun, 02 Jul 2023 21:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 64428 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.168833467410025 (code B ref -1); Sun, 02 Jul 2023 21:52:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 2 Jul 2023 21:51:14 +0000 Original-Received: from localhost ([127.0.0.1]:32853 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qG4yP-0002bd-Lc for submit@debbugs.gnu.org; Sun, 02 Jul 2023 17:51:14 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:46938) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qG4yK-0002bO-CL for submit@debbugs.gnu.org; Sun, 02 Jul 2023 17:51:11 -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 1qG4yJ-0002a2-AX for bug-gnu-emacs@gnu.org; Sun, 02 Jul 2023 17:51:08 -0400 Original-Received: from s.wrqvtzvf.outbound-mail.sendgrid.net ([149.72.126.143]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qG4yG-0000JE-8J for bug-gnu-emacs@gnu.org; Sun, 02 Jul 2023 17:51:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catern.com; h=from:subject:mime-version:to:content-type:cc:content-type:from: subject:to; s=s1; bh=GctElYPMDpr3ri+FyzH7tIE/9oQSmfVHCg0SbMOdv04=; b=tZEuwDgO2stsrYyPGOix/zhuJwfHyyBvWPusla+RmSyjh2I/eEw5rSS+ZLFve5nNVupU VsYcbP1iQTuA8eakQkH5CdzQc6Ka0+H567ErIveDvseaYu+Cy5l5ck/WXipv30GnMP3La/ KkXsvwlg81yUAYJeM7vEg5IAG2br+TkKRqiYVsUw4OtyOg5Rr9Nm3J4eBXFePrNAKCC88a TeaZO+qoXtS5d/UYfvczAJJgshM4c//AGSNYm385nDVIZfhMyDt0VIEMprGiaJ1+UvU+f+ MAmzldYz9z0BBpzC7hD+XNhEHhqmhYmCOP6B75EwyBSkPTIWt+GjOStp4H6m7bxA== Original-Received: by filterdrecv-8684c58db7-wf85l with SMTP id filterdrecv-8684c58db7-wf85l-1-64A1F145-17 2023-07-02 21:51:01.804762041 +0000 UTC m=+4572768.611346685 Original-Received: from earth.catern.com (unknown) by geopod-ismtpd-30 (SG) with ESMTP id iSZgfaLCRD23zcAsWcDOBQ for ; Sun, 02 Jul 2023 21:51:01.612 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=::1; helo=localhost; envelope-from=sbaugh@catern.com; receiver=gnu.org Original-Received: from localhost (localhost [IPv6:::1]) by earth.catern.com (Postfix) with ESMTPSA id 155186001E for ; Sun, 2 Jul 2023 17:51:00 -0400 (EDT) X-SG-EID: ZgbRq7gjGrt0q/Pjvxk7wM0yQFRdOkTJAtEbkjCkHbKGk3oyiVrTz2yiiCxopTWGlSlisWiCVCI3GurRyFYYdc0ShTVKjL/VztCDEwjXZvrs6KV/kcszzv0ek5o8PdwzXoVQIPQ3OWqRvE3PBnIhkARm1phkYFXtvEB9DfYI2182ikoj1/OmpnlE/uBfCUcUhy4XD3UODUvvQwk7MuBNFw== X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q== Received-SPF: pass client-ip=149.72.126.143; envelope-from=bounces+21787432-3678-bug-gnu-emacs=gnu.org@em8926.catern.com; helo=s.wrqvtzvf.outbound-mail.sendgrid.net X-Spam_score_int: -7 X-Spam_score: -0.8 X-Spam_bar: / X-Spam_report: (-0.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_BL_SPAMCOP_NET=1.347, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, UNPARSEABLE_RELAY=0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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:264501 Archived-At: --=-=-= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Tags: patch This patch is based on the patch in bug#64425 (since I noticed this unrelated issue while working on that, and they touch the same code). 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 'type as a property in the mode-line. In GNU Emacs 29.0.92 (build 8, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw3d scroll bars) of 2023-07-02 built on earth Repository revision: c361966508e2da159b5e65c37dff7f78e87b3445 Repository branch: emacs-29 Windowing system distributor 'The X.Org Foundation', version 11.0.12101008 System Description: NixOS 23.05 (Stoat) Configured using: 'configure --with-x-toolkit=lucid --with-tree-sitter --with-xinput2' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Fix-flymake-mode-line-scrolling-with-pixel-scroll-pr.patch >From ead790ca0525472ed52314b8bab67e7d246cda4e 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 'type as a property in the mode-line. --- lisp/progmodes/flymake.el | 43 +++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 47dc32f9245..a424b0b6c8d 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -1449,6 +1449,32 @@ 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* ((posn-string (posn-string (event-start event))) + (type (get-text-property (cdr posn-string) 'type (car posn-string)))) + (with-selected-window (posn-window (event-start event)) + (flymake-goto-prev-error 1 (list type) t)))) + +(defun flymake--mode-line-counter-scroll-next (event) + (interactive "e") + (let* ((posn-string (posn-string (event-start event))) + (type (get-text-property (cdr posn-string) 'type (car posn-string)))) + (with-selected-window (posn-window (event-start event)) + (flymake-goto-next-error 1 (list type) t)))) + +(setq 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 +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 + keymap ,flymake--mode-line-counter-map))))) ;;; Per-buffer diagnostic listing -- 2.41.0 --=-=-=--