* LaTeX-close-environment: org-close-template
@ 2015-12-08 10:34 Uwe Brauer
2015-12-08 15:50 ` Eric S Fraga
0 siblings, 1 reply; 5+ messages in thread
From: Uwe Brauer @ 2015-12-08 10:34 UTC (permalink / raw)
To: emacs-orgmode
Hello
Auctex has a nice function called LaTeX-close-environment, which works
as follows: I have
\begin{equation}
^(cursor)
I run LaTeX-close-environment and obtain:
\begin{equation}
\end{equation}
Now could I am looking for a similar functionality for say
#+begin_comment
^(cursor)
org--close-template and obtain:
#+begin_comment
#+end_comment
Does anybody know about such a function?
Regards
Uwe Brauer
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: LaTeX-close-environment: org-close-template
2015-12-08 10:34 LaTeX-close-environment: org-close-template Uwe Brauer
@ 2015-12-08 15:50 ` Eric S Fraga
2015-12-08 17:04 ` Uwe Brauer
0 siblings, 1 reply; 5+ messages in thread
From: Eric S Fraga @ 2015-12-08 15:50 UTC (permalink / raw)
To: emacs-orgmode
On Tuesday, 8 Dec 2015 at 10:34, Uwe Brauer wrote:
> Hello
>
> Auctex has a nice function called LaTeX-close-environment, which works
> as follows: I have
>
> \begin{equation}
>
> ^(cursor)
>
> I run LaTeX-close-environment and obtain:
> \begin{equation}
>
> \end{equation}
>
> Now could I am looking for a similar functionality for say
>
> #+begin_comment
>
> ^(cursor)
>
> org--close-template and obtain:
>
> #+begin_comment
>
> #+end_comment
>
> Does anybody know about such a function?
I don't. However, I find that using the easy templates (e.g. <s to
insert a src block, <c to insert a centred block, ...), akin to
latex-insert-block, does the equivalent and better (in my opinion, of
course ;-). There isn't an entry for comment blocks but you can define
your own:
,----[ C-h v org-structure-template-alist RET ]
| org-structure-template-alist is a variable defined in `org.el'.
| Its value is shown below.
|
| Documentation:
| 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 `TAB'. %file will be replaced by a file name after prompting
| 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
| variable `org-mtags-prefer-muse-templates'.
|
| You can customize this variable.
|
| This variable was introduced, or its default value was changed, in
| version 25.1 of Emacs.
|
|
| Value: (("n" "#+BEGIN_NOTES\n?\n#+END_NOTES")
| ("a" "#+begin_ascii\n?\n#+end_ascii")
| ("A" "#+ascii: ")
| ("c" "#+begin_center\n?\n#+end_center" "<center>\n?\n</center>")
| ("e" "#+begin_example\n?\n#+end_example" "<example>\n?\n</example>")
| ("h" "#+begin_html\n?\n#+end_html" "<literal style=\"html\">\n?\n</literal>")
| ("H" "#+html: " "<literal style=\"html\">?</literal>")
| ("i" "#+index: ?" "#+index: ?")
| ("I" "#+include %file ?" "<include file=%file markup=\"?\">")
| ("l" "#+begin_latex\n?\n#+end_latex" "<literal style=\"latex\">\n?\n</literal>")
| ("L" "#+latex: " "<literal style=\"latex\">?</literal>")
| ("q" "#+begin_quote\n?\n#+end_quote" "<quote>\n?\n</quote>")
| ("s" "#+begin_src ?\n\n#+end_src" "<src lang=\"?\">\n\n</src>")
| ("v" "#+begin_verse\n?\n#+end_verse" "<verse>\n?\n</verse>")
| ("w" "#+begin_whitebox\n?\n#+end_whitebox"))
|
| Original value was
| (("s" "#+BEGIN_SRC ?\n\n#+END_SRC")
| ("e" "#+BEGIN_EXAMPLE\n?\n#+END_EXAMPLE")
| ("q" "#+BEGIN_QUOTE\n?\n#+END_QUOTE")
| ("v" "#+BEGIN_VERSE\n?\n#+END_VERSE")
| ("V" "#+BEGIN_VERBATIM\n?\n#+END_VERBATIM")
| ("c" "#+BEGIN_CENTER\n?\n#+END_CENTER")
| ("l" "#+BEGIN_LaTeX\n?\n#+END_LaTeX")
| ("L" "#+LaTeX: ")
| ("h" "#+BEGIN_HTML\n?\n#+END_HTML")
| ("H" "#+HTML: ")
| ("a" "#+BEGIN_ASCII\n?\n#+END_ASCII")
| ("A" "#+ASCII: ")
| ("i" "#+INDEX: ?")
| ("I" "#+INCLUDE: %file ?"))
`----
HTH,
eric
--
: Eric S Fraga (0xFFFCF67D), Emacs 24.5.1, Org release_8.3.2-379-g38fd09
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: LaTeX-close-environment: org-close-template
2015-12-08 15:50 ` Eric S Fraga
@ 2015-12-08 17:04 ` Uwe Brauer
2015-12-09 8:09 ` Eric S Fraga
0 siblings, 1 reply; 5+ messages in thread
From: Uwe Brauer @ 2015-12-08 17:04 UTC (permalink / raw)
To: emacs-orgmode
> On Tuesday, 8 Dec 2015 at 10:34, Uwe Brauer wrote:
> I don't. However, I find that using the easy templates (e.g. <s to
> insert a src block, <c to insert a centred block, ...), akin to
> latex-insert-block, does the equivalent and better (in my opinion, of
> course ;-). There isn't an entry for comment blocks but you can define
> your own:
better why?
I think the opposite, for example, another missing feature: if you mark
a text and one to insert a template around it, say src, that does not
work in org-mode, but for it works an environment in auctex.
In any case, the point is: sometimes you incidentally may delete say
#+end_src, so having a function which I described spare you to copy and
paste text.
> ,----[ C-h v org-structure-template-alist RET ]
I know. I did
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: LaTeX-close-environment: org-close-template
2015-12-08 17:04 ` Uwe Brauer
@ 2015-12-09 8:09 ` Eric S Fraga
2015-12-09 20:33 ` Will O'Brien
0 siblings, 1 reply; 5+ messages in thread
From: Eric S Fraga @ 2015-12-09 8:09 UTC (permalink / raw)
To: emacs-orgmode
On Tuesday, 8 Dec 2015 at 17:04, Uwe Brauer wrote:
> > On Tuesday, 8 Dec 2015 at 10:34, Uwe Brauer wrote:
>
> > I don't. However, I find that using the easy templates (e.g. <s to
> > insert a src block, <c to insert a centred block, ...), akin to
> > latex-insert-block, does the equivalent and better (in my opinion, of
> > course ;-). There isn't an entry for comment blocks but you can
> > define
> > your own:
> better why?
Because it avoids typing the first line as well... but I didn't say
that what you wanted wasn't useful.
> I think the opposite, for example, another missing feature: if you mark
> a text and one to insert a template around it, say src, that does not
> work in org-mode, but for it works an environment in auctex.
Yes, I do often find myself killing a bunch of lines, inserting the
template and then yanking the lines back.
> In any case, the point is: sometimes you incidentally may delete say
> #+end_src, so having a function which I described spare you to copy and
> paste text.
Sure.
--
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.2, Org release_8.3.2-379-g38fd09
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: LaTeX-close-environment: org-close-template
2015-12-09 8:09 ` Eric S Fraga
@ 2015-12-09 20:33 ` Will O'Brien
0 siblings, 0 replies; 5+ messages in thread
From: Will O'Brien @ 2015-12-09 20:33 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 693 bytes --]
On 9 Dec 2015 08:10, "Eric S Fraga" <e.fraga@ucl.ac.uk> wrote:
>
> On Tuesday, 8 Dec 2015 at 17:04, Uwe Brauer wrote:
> > I think the opposite, for example, another missing feature: if you mark
> > a text and one to insert a template around it, say src, that does not
> > work in org-mode, but for it works an environment in auctex.
>
> Yes, I do often find myself killing a bunch of lines, inserting the
> template and then yanking the lines back.
>
It might be worth taking a look at something like yasnippet which provides
both easy to insert templates and the wrap-around functionality you would
like. It's very easy to write snippets which support both these use cases.
Cheers,
Will
[-- Attachment #2: Type: text/html, Size: 916 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-12-09 20:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-08 10:34 LaTeX-close-environment: org-close-template Uwe Brauer
2015-12-08 15:50 ` Eric S Fraga
2015-12-08 17:04 ` Uwe Brauer
2015-12-09 8:09 ` Eric S Fraga
2015-12-09 20:33 ` Will O'Brien
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).