|
From: | jenia.ivlev |
Subject: | Re: writing ledger mode, date picker |
Date: | Sun, 08 Nov 2015 14:37:40 -0500 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Hi Drew. I'm having a much more fundamental problem. I can't execute stuff after an event has happened. I wrote a function using the `(when (calendar-cursor-to-date) ...)` function that at first I sincerely hoped will execute the `...` part when `(calendar-cussor-to-date)` was finished executing but I wasn't so lucky. Here is my 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) How do I execute this part AFTER the user has pressed "RET": (let ((x (calendar-cursor-to-date))) <------ execute after "RET" (select-window (get-buffer-window "asti" t)) (insert format-time-string "%Y-%m-%d" x))))) This is just such a totally basic thing to want to do that I'm in despair for not being able to do it very simply. Can you please help me in achieving this? Setting `x` to be `(calendar-cursor-to-date)` when "RET" has been pressed? Thanks P.S. If you decide to test the prog out, please create the buffer "asti" first by pressing "C-x 4 b asti"
[Prev in Thread] | Current Thread | [Next in Thread] |