emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Olaf Dietsche <olaf+list.orgmode@olafdietsche.de>
To: nicholas.dokos@hp.com
Cc: emacs-orgmode@gnu.org
Subject: Re: How do I create a drawer?
Date: Wed, 25 Jan 2012 09:29:53 +0100	[thread overview]
Message-ID: <87sjj4uqv2.fsf@rat.lan> (raw)
In-Reply-To: <30687.1327452372@alphaville> (Nick Dokos's message of "Tue, 24 Jan 2012 19:46:12 -0500")

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."
+  (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."
     (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

  reply	other threads:[~2012-01-25  8:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-25  0:46 Nick Dokos
2012-01-25  8:29 ` Olaf Dietsche [this message]
2012-01-25 14:25   ` Bastien
2012-01-25  8:44 ` Russell Adams
2012-01-25  9:03 ` Bastien
2012-01-25  9:17   ` Rainer M Krug
2012-01-25 13:16   ` Carsten Dominik
2012-01-25 13:29     ` Nicolas Goaziou
2012-01-25 14:09       ` Carsten Dominik
2012-01-25 14:17         ` Nicolas Goaziou
2012-01-25 14:27           ` Bastien
2012-01-25 16:33             ` Nicolas Goaziou
2012-01-26  8:28               ` Bastien
2012-01-25 14:26     ` Bastien
2012-01-25 14:34       ` Nick Dokos
2012-01-26  1:46         ` François Pinard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sjj4uqv2.fsf@rat.lan \
    --to=olaf+list.orgmode@olafdietsche.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=nicholas.dokos@hp.com \
    --subject='Re: How do I create a drawer?' \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).