From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sebastien Vauban Subject: Re: some lisp help (for complete 0-knowledge lisp emacs user :)) Date: Mon, 04 Aug 2014 16:45:27 +0200 Message-ID: <86ppgg5n5k.fsf@somewhere.org> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org To: emacs-orgmode-mXXj517/zsQ@public.gmane.org Xebar Saram wrote: > Hi list > > so i know i should start to really learn lisp but real life (uni work, > family etc) doesn't really allow me so im marking my 1st year anniversary > of using emacs without grasping lisp (plus i am in generally coding inept > :)) > > in any case.... :) i have this handy lisp snippet that i find very useful > and maybe some others in the list will find as well. it allows to quick > convert lines of text into org src/example blocks: > > (defun z-wrap-cblock-lisp () > "Wrap region in quote block" > (interactive) > (save-excursion > (save-restriction > (and > (region-active-p) > (use-region-p) > (narrow-to-region (region-beginning) (region-end))) > (goto-char (point-min)) > (insert "#+BEGIN_SRC emacs-lisp :results none\n") > (goto-char (point-max)) > (insert "#+END_SRC\n") > (deactivate-mark)))) > > > this works well but has some annoying flaws like you have to first manually > mark the region you want to convert etc > > i was wondering: > > a)can some lisp coding master show me how to make this function auto select > the line//X user defined lines/smart paragraph selection before it wraps it > in the org block > b)any improvement ideas from the community? FYI, there's already C-c C-v C-d (`org-babel-demarcate-block')... Best regards, Seb -- Sebastien Vauban