From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#64428: [PATCH] Fix flymake mode line scrolling with pixel-scroll-precision-mode Date: Thu, 13 Jul 2023 09:12:33 +0100 Message-ID: References: <87zg4eq8xn.fsf@catern.com> <83ilaxij8c.fsf@gnu.org> <833521i1ag.fsf@gnu.org> <87y1jrncnl.fsf@catern.com> <83edlc5p7n.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000aea60b060059e5d4" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24487"; mail-complaints-to="usenet@ciao.gmane.io" Cc: sbaugh@catern.com, 64428@debbugs.gnu.org, Spencer Baugh To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jul 13 10:13: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 1qJrS2-0006Dk-Au for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 13 Jul 2023 10:13:26 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qJrRg-0002QT-B9; Thu, 13 Jul 2023 04:13:04 -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 1qJrRe-0002QK-Ne for bug-gnu-emacs@gnu.org; Thu, 13 Jul 2023 04:13: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 1qJrRe-0002um-FV for bug-gnu-emacs@gnu.org; Thu, 13 Jul 2023 04:13:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qJrRd-0002WD-Tu for bug-gnu-emacs@gnu.org; Thu, 13 Jul 2023 04:13:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 13 Jul 2023 08:13: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.16892359759668 (code B ref 64428); Thu, 13 Jul 2023 08:13:01 +0000 Original-Received: (at 64428) by debbugs.gnu.org; 13 Jul 2023 08:12:55 +0000 Original-Received: from localhost ([127.0.0.1]:53320 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qJrRW-0002Vr-RQ for submit@debbugs.gnu.org; Thu, 13 Jul 2023 04:12:55 -0400 Original-Received: from mail-ot1-f54.google.com ([209.85.210.54]:54350) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qJrRU-0002Ve-0C for 64428@debbugs.gnu.org; Thu, 13 Jul 2023 04:12:53 -0400 Original-Received: by mail-ot1-f54.google.com with SMTP id 46e09a7af769-6b886456f66so243717a34.0 for <64428@debbugs.gnu.org>; Thu, 13 Jul 2023 01:12:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689235966; x=1691827966; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=/PE/DN1qhEX+N0DNTZxb6X+gVuMGvc1Yl1Q6SHMK+N0=; b=WjrE1ZJsAo7JElzMaqNhV3WORHd8m2l3WJnOMOP9a+LTNiwryNkQ+lDeYsK2Of2hwo xb7/67rygfjuvDIDGz6Z6tcanF7AWUSwigUdPw91ZHOyQhHrpqTAqURxTRJDet/Zhnvf 7lmH2R+MhImOqJkHbxVeQXrvwJQ5fHQtbLN7v/X4ZxudwkFH8aocN/kwOwF2SxB6uP4w q4K9Xb+QxeMlafJYRNoDHHU6TimVeEbD6QKHdmgVh55qjs1lUU5cHzdk98rItxrLNvMT QJLyCAohKnUOjGpxjzmFLgGAyC5EWxSWBkEu5wuNOmbYE8eEURVDkuEIdLuF2ED0qW28 9V6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689235966; x=1691827966; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/PE/DN1qhEX+N0DNTZxb6X+gVuMGvc1Yl1Q6SHMK+N0=; b=TTM1NMy1nJwUd2woGrGk8dDMkNkBwtjebeE/ahybGv+hnJ+R2Ilz8G2g5pgEBNAl3D agfUIPYjQx5znymtVLC3in1TQdIrTrAsR8iWY5fFtAtfPEoacC0OFBc7ZyVWu/fRJqhG KV4XtAOUNX3HC8rKcq4A2bHHYFVhqtLDl5OLzVeqghQaMnADebG6ewoGp2kgiIXkcesZ qrkvd/jTxHklQRtLxg8d8IzmMFH6d3jrlVYyn3g9jWoTPiStXPFrTs93J7TVEK6OD+kQ XnLM0zN+mRjacAEf505F/TYlhFpf7eRSf/2zNQBeQJd7tL+T58H0RXY8nhcF8bsocdFj aVZQ== X-Gm-Message-State: ABy/qLa0mFU5r3i2Jj653mqy8cH8bK6TfvoImEbIGsFmrtPQvF2cNl+k 7OWCufmUdvIOpR5ZeD5QdRan8OzE4tpjLA9XiuU= X-Google-Smtp-Source: APBJJlEkANFoKrrsetuFqtRyRdhksQSYWH3wVBmSijzXuFvpX0EpB/Tkq6DW6033aS9IZ/hRqqWmMDzLqOBfwHi60P0= X-Received: by 2002:a05:6870:934a:b0:1a2:c181:5c85 with SMTP id j10-20020a056870934a00b001a2c1815c85mr1397139oak.9.1689235965780; Thu, 13 Jul 2023 01:12:45 -0700 (PDT) In-Reply-To: <83edlc5p7n.fsf@gnu.org> 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:265006 Archived-At: --000000000000aea60b060059e5d4 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Jul 13, 2023, 06:56 Eli Zaretskii wrote: > > From: sbaugh@catern.com > > Date: Fri, 07 Jul 2023 12:12:32 +0000 (UTC) > > Cc: Eli Zaretskii , Spencer Baugh = , > > 64428@debbugs.gnu.org > > > > Jo=C3=A3o T=C3=A1vora 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=C3=A3o > > > > Fixed. > > > > I have tested in both graphical and tty Emacs. > > Thanks. Jo=C3=A3o, 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? > If you can give a reasonable example of sonething the general public would want to do with them, ok. Until then, I think public interfaces should be kept small. Yes, it's good for pushing. Jo=C3=A3o > --000000000000aea60b060059e5d4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Thu, Jul 13, 2023, 06:56 Eli Zaretskii <eliz@gnu.org> wrote:
> From: sbaugh@catern.com
> Date: Fri, 07 Jul 2023 12:12:32 +0000 (UTC)
> Cc: Eli Zaretskii <eliz@gnu.org>, Spencer Baugh <sbaugh@jane= street.com>,
>=C2=A0 =C2=A0 =C2=A0 =C2=A064428@debbugs.gnu.org
>
> Jo=C3=A3o T=C3=A1vora <joaotavora@gmail.com> writes:
>
> > On second thought, here are some comments that I think should be<= br> > > improved in Spencer's patch:
> >
> >> @@ -1479,21 +1505,8 @@ flymake--mode-line-counter
> >>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0((eq type :warning) "= warnings")
> >>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0((eq type :note) "not= es")
> >>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(t (format "%s diagno= stics" type))))
> >> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0keymap
> >> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0,(let ((map (make-sparse-k= eymap)))
> >> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (define-key map (v= ector 'mode-line
> >> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 mouse-wh= eel-down-event)
> >> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (lambda (ev= ent)
> >> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (int= eractive "e")
> >> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (wit= h-selected-window (posn-window (event-start event))
> >> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 (flymake-goto-prev-error 1 (list type) t))))
> >> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (define-key map (v= ector 'mode-line
> >> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 mouse-wh= eel-up-event)
> >> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (lambda (ev= ent)
> >> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (int= eractive "e")
> >> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (wit= h-selected-window (posn-window (event-start event))
> >> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 (flymake-goto-next-error 1 (list type) t))))
> >> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 map))))))
> >> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0type ,type
> >
> > Spencer, here you are recording the value of the `type` in a `typ= e`
> > text-property of the affected text.=C2=A0 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`.=C2=A0 This= will
> > prevent any clashes if the less-qualified `type` is ever defined<= br> > > to mean something else as a text-property.
> >
> >> +=C2=A0 (interactive "e")
> >> +=C2=A0 (let* ((posn-string (posn-string (event-start event))= )
> >> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(type (get-text-property (= cdr posn-string) 'type (car posn-string))))
> >> +=C2=A0 =C2=A0 (with-selected-window (posn-window (event-star= t event))
> >> +=C2=A0 =C2=A0 =C2=A0 (flymake-goto-prev-error 1 (list type) = t))))
> >
> > And here, you could consider saving the value of (event-start eve= nt)
> > by adding another early binding to that `let*`, maybe call it `es= tart`.
> > This is much less important than the first comment though.
> >
> > Jo=C3=A3o
>
> Fixed.
>
> I have tested in both graphical and tty Emacs.

Thanks.=C2=A0 Jo=C3=A3o, 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)
> +=C2=A0 (interactive "e")
> +=C2=A0 (let* ((event-start (event-start event))
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(posn-string (posn-string event-sta= rt))
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(type (get-text-property
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (cdr posn-str= ing) 'flymake--diagnostic-type (car posn-string))))
> +=C2=A0 =C2=A0 (with-selected-window (posn-window event-start)
> +=C2=A0 =C2=A0 =C2=A0 (flymake-goto-prev-error 1 (list type) t))))
> +
> +(defun flymake--mode-line-counter-scroll-next (event)
> +=C2=A0 (interactive "e")
> +=C2=A0 (let* ((event-start (event-start event))
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(posn-string (posn-string event-sta= rt))
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(type (get-text-property
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (cdr posn-str= ing) 'flymake--diagnostic-type (car posn-string))))
> +=C2=A0 =C2=A0 (with-selected-window (posn-window event-start)
> +=C2=A0 =C2=A0 =C2=A0 (flymake-goto-next-error 1 (list type) t))))

Any reasons not to make them public and add doc strings?

If you can give a r= easonable example of sonething the general public would want to do with the= m, ok.=C2=A0 Until then, I think public interfaces should be kept small.

Yes, it's good for pus= hing.

Jo=C3=A3o
--000000000000aea60b060059e5d4--