emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 4b5d04b: Use new macro debounce-reduce to make mouse scaling


From: Stefan Monnier
Subject: Re: master 4b5d04b: Use new macro debounce-reduce to make mouse scaling of images more responsive
Date: Tue, 26 Nov 2019 22:32:01 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

>>>     * lisp/emacs-lisp/timer.el (debounce, debounce-reduce): New macros.
>> Please use proper prefixes for those names.
> Maybe timer-debounce and timer-debounce-reduce.

I guess so, tho now that I looked at it I have other questions/comments:

- I don't see `debounce` used anywhere.  Do we need it?
- Why is `debounce-reduce` a macro rather than a function?
- What is the advantage of wrapping a `debounce-reduce` around
  `image--change-size` instead of doing something like:

    (defun image-decrease-size (&optional n)
      "Decrease the image size by a factor of N.
    If N is 3, then the image size will be decreased by 30%.  The
    default is 20%."
      (interactive "P")
      ;; Wait for a bit of idle-time before actually performing the change,
      ;; so as to batch together sequences of closely consecutive size changes.
      (run-with-idle-timer 0.3 nil
                           #'image--change-size
                           (if n
                               (- 1 (/ (prefix-numeric-value n) 10.0))
                             0.8)))

-- Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]