Bernt Hansen schrieb:
Patrick Drechsler <patr...@pdrechsler.de> writes:
Bernt Hansen schrieb:
[snipped nice code]
How can I extend this function to wrap the current selection into a
#+BEGIN_SRC
...code...
#+END_SRC
string while also interactively asking the user for a language string?
Something like this maybe? It's not 100% to spec. I find regions that
are entire lines easier to work with so the end point would be the
beginning of the first line not in the region (not after the })
For me - triple clicking and dragging selects entire lines which works
well for this.
------------------------------------------------------------------------
(defun my-wrap-src ()
(interactive)
(let ((beg (region-beginning))
(end (region-end))
(src (read-from-minibuffer "Source type: " "java")))
(save-excursion
(goto-char (region-end))
(insert "#+END_SRC\n")
(goto-char (region-beginning))
(insert "#+BEGIN_SRC " src "\n"))))
------------------------------------------------------------------------
Wonderful! Thank you very much, it works like a charm! And your analysis
of my sloppy specs was also correct.
Thank you,
Patrick
_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode