From: steve-humphreys@gmx.com
To: steve-humphreys@gmx.com
Cc: Help Gnu Emacs <help-gnu-emacs@gnu.org>
Subject: Re: ELisp - Making a list from a function returning a number
Date: Fri, 18 Dec 2020 04:01:26 +0100 [thread overview]
Message-ID: <trinity-3da3917f-fb5f-4faa-89ed-d44e6c7fa724-1608260486029@3c-app-mailcom-bs11> (raw)
In-Reply-To: <trinity-4a6900d7-a558-4250-8ec5-6e414c8ab9ea-1608258378881@3c-app-mailcom-bs11>
This is my new function
(defun timgrid ()
(let* ( (tstr 800)
(tend 1300)
(tpd 34)
(i 0)
(tim tstr)
tim tfr )
;; ----- body of let -----
(dotimes (i 4)
(message "tim tpd: %d %d" tim tpd)
(setq tfr (timfutur tim tpd))
(message "tim: %d" tim)
;;(setq tlist (append 'tlist (list tim)))
(setq tim tfr)) ))
> Sent: Friday, December 18, 2020 at 3:26 AM
> From: steve-humphreys@gmx.com
> To: steve-humphreys@gmx.com
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: ELisp - Making a list from a function returning a number
>
> I have now started constructing my function but get many problems.
>
> (defun timgrid ()
>
> (setq tstr 800)
> (setq tend 1300)
> (setq tpd 34)
>
> (setq i 0)
> (setq tim tstr)
> (setq tlist '(tim))
> (dotimes (i 4)
> (setq tfr (timfutur (tim tpd)))
> (setq tim tfr)
> (setq tlist (append (tlist) (tim))) ))
>
>
> > Sent: Thursday, December 17, 2020 at 12:42 PM
> > From: steve-humphreys@gmx.com
> > To: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> > Subject: ELisp - Making a list from a function returning a number
> >
> >
> > I have written a function to return time as a number so I can set the temporal grid
> > in org-agenda.
> >
> > I was previously using number-sequence until someone fount a problem. Now I have timfutur to
> > give me the next time (time interval "tsk" after time "tim")
> >
> > (tim (number-sequence tstr tend tskp))
> >
> > So what I have remaining to do is to make a list of numbers representing the times when the
> > agenda grids are displayed.
> >
> >
> > (defun timfutur (tim tsk)
> >
> > (let* ( (thr (/ tim 100))
> > (tmn (- tim (* thr 100)))
> >
> > (tinc_mn (+ tmn tsk))
> > (tinc_hr (/ (+ tmn tsk) 60))
> > (tinc_mn (- tinc_mn (* tinc_hr 60)))
> >
> > (thr_futur (* (+ thr tinc_hr) 100))
> > (tmn_futur tinc_mn)
> > (tim_out (+ thr_futur tmn_futur)) )
> > ;; --- body of let ----
> > tim_out )) ; function returns last form
> >
> >
>
next prev parent reply other threads:[~2020-12-18 3:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-17 11:42 ELisp - Making a list from a function returning a number steve-humphreys
2020-12-18 2:26 ` steve-humphreys
2020-12-18 3:01 ` steve-humphreys [this message]
2020-12-18 14:43 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-18 17:53 ` Jean Louis
2020-12-20 5:03 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-20 6:23 ` Jean Louis
2020-12-20 6:30 ` Christopher Dimech
2020-12-20 7:01 ` Emanuel Berg via Users list for the GNU Emacs text editor
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=trinity-3da3917f-fb5f-4faa-89ed-d44e6c7fa724-1608260486029@3c-app-mailcom-bs11 \
--to=steve-humphreys@gmx.com \
--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.
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).