* avoid global variables by using closures
@ 2021-09-08 20:07 Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-08 20:58 ` Jude DaShiell
0 siblings, 1 reply; 3+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-09-08 20:07 UTC (permalink / raw)
To: help-gnu-emacs
I don't know what I've been smoking, this gave me a warning
from the byte-compiler saying the function wasn't known to be
defined, but now it seems to work all of a sudden?
(require 'cl-lib)
(let ((times 0))
(defun time (&optional reset)
(interactive)
(let ((res (or reset current-prefix-arg)))
(if res
(setq times 0)
(cl-incf times) ))
(if (called-interactively-p 'interactive)
(message "times: %d" times)
times) ))
;; test:
;; (call-interactively 'time)
;; (let ((current-prefix-arg t)) (call-interactively 'time))
;; (time)
;; (time t)
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: avoid global variables by using closures
2021-09-08 20:07 avoid global variables by using closures Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-09-08 20:58 ` Jude DaShiell
2021-09-08 22:05 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 3+ messages in thread
From: Jude DaShiell @ 2021-09-08 20:58 UTC (permalink / raw)
To: Emanuel Berg, help-gnu-emacs
I've had similar errors happen while building dismal no idea why though
since I didn't do source code diving.
On Wed, 8 Sep 2021, Emanuel Berg via Users list for the GNU Emacs text
editor wrote:
> I don't know what I've been smoking, this gave me a warning
> from the byte-compiler saying the function wasn't known to be
> defined, but now it seems to work all of a sudden?
>
> (require 'cl-lib)
>
> (let ((times 0))
> (defun time (&optional reset)
> (interactive)
> (let ((res (or reset current-prefix-arg)))
> (if res
> (setq times 0)
> (cl-incf times) ))
> (if (called-interactively-p 'interactive)
> (message "times: %d" times)
> times) ))
> ;; test:
> ;; (call-interactively 'time)
> ;; (let ((current-prefix-arg t)) (call-interactively 'time))
> ;; (time)
> ;; (time t)
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: avoid global variables by using closures
2021-09-08 20:58 ` Jude DaShiell
@ 2021-09-08 22:05 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 0 replies; 3+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-09-08 22:05 UTC (permalink / raw)
To: help-gnu-emacs
Jude DaShiell wrote:
> I've had similar errors happen while building dismal no idea
> why though since I didn't do source code diving.
... what's that?
Is that what I do or what do you mean?
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-09-08 22:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-08 20:07 avoid global variables by using closures Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-08 20:58 ` Jude DaShiell
2021-09-08 22:05 ` Emanuel Berg via Users list for the GNU Emacs text editor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).