emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] some lisp help (for complete 0-knowledge lisp emacs user :))


From: Sebastien Vauban
Subject: Re: [O] some lisp help (for complete 0-knowledge lisp emacs user :))
Date: Mon, 04 Aug 2014 16:45:27 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.92 (windows-nt)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]