From mboxrd@z Thu Jan  1 00:00:00 1970
From: Olaf Dietsche <olaf+list.orgmode@olafdietsche.de>
Subject: Re: How do I create a drawer?
Date: Wed, 25 Jan 2012 09:29:53 +0100
Message-ID: <87sjj4uqv2.fsf@rat.lan>
References: <30687.1327452372@alphaville>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Return-path: <emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org>
Received: from eggs.gnu.org ([140.186.70.92]:34319)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <olaf+list.orgmode@olafdietsche.de>)
	id 1RpyF8-0001gt-VH
	for emacs-orgmode@gnu.org; Wed, 25 Jan 2012 03:30:17 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <olaf+list.orgmode@olafdietsche.de>)
	id 1RpyF2-00021Z-K4
	for emacs-orgmode@gnu.org; Wed, 25 Jan 2012 03:30:10 -0500
Received: from www85.your-server.de ([213.133.104.85]:36120)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <olaf+list.orgmode@olafdietsche.de>)
	id 1RpyF2-0001zj-DD
	for emacs-orgmode@gnu.org; Wed, 25 Jan 2012 03:30:04 -0500
In-Reply-To: <30687.1327452372@alphaville> (Nick Dokos's message of "Tue, 24
	Jan 2012 19:46:12 -0500")
List-Id: "General discussions about Org-mode." <emacs-orgmode.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-orgmode>,
	<mailto:emacs-orgmode-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/emacs-orgmode>
List-Post: <mailto:emacs-orgmode@gnu.org>
List-Help: <mailto:emacs-orgmode-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-orgmode>,
	<mailto:emacs-orgmode-request@gnu.org?subject=subscribe>
Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org
Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org
To: nicholas.dokos@hp.com
Cc: emacs-orgmode@gnu.org

Nick Dokos <nicholas.dokos@hp.com> writes:

> The only way I found so far to create a drawer is to actually type the
> damn thing in (I'm talking about my own drawers, not the special
> drawers that org knows something about). I didn't find any utility
> functions to insert drawers (except for :PROPERTIES:), and somewhat to
> my surprise, completion does not seem to work for drawer names: I
> expected typing a colon and M-TAB would allow me to use drawer names for
> completion, but it seems to only care about property keys, even if I'm
> not in the context of a :PROPERTIES: drawer. Am I missing something?

For a quick hack, you might try this one:

diff --git a/lisp/org.el b/lisp/org.el
index 7163e8f..129e08c 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -14397,6 +14397,11 @@ formats in the current buffer."
 (defun org-insert-property-drawer ()
   "Insert a property drawer into the current entry."
   (interactive)
+  (org-insert-drawer "PROPERTIES"))
+
+(defun org-insert-drawer (drawer)
+  "Insert a drawer into the current entry."
+  (interactive "sDrawer: ")
   (org-back-to-heading t)
   (looking-at org-outline-regexp)
   (let ((indent (if org-adapt-indentation
@@ -14422,7 +14427,7 @@ formats in the current buffer."
     (org-skip-over-state-notes)
     (skip-chars-backward " \t\n\r")
     (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)
     (org-indent-to-column indent)
     (beginning-of-line 2)

With M-x org-insert-drawer RET drawer-name RET inserts your own
drawer. It doesn't support completion though.

Regards, Olaf