* lexical/static let-closure now reachable from interactive spec!
@ 2022-09-27 21:06 Emanuel Berg
2022-09-27 21:38 ` `declare-function' not needed anymore? (was: Re: lexical/static let-closure now reachable from interactive spec!) Emanuel Berg
0 siblings, 1 reply; 3+ messages in thread
From: Emanuel Berg @ 2022-09-27 21:06 UTC (permalink / raw)
To: emacs-devel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* `declare-function' not needed anymore? (was: Re: lexical/static let-closure now reachable from interactive spec!)
2022-09-27 21:06 lexical/static let-closure now reachable from interactive spec! Emanuel Berg
@ 2022-09-27 21:38 ` Emanuel Berg
2022-09-28 11:23 ` `declare-function' not needed anymore? Stefan Monnier
0 siblings, 1 reply; 3+ messages in thread
From: Emanuel Berg @ 2022-09-27 21:38 UTC (permalink / raw)
To: emacs-devel
> (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) )
I think that `declare-function' is also not needed anymore?
It's there to shut the byte-compiler up that the function
isn't known to be defined, but now it doesn't say that so the
ugly `declare-function' (even more so with the trailing nil)
can be removed ...
Only 33 places to do that for me ...
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-09-28 11:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-27 21:06 lexical/static let-closure now reachable from interactive spec! Emanuel Berg
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
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.