emacs-devel
[Top][All Lists]
Advanced

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

lexical/static let-closure now reachable from interactive spec!


From: Emanuel Berg
Subject: lexical/static let-closure now reachable from interactive spec!
Date: Tue, 27 Sep 2022 23:06:10 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

They say this should now be possible! With no complains from
the byte-compiler ...

That means one can have the same defaults for the interactive
spec but also "from Lisp" without having that hard-coded.

Ain't it cool stuff!

(require 'cl-lib)

(let ((min-def 0)
      (max-def 9)
      (inc-def 1) )
  (defun interval (&optional min max inc)
    (interactive (list (read-number "min: " min-def)
                       (read-number "max: " max-def)
                       (read-number "inc: " inc-def)) )
    (or min (setq min min-def))
    (or max (setq max max-def))
    (or inc (setq inc inc-def))
    (unless (<= min max)
      (error "Bogus interval") )
    (unless (> inc 0)
      (error "Bogus increment") )
    (cl-loop for i from min to max by inc collect i) )
  (declare-function interval nil) )

;; (interval 10 5)        ; Bogus interval
;; (interval 1 3 -1)      ; Bogus increment
;; (interval 5 10)        ; (5 6 7 8 9 10)
;; (interval 1.8 2.0 0.1) ; (1.8 1.9000000000000001 2.0)
;; (interval)             ; (0 1 2 3 4 5 6 7 8 9)
;; (interval 19 99)       ; (19 20 21 22 23 24 25 26 27 28 29 30 ...)

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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