From: Thorsten Jolitz <tjolitz@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: [RFC] Add commmand for wrapping sexp/region in src-blocks to Org?
Date: Wed, 06 Aug 2014 14:14:04 +0200 [thread overview]
Message-ID: <87sil97r3n.fsf@gmail.com> (raw)
In-Reply-To: CAOQHXPr3XvG+z1UQ--RU+nU8q9436JO49MZy25-zoSVRfVz23Q@mail.gmail.com
Xebar Saram <zeltakc@gmail.com> writes:
> thanks Thorsten
>
> its perfect
well, not perfect yet since, as Nicolas mentioned, it does not cover all
possible use cases (wrap/unwrap/modify ALL kinds of Org blocks with or
without header-line params and with or without affiliated keywords or
with a combination of both).
I got pretty far in implementing this, but spent too much time - maybe I
can deliver the general 'all-inclusive' version later, I hope so, its
useful.
> On Tue, Aug 5, 2014 at 4:15 PM, Thorsten Jolitz <tjolitz@gmail.com>
> wrote:
>
> Xebar Saram <zeltakc@gmail.com> writes:
>
> Hi Xebar,
>
> > small question.
>
> sorry for the late answer
>
>
> > i wonder if i could request a tiny related feature (this may be
> very
> > easy to do already).
> > i would like to assign hotkeys for 2 scenarios:
> >
> > 1) pre selected language for 1 line
> > 2) pre selected language prompting for number of lines to wrap
> >
> > so IE id assign F9-b to auto wrap current line with bash syntax
> while
> > F9-l would wrap in lisp
> > also F10-b would prompt me how man lines to wrap in bash etc
> >
> > is that possible?
>
>
> I think so, I have some predefined calls to that function with
> global
> keybindings in my init file (right now I call it
> `tj/wrap-in-src-block',
> you might have to adapt this):
>
> (global-set-key (kbd "C-c w l")
> (lambda ()
> (interactive)
> (let ((current-prefix-arg '(4)))
> (call-interactively
> 'tj/wrap-in-src-block))))
>
> (global-set-key (kbd "C-c w n")
> (lambda ()
> (interactive)
> (let ((current-prefix-arg '(16)))
> (call-interactively
> 'tj/wrap-in-src-block))))
>
> (global-set-key (kbd "C-c w w") 'tj/wrap-in-src-block)
>
>
>
> > 1) pre selected language for 1 line
>
>
> e.g.
> (global-set-key (kbd "C-c w y")
> (lambda ()
> (interactive)
> (tj/wrap-in-src-block "shell" 1)))
>
>
>
> > 2) pre selected language prompting for number of lines to wrap
>
>
> emacs-lisp is kind of preselected, but you could add this after
> the
> ((equal current-prefix-arg '(16)) ...) part
>
>
> ((equal current-prefix-arg '(64))
> (list
> "shell"
>
> (read-number "Number of lines to wrap: " 1)))
>
>
> and then
>
> (global-set-key (kbd "C-c w z")
> (lambda ()
> (interactive)
> (let ((current-prefix-arg '(64)))
> (call-interactively
> 'tj/wrap-in-src-block))))
>
> everything untested, unfortunately ...
> --
> cheers,
> Thorsten
--
cheers,
Thorsten
next prev parent reply other threads:[~2014-08-06 12:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-29 15:36 [RFC] Add commmand for wrapping sexp/region in src-blocks to Org? Thorsten Jolitz
2014-07-30 9:23 ` Alan Schmitt
2014-08-02 8:44 ` Xebar Saram
2014-08-05 13:15 ` Thorsten Jolitz
2014-08-06 11:43 ` Xebar Saram
2014-08-06 12:14 ` Thorsten Jolitz [this message]
2014-08-06 12:25 ` Xebar Saram
2014-08-02 9:25 ` Nicolas Goaziou
2014-08-05 13:19 ` Thorsten Jolitz
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=87sil97r3n.fsf@gmail.com \
--to=tjolitz@gmail.com \
--cc=emacs-orgmode@gnu.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public 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).