all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: goncholden <goncholden@protonmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: help-gnu-emacs@gnu.org
Subject: Using variables to set defaults to parameters
Date: Thu, 03 Feb 2022 18:20:44 +0000	[thread overview]
Message-ID: <Lcbi0yF-UoDhX1UKv6n0h8y73BQNzJ-vqmzkKrohMwrs82N0b-9yum3B6KprU93goBx-wCrabPR5dLoojB8aaaZ0XgP0MaEli-DxAHGVQVg=@protonmail.com> (raw)
In-Reply-To: <jwviltvex94.fsf-monnier+emacs@gnu.org>


------- 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.






  reply	other threads:[~2022-02-03 18:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-03 14:55 Using variables to set defaults to parameters goncholden via Users list for the GNU Emacs text editor
2022-02-03 16:24 ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-02-03 18:20   ` goncholden [this message]
2022-02-03 18:43     ` goncholden

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='Lcbi0yF-UoDhX1UKv6n0h8y73BQNzJ-vqmzkKrohMwrs82N0b-9yum3B6KprU93goBx-wCrabPR5dLoojB8aaaZ0XgP0MaEli-DxAHGVQVg=@protonmail.com' \
    --to=goncholden@protonmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.