[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using variables to set defaults to parameters
From: |
goncholden |
Subject: |
Re: Using variables to set defaults to parameters |
Date: |
Thu, 03 Feb 2022 18:43:31 +0000 |
------- Original Message -------
On Thursday, February 3rd, 2022 at 6:20 PM, goncholden
<goncholden@protonmail.com> wrote:
> ------- Original Message -------
>
> On Thursday, February 3rd, 2022 at 4:24 PM, Stefan Monnier via Users list for
> the GNU Emacs text editor help-gnu-emacs@gnu.org wrote:
>
> > I am currently defining a minor-mode with default parameters, but want
> >
> > to pass defaulted variables instead. What is the way to do this,
> >
> > using setq ?
> >
> > (define-minor-mode rich-minor-mode
> >
> > "Brief description" nil "" nil
>
> Don't use this long obsolete form. Use the keyword arguments, instead:
>
> (define-minor-mode rich-minor-mode
>
> "Brief description"
>
> :lighter "")
>
> > then changed to
> >
> > (setq initval nil)
> >
> > (setq mdline-indic "")
> >
> > (setq other nil)
>
> I don't know what you mean with "then changed" nor where the above code
>
> is intended to be placed (inside the `define-minor-mode`? In some
>
> other function?).
>
> Stefan
>
> Have been trying to pass the parameters with names that mean something,
> rather than
>
> using
>
> (define-minor-mode rich-minor-mode "Brief description" nil "" nil
>
> so I would have
> (define-minor-mode rich-minor-mode "Brief description" initval mdline-indic
> other
> Where can I find some information on using the keyword arguments? I only know
> about the
> long obsolete form.
What's the best thing to make code more readable? Keywords as you say? I do
not want modeline
indicator for this. I do not particularly understand initial values, how do
they work?