emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Org Capture Menu cannot be fully viewed


From: No Wayman
Subject: Re: Org Capture Menu cannot be fully viewed
Date: Wed, 16 Dec 2020 13:46:11 -0500
User-agent: mu4e 1.5.6; emacs 28.0.50


What is here missing is `org-capture-by-completing-read' so that
user may select among many various capture templates.

Compensating for initial bad design is expensive effort.

Are you suggesting something like this?:

#+begin_src emacs-lisp
(defun +org-capture-read (&optional arg)
 "completing read interface for org-capture template selection.
ARG is passed to `org-capture'."
 (let (parent)
   (when-let* ((templates
                (mapcar (lambda (template)
                          (let* ((keys (car template))
                                 (parentkeys (car parent)))
                            (if (= (length template) 2)
(progn (setq parent template) nil) (cons (concat (when (and parentkeys (string-prefix-p parentkeys keys)) (concat (cadr parent) "/"))
                                            (cadr template))
                                    keys))))
                        org-capture-templates))
               (selection (alist-get
                           (completing-read "capture template: "
(mapcar #'car (delq nil templates))
                                            nil 'require-match)
                           templates
                           nil nil
                           #'string=)))
     (org-capture arg selection))))
#+end_src emacs-lisp




reply via email to

[Prev in Thread] Current Thread [Next in Thread]