[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: same data appears twice, interactive then function body
From: |
Stefan Monnier |
Subject: |
Re: same data appears twice, interactive then function body |
Date: |
Tue, 15 Dec 2020 21:44:34 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
> Check out this code, how do you avoid having 80 appear twice?
> (defun insert-string-centered (string &optional width)
> (interactive
> (list (read-from-minibuffer "string: ")
> (string-to-number (read-from-minibuffer "width [80]: "))) )
> (let*((max (if (< 0 width) width 80))
> [...]
Here's my take on it:
(defun insert-string-centered (string &optional width)
(interactive
(list (read-from-minibuffer "string: ")
(string-to-number (read-from-minibuffer "width [80]: "))) )
(let*((max (if (< 0 width) width (+ 42 42 -4)))
[...]
Now the question is how to avoid having 42 appear twice, I guess,
Stefan
- same data appears twice, interactive then function body, Emanuel Berg, 2020/12/15
- Re: same data appears twice, interactive then function body,
Stefan Monnier <=
- Re: same data appears twice, interactive then function body, Jean Louis, 2020/12/15
- Re: same data appears twice, interactive then function body, Emanuel Berg, 2020/12/15
- Re: same data appears twice, interactive then function body, Yuri Khan, 2020/12/15
- Re: same data appears twice, interactive then function body, Emanuel Berg, 2020/12/16
- Re: same data appears twice, interactive then function body, Emanuel Berg, 2020/12/18
- RE: same data appears twice, interactive then function body, Drew Adams, 2020/12/18