~pkal/public-inbox

2 2

Use setopt in :option on Emacs 29.1+

Details
Message ID
<87sf2tst1f.fsf@breatheoutbreathe.in>
DKIM signature
pass
Download raw message
Hi Philip!

Does this make sense?

Thanks!

Joseph
Details
Message ID
<87y1cltk6g.fsf@posteo.net>
In-Reply-To
<87sf2tst1f.fsf@breatheoutbreathe.in> (view parent)
DKIM signature
pass
Download raw message
Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Hi Philip!

Hi,

> Does this make sense?

I would say no, because there would be no point to using :option?  I
consider the macro a mistake anyway, since it has no
context-sensitivity.  The only reason I can think of would be if you are
expecting to use the configuration on different systems with different
version...

> Thanks!
>
> Joseph
>
>>From b8e09d868a29af0fcd981ffc227b051d82c59461 Mon Sep 17 00:00:00 2001
> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Date: Thu, 18 Jan 2024 23:03:01 -0800
> Subject: [PATCH] Use setopt in :option on Emacs 29.1+
>
> ---
>  setup.el | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/setup.el b/setup.el
> index 89f9732..803655b 100644
> --- a/setup.el
> +++ b/setup.el
> @@ -634,10 +634,12 @@ (setup-define :option
>                     #'symbol-value)
>                 ',name))
>     (lambda (name val)
> -     `(progn
> -        (custom-load-symbol ',name)
> -        (funcall (or (get ',name 'custom-set) #'set-default)
> -                 ',name ,val))))
> +     (if (version<= "29.1" emacs-version)

I think the general recommendation is just to check if the macro is
fboundp, instead of doing do indirectly via the version.

> +         `(setopt ,name ,val)
> +       `(progn
> +          (custom-load-symbol ',name)
> +          (funcall (or (get ',name 'custom-set) #'set-default)
> +                   ',name ,val)))))
>  
>    :documentation "Set the option NAME to VAL.
>  NAME may be a symbol, or a cons-cell.  If NAME is a cons-cell, it
Details
Message ID
<c0a07243ffb54a0cef7f25e7eccf73d5c8c21bf7@breatheoutbreathe.in>
In-Reply-To
<87y1cltk6g.fsf@posteo.net> (view parent)
DKIM signature
pass
Download raw message
January 19, 2024 at 7:30 AM, "Philip Kaludercic" <philipk@posteo.net> wrote:



> 
> Joseph Turner <joseph@breatheoutbreathe.in> writes:
> 
> > 
> > Hi Philip!
> > 
> 
> Hi,
> 
> > 
> > Does this make sense?
> > 
> 
> I would say no, because there would be no point to using :option? I
> 
> consider the macro a mistake anyway, since it has no
> 
> context-sensitivity. The only reason I can think of would be if you are
> 
> expecting to use the configuration on different systems with different
> 
> version...

Thanks for explaining!  That makes sense.

> > 
> > Thanks!
> > 
> >  Joseph
> > 
> > > 
> > > From b8e09d868a29af0fcd981ffc227b051d82c59461 Mon Sep 17 00:00:00 2001
> > > 
> > 
> >  From: Joseph Turner <joseph@breatheoutbreathe.in>
> > 
> >  Date: Thu, 18 Jan 2024 23:03:01 -0800
> > 
> >  Subject: [PATCH] Use setopt in :option on Emacs 29.1+
> > 
> >  ---
> > 
> >  setup.el | 10 ++++++----
> > 
> >  1 file changed, 6 insertions(+), 4 deletions(-)
> > 
> >  diff --git a/setup.el b/setup.el
> > 
> >  index 89f9732..803655b 100644
> > 
> >  --- a/setup.el
> > 
> >  +++ b/setup.el
> > 
> >  @@ -634,10 +634,12 @@ (setup-define :option
> > 
> >  #'symbol-value)
> > 
> >  ',name))
> > 
> >  (lambda (name val)
> > 
> >  - `(progn
> > 
> >  - (custom-load-symbol ',name)
> > 
> >  - (funcall (or (get ',name 'custom-set) #'set-default)
> > 
> >  - ',name ,val))))
> > 
> >  + (if (version<= "29.1" emacs-version)
> > 
> 
> I think the general recommendation is just to check if the macro is
> 
> fboundp, instead of doing do indirectly via the version.

Yes, you're right.

> > 
> > + `(setopt ,name ,val)
> > 
> >  + `(progn
> > 
> >  + (custom-load-symbol ',name)
> > 
> >  + (funcall (or (get ',name 'custom-set) #'set-default)
> > 
> >  + ',name ,val)))))
> > 
> >  
> > 
> >  :documentation "Set the option NAME to VAL.
> > 
> >  NAME may be a symbol, or a cons-cell. If NAME is a cons-cell, it
> >
>
Reply to thread Export thread (mbox)