From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sebastien Vauban <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org> 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: <CAOQHXPoVa4yd=YdGVmyn0tS_7ox6N9-TpxduzWT6Z01mzPwrcQ@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: <emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org> List-Id: "General discussions about Org-mode." <emacs-orgmode.gnu.org> List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-orgmode>, <mailto:emacs-orgmode-request-mXXj517/zsQ@public.gmane.org?subject=unsubscribe> List-Archive: <http://lists.gnu.org/archive/html/emacs-orgmode> List-Post: <mailto:emacs-orgmode-mXXj517/zsQ@public.gmane.org> List-Help: <mailto:emacs-orgmode-request-mXXj517/zsQ@public.gmane.org?subject=help> List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-orgmode>, <mailto:emacs-orgmode-request-mXXj517/zsQ@public.gmane.org?subject=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