all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: pietru@caramail.com
To: Jean Louis <bugs@gnu.support>
Cc: Help Gnu Emacs <help-gnu-emacs@gnu.org>
Subject: Re: Passing a list to an interactive function
Date: Sat, 19 Dec 2020 12:03:58 +0100	[thread overview]
Message-ID: <trinity-7ea6e895-3cb5-46b1-99cc-b777ae4c1c42-1608375838645@3c-app-mailcom-bs06> (raw)
In-Reply-To: <X92Viw0OS7dNbj4S@protected.rcdrun.com>

Yes, that was the problem, the counting from 1.

> Sent: Saturday, December 19, 2020 at 11:24 AM
> From: "Jean Louis" <bugs@gnu.support>
> To: pietru@caramail.com
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: Passing a list to an interactive function
>
> * pietru@caramail.com <pietru@caramail.com> [2020-12-19 07:30]:
> > Am trying to fill variables "ta tb tc" with the numbers from "tlist"
> >
> (defun thermoluminesce (tseq)
>   "Sets thermoluminesce."
>   (interactive "stseq: ")
>   (message "stseq: %s " tseq)
>   (let  ((slist (split-string tseq))
>          tlist ta tb tpab)
>     (message "slist: %s" slist)
>     (message "tlist: %s" tlist)
>     (message "tlen: %d" (length tlist))
>     (setq tlist (mapcar #'string-to-number slist))
>     ;;(setq ta (nth 1 tlist))
>     ;;(setq tb (nth 2 tlist))
>     (setq tc (nth 3 tlist))
>     (message "ta tb tc: %d %d %d" ta tb tc) ))
>
> You could as well teach us here what those variables mean by giving
> them better descriptive names.
>
> (nth 2 '(1 2 3)) => 3
>
> Is maybe that the problem? That nth is counting starting from 0, not from 1.
>
>
>



  reply	other threads:[~2020-12-19 11:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-18 11:05 Passing a list to an interactive function pietru
2020-12-18 11:30 ` Jean Louis
2020-12-18 11:38   ` pietru
2020-12-18 11:49     ` Joost Kremers
2020-12-18 11:50     ` tomas
2020-12-18 11:56     ` Jean Louis
2020-12-19  2:05     ` pietru
2020-12-19  3:25       ` Jean Louis
2020-12-19  3:34         ` pietru
2020-12-19  3:49           ` Jean Louis
2020-12-19  4:29             ` pietru
2020-12-19  5:54               ` Jean Louis
2020-12-19 11:03                 ` pietru [this message]
2020-12-19  6:23               ` Michael Heerdegen
2020-12-19  6:26                 ` pietru

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=trinity-7ea6e895-3cb5-46b1-99cc-b777ae4c1c42-1608375838645@3c-app-mailcom-bs06 \
    --to=pietru@caramail.com \
    --cc=bugs@gnu.support \
    --cc=help-gnu-emacs@gnu.org \
    /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.