From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olaf Dietsche 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: Received: from eggs.gnu.org ([140.186.70.92]:34319) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) 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 ) 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 ) 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." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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 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