emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Xebar Saram <zeltakc@gmail.com>
To: org mode <emacs-orgmode@gnu.org>
Subject: some lisp help (for complete 0-knowledge lisp emacs user :))
Date: Tue, 29 Jul 2014 14:02:20 +0300	[thread overview]
Message-ID: <CAOQHXPoVa4yd=YdGVmyn0tS_7ox6N9-TpxduzWT6Z01mzPwrcQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1228 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 2240 bytes --]

             reply	other threads:[~2014-07-29 11:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-29 11:02 Xebar Saram [this message]
2014-07-29 12:21 ` Thorsten Jolitz
     [not found]   ` <CAOQHXPoJT4gGTJfOrHAtOfuS53GmPFgSwBqr4OA0ECpE28K1wg@mail.gmail.com>
     [not found]     ` <8761igs5e8.fsf@gmail.com>
2014-07-29 12:48       ` Xebar Saram
2014-07-29 13:30         ` Elisp function for wrapping sexp or region in src-block (was Re: some lisp help) Thorsten Jolitz
2014-07-29 13:52           ` Thorsten Jolitz
2014-07-29 14:48             ` Xebar Saram
2014-07-29 15:42               ` Thorsten Jolitz
2014-07-29 16:21               ` Xebar Saram
2014-07-29 16:23                 ` Xebar Saram
2014-07-29 16:27                   ` Xebar Saram
2014-07-29 16:36                   ` Thorsten Jolitz
2014-08-04 14:45 ` some lisp help (for complete 0-knowledge lisp emacs user :)) Sebastien Vauban

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOQHXPoVa4yd=YdGVmyn0tS_7ox6N9-TpxduzWT6Z01mzPwrcQ@mail.gmail.com' \
    --to=zeltakc@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --subject='Re: some lisp help (for complete 0-knowledge lisp emacs user :))' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).