unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: sbaugh@catern.com, 64428@debbugs.gnu.org,
	Spencer Baugh <sbaugh@janestreet.com>
Subject: bug#64428: [PATCH] Fix flymake mode line scrolling with pixel-scroll-precision-mode
Date: Thu, 13 Jul 2023 09:12:33 +0100	[thread overview]
Message-ID: <CALDnm508Loe+sCX8965fSBWF_he6fjn7wq4NdTQF22ShD4Xm1w@mail.gmail.com> (raw)
In-Reply-To: <83edlc5p7n.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 4011 bytes --]

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@janestreet.com>,
> >       64428@debbugs.gnu.org
> >
> > João Távora <joaotavora@gmail.com> 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?
>

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ão

>

[-- Attachment #2: Type: text/html, Size: 5903 bytes --]

  reply	other threads:[~2023-07-13  8:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-02 21:51 bug#64428: [PATCH] Fix flymake mode line scrolling with pixel-scroll-precision-mode sbaugh
2023-07-06  7:37 ` Eli Zaretskii
2023-07-06 13:16   ` Spencer Baugh
2023-07-06 14:04     ` Eli Zaretskii
2023-07-07 11:37       ` João Távora
2023-07-07 11:47         ` João Távora
2023-07-07 12:12           ` sbaugh
2023-07-13  5:56             ` Eli Zaretskii
2023-07-13  8:12               ` João Távora [this message]
2023-07-13 14:00                 ` Eli Zaretskii
2023-07-07 12:52         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALDnm508Loe+sCX8965fSBWF_he6fjn7wq4NdTQF22ShD4Xm1w@mail.gmail.com \
    --to=joaotavora@gmail.com \
    --cc=64428@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=sbaugh@catern.com \
    --cc=sbaugh@janestreet.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).