lem-project / lem

Common Lisp editor/IDE with high expansibility
http://lem-project.github.io/
MIT License
2.42k stars 183 forks source link

`define-motion` commands seem to always get 1 as default `n` #1556

Closed naryl closed 2 months ago

naryl commented 2 months ago

Trying to implement proper vi-like C-u/C-d scrolling, I'm getting this bug with the following code:

(define-motion vi-scroll-up (&optional (n nil)) (:universal)
    (:default-n-arg nil)
  ;; Somehow n is still 1 by default...
  (when (eql n 1)
    (setf n (floor (/ (window-height (current-window)) 2))))
  (previous-line n)
  (scroll-up n))
naryl commented 2 months ago

Tried setting both &optional and :default-n-arg to 0 or 2. n is still 1 when called without the argument.

naryl commented 2 months ago

arg-descriptor should be :universal-nil instead of :universal.