summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert P. Goldman <rpgoldman@real-time.com>2011-04-28 20:38:54 +0000
committerCarsten Dominik <carsten.dominik@gmail.com>2011-05-04 09:49:31 +0200
commit62c12cc50f860ffd076c5bf3bca6df052a209c11 (patch)
tree88e8c001fc21321255fdcedff0d1894ca7415b3b
parentad28fc9a61735900ff6b6bdca3d73c0364aa1a8e (diff)
downloadorg-mode-62c12cc50f860ffd076c5bf3bca6df052a209c11.tar.gz
Add an easy template for index (i)
* lisp/org.el (org-structure-template-alist): Add an easy template for index (i), and move include file to I from i. * doc/org.texi (Easy Templates): Document new template. 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.
-rw-r--r--doc/org.texi3
-rw-r--r--lisp/org.el9
2 files changed, 8 insertions, 4 deletions
diff --git a/doc/org.texi b/doc/org.texi
index 46f3163..68ea9ce 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -12976,7 +12976,8 @@ The following template selectors are currently supported.
@item @kbd{H} @tab @code{#+html:}
@item @kbd{a} @tab @code{#+begin_ascii ... #+end_ascii}
@item @kbd{A} @tab @code{#+ascii:}
-@item @kbd{i} @tab @code{#+include:} line
+@item @kbd{i} @tab @code{#+index:} line
+@item @kbd{I} @tab @code{#+include:} line
@end multitable
For example, on an empty line, typing "<e" and then pressing TAB, will expand
diff --git a/lisp/org.el b/lisp/org.el
index face49a..cd0065a 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -10760,14 +10760,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
@@ -10786,7 +10789,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)