New function `org-insert-drawer'.

* org.el (org-insert-drawer): New function.
(org-insert-property-drawer): Use it.

Thanks to Olaf Dietsche for this patch.
This commit is contained in:
Bastien Guerry 2012-01-25 15:05:53 +01:00
parent aee6f9008a
commit cf3e3e39f9
1 changed files with 6 additions and 1 deletions

View File

@ -14400,6 +14400,11 @@ formats in the current buffer."
(defun org-insert-property-drawer () (defun org-insert-property-drawer ()
"Insert a property drawer into the current entry." "Insert a property drawer into the current entry."
(interactive) (interactive)
(org-insert-drawer "PROPERTIES"))
(defun org-insert-drawer (drawer)
"Insert a drawer into the current entry."
(interactive "sDrawer: ")
(org-back-to-heading t) (org-back-to-heading t)
(looking-at org-outline-regexp) (looking-at org-outline-regexp)
(let ((indent (if org-adapt-indentation (let ((indent (if org-adapt-indentation
@ -14425,7 +14430,7 @@ formats in the current buffer."
(org-skip-over-state-notes) (org-skip-over-state-notes)
(skip-chars-backward " \t\n\r") (skip-chars-backward " \t\n\r")
(if (eq (char-before) ?*) (forward-char 1)) (if (eq (char-before) ?*) (forward-char 1))
(let ((inhibit-read-only t)) (insert "\n:PROPERTIES:\n:END:")) (let ((inhibit-read-only t)) (insert "\n:" drawer ":\n:END:"))
(beginning-of-line 0) (beginning-of-line 0)
(org-indent-to-column indent) (org-indent-to-column indent)
(beginning-of-line 2) (beginning-of-line 2)