Browse Source

Make C-c r C customize remember templates

Adam Spiers writes:

> I really like the way `M-x org-agenda C' takes you straight to the
> *Customize Option: Org Agenda Custom Commands* buffer.  Similarly, it
> would be nice if `M-x org-remember C' took you straight to the
> *Customize Option: Org Remember Templates* buffer.

This does now work, but only if the user has no template defined for
the access letter `C'.

>
> Although in both cases it would be even nicer if the keystroke for
> this was customisable, as no doubt some people already have `M-x
> org-remember C' set up to do something else.

It is not customizable, like for the agenda....
Carsten Dominik 15 years ago
parent
commit
c23ade5d8e
2 changed files with 15 additions and 3 deletions
  1. 3 0
      lisp/ChangeLog
  2. 12 3
      lisp/org-remember.el

+ 3 - 0
lisp/ChangeLog

@@ -1,5 +1,8 @@
 2010-01-03  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org-remember.el (org-select-remember-template): Use C letter to
+	customize remember templates.
+
 	* org-agenda.el (org-agenda-bulk-mark, org-agenda-bulk-unmark):
 	Move cursor to next visible line.
 

+ 12 - 3
lisp/org-remember.el

@@ -351,7 +351,7 @@ RET at beg-of-buf -> Append to file as level 2 headline
 			 org-force-remember-template-char))
 		      (t
 		       (setq msg (format
-				  "Select template: %s"
+				  "Select template: %s%s"
 				  (mapconcat
 				   (lambda (x)
 				     (cond
@@ -362,13 +362,17 @@ RET at beg-of-buf -> Append to file as level 2 headline
 				       (format "[%c]%s" (car x)
 					       (substring (nth 1 x) 1)))
 				      (t (format "[%c]%s" (car x) (nth 1 x)))))
-				   templates " ")))
+				   templates " ")
+				  (if (assoc ?C templates)
+				      ""
+				    " [C]customize templates")))
 		       (let ((inhibit-quit t) char0)
 			 (while (not char0)
 			   (message msg)
 			   (setq char0 (read-char-exclusive))
 			   (when (and (not (assoc char0 templates))
-				      (not (equal char0 ?\C-g)))
+				      (not (equal char0 ?\C-g))
+				      (not (equal char0 ?C)))
 			     (message "No such template \"%c\"" char0)
 			     (ding) (sit-for 1)
 			     (setq char0 nil)))
@@ -376,6 +380,11 @@ RET at beg-of-buf -> Append to file as level 2 headline
 			   (jump-to-register remember-register)
 			   (kill-buffer remember-buffer)
 			   (error "Abort"))
+			 (when (not (assoc char0 templates))
+			   (jump-to-register remember-register)
+			   (kill-buffer remember-buffer)
+			   (customize-variable 'org-remember-templates)
+			   (error "Customize templates"))
 			 char0))))))
       (cddr (assoc char templates)))))