calfw capture: store date before capture to avoid cfw:component error
calfw-cursor-to-nearest-date fails in capture buffer context. Fix: my/calfw-capture saves date first, then starts org-capture.
This commit is contained in:
13
config.el
13
config.el
@@ -1598,6 +1598,15 @@ Skip for beamer exports — beamer uses adjustbox on plain tabular."
|
|||||||
:demand t
|
:demand t
|
||||||
:config
|
:config
|
||||||
;; org-capture integration: "a" to add event on selected date
|
;; org-capture integration: "a" to add event on selected date
|
||||||
|
;; Store date from calfw before capture starts
|
||||||
|
(defvar my/calfw-capture-date nil "Date selected in calfw for capture.")
|
||||||
|
|
||||||
|
(defun my/calfw-capture ()
|
||||||
|
"Start org-capture with calfw date context."
|
||||||
|
(interactive)
|
||||||
|
(setq my/calfw-capture-date (calfw-cursor-to-nearest-date))
|
||||||
|
(org-capture nil "c"))
|
||||||
|
|
||||||
;; Prompts for start/end time; empty = all-day event
|
;; Prompts for start/end time; empty = all-day event
|
||||||
;; Uses active timestamp with time range for timed events,
|
;; Uses active timestamp with time range for timed events,
|
||||||
;; or date-range (-->--) for multi-day events.
|
;; or date-range (-->--) for multi-day events.
|
||||||
@@ -1608,7 +1617,7 @@ Formats matching what org-caldav/ox-icalendar export correctly:
|
|||||||
- Timed single day: <2026-02-26 Thu 14:00-15:30>
|
- Timed single day: <2026-02-26 Thu 14:00-15:30>
|
||||||
- All-day multi: <2026-02-26 Thu>--<2026-02-28 Sat>
|
- All-day multi: <2026-02-26 Thu>--<2026-02-28 Sat>
|
||||||
- Timed multi-day: <2026-02-26 Thu 15:00>--<2026-02-28 Sat 22:00>"
|
- Timed multi-day: <2026-02-26 Thu 15:00>--<2026-02-28 Sat 22:00>"
|
||||||
(let* ((date (calfw-cursor-to-nearest-date))
|
(let* ((date (or my/calfw-capture-date (calendar-current-date)))
|
||||||
(y (calendar-extract-year date))
|
(y (calendar-extract-year date))
|
||||||
(m (calendar-extract-month date))
|
(m (calendar-extract-month date))
|
||||||
(d (calendar-extract-day date))
|
(d (calendar-extract-day date))
|
||||||
@@ -1669,7 +1678,7 @@ Formats matching what org-caldav/ox-icalendar export correctly:
|
|||||||
"M" #'calfw-change-view-month
|
"M" #'calfw-change-view-month
|
||||||
"D" #'calfw-change-view-day
|
"D" #'calfw-change-view-day
|
||||||
"TAB" #'calfw-navi-next-item-command
|
"TAB" #'calfw-navi-next-item-command
|
||||||
"a" #'org-capture
|
"a" #'my/calfw-capture
|
||||||
"q" #'bury-buffer
|
"q" #'bury-buffer
|
||||||
"x" #'calfw-org-clean-exit
|
"x" #'calfw-org-clean-exit
|
||||||
"RET" #'calfw-org-open-agenda-day
|
"RET" #'calfw-org-open-agenda-day
|
||||||
|
|||||||
Reference in New Issue
Block a user