From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#64428: [PATCH] Fix flymake mode line scrolling with pixel-scroll-precision-mode Date: Thu, 13 Jul 2023 08:56:44 +0300 Message-ID: <83edlc5p7n.fsf@gnu.org> References: <87zg4eq8xn.fsf@catern.com> <83ilaxij8c.fsf@gnu.org> <833521i1ag.fsf@gnu.org> <87y1jrncnl.fsf@catern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24128"; mail-complaints-to="usenet@ciao.gmane.io" Cc: sbaugh@janestreet.com, 64428@debbugs.gnu.org To: joaotavora@gmail.com, sbaugh@catern.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jul 13 07:57:31 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 1qJpKU-00065T-OJ for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 13 Jul 2023 07:57:30 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qJpKF-0003EH-G5; Thu, 13 Jul 2023 01:57:15 -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 1qJpK2-0003E2-IS for bug-gnu-emacs@gnu.org; Thu, 13 Jul 2023 01:57: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 1qJpK1-0006Db-Ta for bug-gnu-emacs@gnu.org; Thu, 13 Jul 2023 01:57:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qJpK1-0007LU-PV for bug-gnu-emacs@gnu.org; Thu, 13 Jul 2023 01:57:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 13 Jul 2023 05:57:01 +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.168922780028205 (code B ref 64428); Thu, 13 Jul 2023 05:57:01 +0000 Original-Received: (at 64428) by debbugs.gnu.org; 13 Jul 2023 05:56:40 +0000 Original-Received: from localhost ([127.0.0.1]:53198 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qJpJg-0007Kq-8S for submit@debbugs.gnu.org; Thu, 13 Jul 2023 01:56:40 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:35190) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qJpJd-0007Ka-Jz for 64428@debbugs.gnu.org; Thu, 13 Jul 2023 01:56:38 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qJpJW-00067U-6v; Thu, 13 Jul 2023 01:56:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=XX1ZRLcnrnyVfOOm7OneOlmTk9Rc7kz20T6pe52pEUI=; b=V9GOLMOHq7FDP0ngWCep lve2vkrG5w2gTOh3Z986WqaPghgqBisxG+JTlEtOwNnNgynTp4xjRg3PqBr2VqvUsR6aPCgAdsYcA pC30KcgJkj/nFuYM6UQBuHdnpPRThZY8+ZmpyUaABHcYWaQRj5CExVysJjqWV7aMGCOaVaHFSqGwq PR3/Qt3Rtb4kqwFFbr5AuG1yoH4sDKNjMN+DRtruS7OA9APpN+ES0WNZFz3Akz89RxQX0Qrd3qggH mFUgWtNQUBZNfyNEgH94+2ZTVwhwgWFntftggzfYrzHW00wKsP5z4zPgEfIrqaJ9sUoLr5qDGoaTT KR8QU0rYxcMK0A==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qJpJT-0005dU-OK; Thu, 13 Jul 2023 01:56:29 -0400 In-Reply-To: <87y1jrncnl.fsf@catern.com> (sbaugh@catern.com) 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:265000 Archived-At: > From: sbaugh@catern.com > Date: Fri, 07 Jul 2023 12:12:32 +0000 (UTC) > Cc: Eli Zaretskii , Spencer Baugh , > 64428@debbugs.gnu.org > > Joćo Tįvora 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-string)))) > >> + (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ćo > > Fixed. > > I have tested in both graphical and tty Emacs. Thanks. Joćo, is this good to go, from your POV? I admit I consider it a bit strange to have commands that are "internal" and don't have a doc string: > +(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)))) Any reasons not to make them public and add doc strings?