[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: writing ledger mode, date picker
From: |
jenia.ivlev |
Subject: |
Re: writing ledger mode, date picker |
Date: |
Sun, 08 Nov 2015 14:25:43 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Hello Emanuel.
I'm trying to write a program that will prompt the user for a
date and insert it into a buffer called "asti" ;)
I'm having some success but also some problems. My problem, I think, is
that I'm using the `(when...)` function wrong.
Here is the newest iteration of the program:
(defun insert-new-entry ()
(interactive)
(save-excursion
(goto-char (point-max))
(print "Asti")
(define-key calendar-mode-map (kbd "RET") 'get-date)
(calendar)
(when (calendar-cursor-to-date)
(let ((x (calendar-cursor-to-date)))
(select-window (get-buffer-window "asti" t))
(insert format-time-string "%Y-%m-%d" x)))))
(defun get-date ()
(interactive)
calendar-cursor-to-date)
The interpreter tells me, though, that `x` is nil basically: "Symbol's
value as a variable is void: format-time-string"
How do I execute this part AFTER the user has pressed "RET".
(let ((x (calendar-cursor-to-date))) <---- execute after "RET" pressed
(select-window (get-buffer-window "asti" t))
(insert format-time-string "%Y-%m-%d" x)))))
Thanks
P.S. To try my prog out, you need to open a buffer called asti by
doing `C-b 4 asti`.
- writing ledger mode, date picker, jenia.ivlev, 2015/11/07
- Re: writing ledger mode, date picker, jenia.ivlev, 2015/11/07
- Re: writing ledger mode, date picker, Emanuel Berg, 2015/11/07
- Re: writing ledger mode, date picker,
jenia.ivlev <=
- Re: writing ledger mode, date picker, Emanuel Berg, 2015/11/08
- Re: writing ledger mode, date picker, Yuri Khan, 2015/11/08
- Re: writing ledger mode, date picker, Emanuel Berg, 2015/11/08
- Re: writing ledger mode, date picker, jenia.ivlev, 2015/11/08
RE: writing ledger mode, date picker, Drew Adams, 2015/11/07
Re: writing ledger mode, date picker, jenia.ivlev, 2015/11/09