emacs-devel
[Top][All Lists]
Advanced

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

Re: Smoother macOS touchpad scrolling


From: Charles A. Roelli
Subject: Re: Smoother macOS touchpad scrolling
Date: Mon, 18 Sep 2017 22:19:30 +0200

> Authentication-Results: sinyavsky.aurox.ch (amavisd-new);     dkim=pass 
> (2048-bit key) header.d=googlemail.com
> Date: Mon, 18 Sep 2017 20:03:37 +0100
> From: Alan Third <address@hidden>
> Cc: address@hidden, address@hidden
> Content-Type: text/plain; charset=utf-8
> Content-Disposition: inline
> 
> On Mon, Sep 18, 2017 at 08:10:59PM +0200, Charles A. Roelli wrote:
> > With macOS 10.6, I haven't found Emacs scrolling with the touchpad to
> > be too unusual, maybe just a bit clunky.  Wouldn't the following code
> > also affect 10.6?
> 
> You’re right.
> 
> Can you confirm that this doesn’t return true on 10.6?
> 
> (let ((appkit-version (progn (string-match "^appkit-\\([^\s-]*\\)"
>                               ns-version-string)
>                              (match-string 1 ns-version-string))))
>   (>= (string-to-number appkit-version) 1138))

Yes, it returns nil.  I think this check (or maybe a function that
returns the appkit version as an integer) could be added to ns-win.el.
 
> > > +(when (featurep 'cocoa)
> > > +  (setq mouse-wheel-scroll-amount '(1 ((shift) . 5) ((control))))
> > > +  (setq mouse-wheel-progressive-speed nil))
> > 
> > Also, won't these variable changes make Customize report that their
> > values were "changed outside Customize"?
> 
> I have absolutely no idea...
> 
> Customize is something I’ve largely done my best to avoid, so I don’t
> know how I should go about setting them in a way that’s friendly to
> it.
> 
> Something like this?
> 
> (let ((appkit-version (progn
>                         (string-match "^appkit-\\([^\s-]*\\)" 
> ns-version-string)
>                         (match-string 1 ns-version-string))))
>   (when (and (featurep 'cocoa) (>= (string-to-number appkit-version) 1138))
>     (setq mouse-wheel-scroll-amount '(1 ((shift) . 5) ((control))))
>     (put 'mouse-wheel-scroll-amount 'customized-value
>          (list (custom-quote (symbol-value 'mouse-wheel-scroll-amount))))
>     
>     (setq mouse-wheel-progressive-speed nil)
>     (put 'mouse-wheel-progressive-speed 'customized-value
>          (list (custom-quote (symbol-value 
> 'mouse-wheel-progressive-speed))))))
> 
> It looks pretty messy.

We could also make the defcustoms in mwheel.el look something like
this:

(defcustom mouse-wheel-scroll-amount
  (cond
   ((and (featurep 'cocoa) (>= (ns-appkit-version) 1138))
     '(1 ((shift) . 5) ((control) . nil)))
   (t '(5 ((shift) . 1) ((control) . nil)))) ...

instead of:

(defcustom mouse-wheel-scroll-amount '(5 ((shift) . 1) ((control) . nil)) ...

Then in ns-win.el we could do:

(custom-reevaluate-setting 'mouse-wheel-scroll-amount)

See also, Info node "(elisp) Variable Definitions":

 -- Function: custom-reevaluate-setting symbol
     This function re-evaluates the standard value of SYMBOL, which
     should be a user option declared via ‘defcustom’.  If the variable
     was customized, this function re-evaluates the saved value instead.
     Then it sets the user option to that value (using the option’s
     ‘:set’ property if that is defined).

     This is useful for customizable options that are defined before
     their value could be computed correctly.  For example, during
     startup Emacs calls this function for some user options that were
     defined in pre-loaded Emacs Lisp files, but whose initial values
     depend on information available only at run-time.

I /think/ this is the right thing to do, but if any Customize experts
can weigh in, that would be great.



reply via email to

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