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?

thx alot in advance

Z

Reply via email to