alphapapa / ement.el

A Matrix client for GNU Emacs
GNU General Public License v3.0
476 stars 44 forks source link

Support `pixel-scroll-precision` #156

Open Stebalien opened 1 year ago

Stebalien commented 1 year ago

Emacs 29 has pixel-precision-scroll-mode for smooth scrolling. Adding support for this is pretty easy, but I'm not sure how you want to handle backwards compatibility.

This "works":

(with-eval-after-load 'pixel-scroll
  (declare-function pixel-precision-scroll "pixel-scroll" (event))
  (defun ement-room-pixel-scroll-precision (event)
    "Scroll by pixels according to EVENT, loading earlier messages when at top.
Requires `pixel-precision-scroll-mode' to be enabled."
    (interactive "e")
    (with-selected-window (posn-window (event-start event))
      (pixel-scroll-precision event)
      (when (= (point-min) (window-start))
        (call-interactively #'ement-room-retro))))

  (define-key ement-room-mode-map
    [remap pixel-scroll-precision] #'ement-room-pixel-scroll-precision))

But native comp complains:

ement-room.el:1418:38: Warning: the function ‘ement-room-pixel-scroll-precision’ is not known to be defined.
ement-room.el:1413:8: Warning: the function ‘pixel-scroll-precision’ is not known to be defined.

(I'm not sure how this is usually done).

alphapapa commented 1 year ago

Thanks. I think I would prefer to hold off on merging this until Emacs 29 is officially released. But I'll be glad to have it maintained in a branch until then.

By the way, so far your contributions have only been a few lines, but since this package is on GNU ELPA and is considered "part of GNU Emacs," contributions from those who haven't signed the FSF copyright assignment are limited to 15 lines. Have you done the FSF CA yet?

Stebalien commented 1 year ago

Thanks. I think I would prefer to hold off on merging this until Emacs 29 is officially released. But I'll be glad to have it maintained in a branch until then.

Sounds good to me.

Have you done the FSF CA yet?

Yep. All signed.

alphapapa commented 1 year ago

Great, thanks.