unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Jean Louis <bugs@gnu.support>
To: wael-zwaiter@gmx.com
Cc: Help Gnu Emacs <help-gnu-emacs@gnu.org>
Subject: Re: Setting variables, argumunts in defun
Date: Sat, 13 Feb 2021 22:15:33 +0300	[thread overview]
Message-ID: <YCglVUKcluqGOGAZ@protected.rcdrun.com> (raw)
In-Reply-To: <trinity-4ac6aa69-d183-4f25-a6a0-8fb797e3e805-1613232897283@3c-app-mailcom-bs12>

* wael-zwaiter@gmx.com <wael-zwaiter@gmx.com> [2021-02-13 19:19]:
> I would like to set up devi and scal by selecting either one or
> the other.  Wow can I do this in elisp.  Should I pass parameters
> to the function.  Can one pass a string, then check its contents?
> 
> (defun deviscal ()
> 
>   (setq devi 0.18)
>   (setq scal 0.2)
> 
>   (setq devi 0.0)
>   (setq scal 1.0) )

I am trying to understand. How are you selecting either one or the
other?

What is devi? What is scal? Is that meaning something special?

If you mean to make a function to set variable devi or scal, you could
do maybe function like this:

(defun devi-scal (&optional devi-value scal-vale)
  (when devi
    (setq devi devi))
  (when scal
    (setq scal scal)))

But that implies that variables `devi' and `scal' are global and
you wish to set global variable.

Then you could use (devi-scal 0.18 nil) to set only variable
`devi' or (devi-cale nil 0.18) to set only variable `scal'
or (devi-scal 0.18 1.0) to set both of them.

Is that what you mean?

Jean



      parent reply	other threads:[~2021-02-13 19:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-13 16:14 Setting variables, argumunts in defun wael-zwaiter
2021-02-13 16:33 ` Christopher Dimech
2021-02-13 16:36   ` wael-zwaiter
2021-02-13 16:42   ` Philip Kaludercic
2021-02-13 16:52     ` wael-zwaiter
2021-02-13 16:57       ` tomas
2021-02-13 17:23         ` wael-zwaiter
2021-02-13 22:59           ` Michael Heerdegen
2021-02-13 17:08       ` Philip Kaludercic
2021-02-13 17:09         ` Philip Kaludercic
2021-02-13 19:15 ` Jean Louis [this message]

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=YCglVUKcluqGOGAZ@protected.rcdrun.com \
    --to=bugs@gnu.support \
    --cc=help-gnu-emacs@gnu.org \
    --cc=wael-zwaiter@gmx.com \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).