From mboxrd@z Thu Jan 1 00:00:00 1970 From: Patrick Drechsler Subject: Re: shortcut keys for mark ups Date: Thu, 08 Jan 2009 00:05:22 +0100 Message-ID: References: <49638861.2050606@cornell.edu> <87sknwz5pe.fsf@gollum.intra.norang.ca> <87fxjuzrrx.fsf@gollum.intra.norang.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LKhSx-0006rS-HY for emacs-orgmode@gnu.org; Wed, 07 Jan 2009 18:05:35 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LKhSw-0006pv-O3 for emacs-orgmode@gnu.org; Wed, 07 Jan 2009 18:05:35 -0500 Received: from [199.232.76.173] (port=55371 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LKhSw-0006ps-Jx for emacs-orgmode@gnu.org; Wed, 07 Jan 2009 18:05:34 -0500 Received: from main.gmane.org ([80.91.229.2]:37318 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LKhSw-0005FM-4c for emacs-orgmode@gnu.org; Wed, 07 Jan 2009 18:05:34 -0500 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1LKhSs-0000wq-Hz for emacs-orgmode@gnu.org; Wed, 07 Jan 2009 23:05:30 +0000 Received: from dslb-084-057-123-202.pools.arcor-ip.net ([84.57.123.202]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 07 Jan 2009 23:05:30 +0000 Received: from patrick by dslb-084-057-123-202.pools.arcor-ip.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 07 Jan 2009 23:05:30 +0000 In-Reply-To: <87fxjuzrrx.fsf@gollum.intra.norang.ca> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Bernt Hansen schrieb: > Patrick Drechsler 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