I want to insert a date in the current buffer.
I know the function calendar-cursor-to-date
that when invoked gives back the date at which the cursor is.
But how do I get that info back into my program?
Here is what I've got so far:
(defun insert-new-entry ()
(interactive)
(save-excursion
(goto-char (point-max))
;;next comes mostly pseudocode except *calendar-cursor-to-date*
(calendar)
(let ((x (bind-key (kdb "enter) 'calendar-mode calendar-cursor-to-date)))
(insert x))))
So in english it's:
- go to the last location in the buffer
- open calendar
- store in x whatever is returned where enter is pressed
- insert it into buffer.
The problem is step 3. How do I store into x whatever is returned from calendar-cursor-to-date
?
Thanks
calendar-cursor-to-date
. But I was confused by the documentation, which doesn't clarify that it only works within the calendar buffer. I want a function that will work in any text buffer (not the calendar buffer), and look near the cursor for a date string, and parse and return the date corresponding to that string. See How to parse calendar date or timestamp at cursor from elisp?