From: Emanuel Berg <incal@dataswamp.org>
To: emacs-devel@gnu.org
Subject: lexical/static let-closure now reachable from interactive spec!
Date: Tue, 27 Sep 2022 23:06:10 +0200 [thread overview]
Message-ID: <87wn9ojznh.fsf@dataswamp.org> (raw)
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
next reply other threads:[~2022-09-27 21:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-27 21:06 Emanuel Berg [this message]
2022-09-27 21:38 ` `declare-function' not needed anymore? (was: Re: lexical/static let-closure now reachable from interactive spec!) Emanuel Berg
2022-09-28 11:23 ` `declare-function' not needed anymore? Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wn9ojznh.fsf@dataswamp.org \
--to=incal@dataswamp.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.