I enclose some code that I find quite useful for this purpose (i.e.,
to get a similar "feel" to inserting tasks in a traditional
agenda). It basically uses capture but speeds things up a bit and
allows taking times from an agenda time grid. Cheers, --Manuel

;; A handy shortcut to use capture in today in agenda
;; The idea is that you type "+" while at an agenda day, fill in the
;; TODO that pops up, and type "C-CC-c": the TODO gets added to the
;; first file in your org-agenda-files, after an "* Auto-inserted
;; tasks" entry. It also tries to capture the time if you are on an
;; agenda schedule.
;; Use the current date when possible
(setq org-capture-use-agenda-date t)
;; Recalculate agenda after captures
(add-hook 'org-capture-after-finalize-hook 'org-agenda-redo)
;; Key binding (+)
 (lambda ()
   (define-key org-agenda-keymap   "+" 'my-org-agenda-capture-in-date-at-point)
   (define-key org-agenda-mode-map "+" 'my-org-agenda-capture-in-date-at-point)
;; Quick interface to capture
(defun my-org-agenda-capture-in-date-at-point ()
  "Call parts of `org-capture' with the date at point (and time if available)."
  (if (not (eq major-mode 'org-agenda-mode))
      (user-error "You cannot do this outside of agenda buffers")
    (let ((org-overriding-default-time (org-get-cursor-date t)))
      ; (print (concat "*** " (format-time-string "%F %T" 
      (org-capture 1 "+")

;; Connection w/org-capture
;; The org file in which tasks are inserted. An entry:
;; "* Auto-inserted tasks"
;; should exist in that file. 
;; In this case we take the first org file in org-agenda-files:
(setq org-default-notes-file (car org-agenda-files))
;; The capture template (You may have other org-capture-templates --
;; in that case simply add this one to the list)
(setq org-capture-templates 
'(("+" "Special template used by + keybinding" entry 
   (file+headline "" "Auto-inserted tasks")
   "** TODO %? %(if (string= (substring \"%T\" 16 21) \"00:00\") \"%t\" \"%T\")"
   :prepend t :empty-lines-after 1)

On Monday, March 5, 2018 at 10:31:28 (+0000), Eric S Fraga wrote:
 > On Monday,  5 Mar 2018 at 09:05, Neil Jerram wrote:
 > > Eric,
 > >
 > > IIUC, that would add an entry to the 'diary' file.
 > Hi Neil,
 > You are correct.  However, if you have defined org-agenda-diary-file, an
 > org entry is added via org-agenda-diary-entry-in-org-file.
 > > I thought perhaps that Shérab meant something different, namely to
 > > capture a new TODO item that was scheduled for that date.
 > Maybe.  The post was vague.  I read it the other way.  Shérab?
 > For TODO, org-agenda-capture (bound to "k" I believe?) already does what
 > you think Shérab wanted, I would have thought?  What is missing?
 > For me, looking at dates in the agenda is about checking availability
 > and this usually means I am looking at creating a new appointment.  "i
 > d" is perfect for this.
 > -- 
 > Eric S Fraga via Emacs 27.0.50, Org release_9.1.6-191-g90607d
 > x[DELETED ATTACHMENT signature.asc, application/pgp-signature]

 Manuel Hermenegildo                       manuel.hermenegi...@imdea.org

Reply via email to