Paste number 146101: org-begin-template Pasted by: chrisdone When: 5 years, 6 months ago Share: Tweet this! | http://paste.lisp.org/+34QD Channel: None Paste contents: Raw Source | XML | Display As text/plain image/svg+xml text/html application/xhtml+xml

( kbd "C-#" ) 'org-begin-template define-key org-mode-map'org-begin-template ( ) "Make a template at point." interactive if ( org-at-table-p ) call-interactively 'org-table-rotate-recalc-marks let* ( choices ' ( ( "s" . "SRC" ) ( "e" . "EXAMPLE" ) ( "q" . "QUOTE" ) ( "v" . "VERSE" ) ( "c" . "CENTER" ) ( "l" . "LaTeX" ) ( "h" . "HTML" ) ( "a" . "ASCII" ) ) ) key-description vector concat propertize "Template type: " 'face ' 'face ' minibuffer-prompt mapconcat lambda ( choice ) concat propertize car choice 'face ' font-lock-type-face ": " cdr choice ", " choices read-key key let assoc key choices result let cdr result choice cond ( region-active-p ) let region-beginning start region-end end goto-char end insert "

#+END_" choice choice goto-char start insert "#+BEGIN_" choice "

" choice t insert "#+BEGIN_" choice "

" choice save-excursion insert "

#+END_" choice choice when result defun org-begin-template