branch: externals/org
commit 639b4cafb7c5ede521dacb3d4fd34e47433fcce9
Author: Ihor Radchenko <yanta...@posteo.net>
Commit: Ihor Radchenko <yanta...@posteo.net>

    org-capture-templates-contexts: Fix :type specification
    
    * lisp/org-capture.el (org-capture-templates-contexts):
    
    Reported-by: Omar AntolĂ­n Camarena <o...@matem.unam.mx>
    Link: https://orgmode.org/list/877c3udya6....@matem.unam.mx
---
 lisp/org-capture.el | 38 +++++++++++++++++++++++---------------
 1 file changed, 23 insertions(+), 15 deletions(-)

diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index b36c1c1166..2d9ce0ba42 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -633,21 +633,29 @@ key for the capture template otherwise associated with 
\"d\".
 to avoid duplicates.)"
   :version "24.3"
   :group 'org-capture
-  :type '(repeat (list :tag "Rule"
-                      (string :tag "        Capture key")
-                      (string :tag "Replace by template")
-                      (repeat :tag "Available when"
-                              (choice
-                               (cons :tag "Condition"
-                                     (choice
-                                      (const :tag "In file" in-file)
-                                      (const :tag "Not in file" not-in-file)
-                                      (const :tag "In buffer" in-buffer)
-                                      (const :tag "Not in buffer" 
not-in-buffer)
-                                      (const :tag "In mode" in-mode)
-                                      (const :tag "Not in mode" not-in-mode))
-                                     (regexp))
-                               (function :tag "Custom function"))))))
+  :type
+  (let ((available-when
+         '(repeat :tag "Available when"
+                 (choice
+                  (cons :tag "Condition"
+                        (choice
+                         (const :tag "In file" in-file)
+                         (const :tag "Not in file" not-in-file)
+                         (const :tag "In buffer" in-buffer)
+                         (const :tag "Not in buffer" not-in-buffer)
+                         (const :tag "In mode" in-mode)
+                         (const :tag "Not in mode" not-in-mode))
+                        (regexp))
+                  (function :tag "Custom function")))))
+    `(repeat
+      (choice
+       (list :tag "Short rule"
+            (string :tag "        Capture key")
+            ,available-when)
+       (list :tag "Full rule"
+            (string :tag "        Capture key")
+            (string :tag "Replace by template")
+            ,available-when)))))
 
 (defcustom org-capture-use-agenda-date nil
   "Non-nil means use the date at point when capturing from agendas.

Reply via email to