[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Easy to add with push but not to the end of a list
From: |
Michael Heerdegen |
Subject: |
Re: Easy to add with push but not to the end of a list |
Date: |
Tue, 06 Dec 2022 18:22:25 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Emanuel Berg <incal@dataswamp.org> writes:
> Are the macros here correct then?
Depends on what you want.
> (defmacro file-to-variable (file var)
> `(setq ,var ,(file-to-string file)) )
>
> (defmacro file-to-variable-integer (file var)
> `(setq ,var ,(string-to-number (file-to-string file))) )
Calls of these macros will cause those FILEs to be looked up at macro
expansion/ compile time, and the file contents will be become a part of
the .elc. I guess this is not what you want.
A second (related) problem is that FILE must be a string - a function
call like (expand-file-name "my-file" "/some/path") will not behave as
expected, because your helper functions don't expect an expression.
But `macroexpand' will tell you all of that. I suggest to take the time
to think thoroughly about it. Don't try to solve this by guessing or
trial and error.
Michael.
- Re: Easy to add with push but not to the end of a list, Emanuel Berg, 2022/12/01
- Re: Easy to add with push but not to the end of a list, Emanuel Berg, 2022/12/01
- Re: Easy to add with push but not to the end of a list, Michael Heerdegen, 2022/12/01
- Re: Easy to add with push but not to the end of a list, Emanuel Berg, 2022/12/03
- Re: Easy to add with push but not to the end of a list, Michael Heerdegen, 2022/12/03
- Re: Easy to add with push but not to the end of a list, Emanuel Berg, 2022/12/05
- Re: Easy to add with push but not to the end of a list, Michael Heerdegen, 2022/12/05
- Re: Easy to add with push but not to the end of a list, Emanuel Berg, 2022/12/05
- Re: Easy to add with push but not to the end of a list, Michael Heerdegen, 2022/12/05
- Re: Easy to add with push but not to the end of a list, Emanuel Berg, 2022/12/06
- Re: Easy to add with push but not to the end of a list,
Michael Heerdegen <=
- Re: Easy to add with push but not to the end of a list, Emanuel Berg, 2022/12/06
- Re: Easy to add with push but not to the end of a list, Michael Heerdegen, 2022/12/08
- Re: Easy to add with push but not to the end of a list, Emanuel Berg, 2022/12/29
- Re: Easy to add with push but not to the end of a list, Michael Heerdegen, 2022/12/31
- Re: Easy to add with push but not to the end of a list, Emanuel Berg, 2022/12/31
- Re: Easy to add with push but not to the end of a list, Emanuel Berg, 2022/12/06
- Re: Easy to add with push but not to the end of a list, Stefan Monnier, 2022/12/06
- Re: Easy to add with push but not to the end of a list, Michael Heerdegen, 2022/12/06