emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: rpgoldman@sift.info
To: emacs-orgmode@gnu.org
Cc: "Robert P. Goldman" <rpgoldman@real-time.com>
Subject: [PATCH] Add an easy template for index (i), and move include file to I from i.
Date: Thu, 28 Apr 2011 10:38:54 -0500	[thread overview]
Message-ID: <1304005134-31639-2-git-send-email-rpgoldman@sift.info> (raw)
In-Reply-To: <10844.1303994001@alphaville.dokosmarshall.org>

From: Robert P. Goldman <rpgoldman@real-time.com>

Implement Nick Dokos' suggestion for inserting #+INDEX.

Notes about this patch:
1.  It breaks some old user-visible behavior, since <i changes meaning.
    Per Nick's posting, we expect that if index is used, it will be used
    more commonly than include file.  However, since this is a custom,
    behavior could be changed.  Indeed, we could put index on capital
    I with a suggestion that users who are indexing should swap in their
    customizations.
2.  I modified the docstring for org-structure-template-alist, which did
    not explain the function of the "?" in the string.  Someone should
    check and verify I didn't get this wrong.
3.  There doesn't seem to be a Muse tag equivalent for #+index, so I
    just made the Muse equivalent of #+index be #+index.  I don't know
    org-mtags enough to know if this is appropriate.
---
 lisp/org.el |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index e17c90f..fdff7ef 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -10753,14 +10753,17 @@ This function can be used in a hook."
          "<literal style=\"html\">?</literal>")
     ("a" "#+begin_ascii\n?\n#+end_ascii")
     ("A" "#+ascii: ")
-    ("i" "#+include %file ?"
+    ("i" "#+index: ?"
+     "#+index: ?")
+    ("I" "#+include %file ?"
          "<include file=%file markup=\"?\">")
     )
   "Structure completion elements.
 This is a list of abbreviation keys and values.  The value gets inserted
 if you type `<' followed by the key and then press the completion key,
 usually `M-TAB'.  %file will be replaced by a file name after prompting
-for the file using completion.
+for the file using completion.  The cursor will be placed at the position
+of the `?` in the template.
 There are two templates for each key, the first uses the original Org syntax,
 the second uses Emacs Muse-like syntax tags.  These Muse-like tags become
 the default when the /org-mtags.el/ module has been loaded.  See also the
@@ -10779,7 +10782,7 @@ expands them."
   (let ((l (buffer-substring (point-at-bol) (point)))
 	a)
     (when (and (looking-at "[ \t]*$")
-	       (string-match "^[ \t]*<\\([a-z]+\\)$"l)
+	       (string-match "^[ \t]*<\\([a-zA-Z]+\\)$" l)
 	       (setq a (assoc (match-string 1 l) org-structure-template-alist)))
       (org-complete-expand-structure-template (+ -1 (point-at-bol)
 						 (match-beginning 1)) a)
-- 
1.7.3.5

  parent reply	other threads:[~2011-04-28 15:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-28 11:47 Translate #+INDEX to Latex \index{} on export rpgoldman
2011-04-28 11:47 ` [PATCH] Make the latex export preprocessor rewrite #+INDEX to \index rpgoldman
2011-04-28 12:33   ` Nick Dokos
2011-04-28 15:23     ` Robert Goldman
2011-04-28 15:29       ` Robert Goldman
2011-04-28 15:38     ` Patch --- adding an easy template for #+index rpgoldman
2011-04-28 19:11       ` Bernt Hansen
2011-04-28 19:59         ` Robert Goldman
2011-04-28 21:31           ` Bernt Hansen
2011-04-28 15:38     ` rpgoldman [this message]
2011-05-04  7:49       ` [Accepted] Add an easy template for index (i), and move include file to I from i Carsten Dominik
2011-04-29 21:45   ` Bug Re: [PATCH] Make the latex export preprocessor rewrite #+INDEX to \index Robert Goldman
2011-05-04  7:59   ` [Accepted] " Carsten Dominik
2011-05-04 15:08     ` Robert Goldman
2011-05-04 22:36       ` Carsten Dominik
2011-05-04 22:46         ` Robert Goldman

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  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=1304005134-31639-2-git-send-email-rpgoldman@sift.info \
    --to=rpgoldman@sift.info \
    --cc=emacs-orgmode@gnu.org \
    --cc=rpgoldman@real-time.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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).