|
From: | Xebar Saram |
Subject: | Re: [O] [RFC] Add commmand for wrapping sexp/region in src-blocks to Org? |
Date: | Wed, 6 Aug 2014 14:43:37 +0300 |
Xebar Saram <address@hidden> writes:
Hi Xebar,
> small question.
sorry for the late answer
I think so, I have some predefined calls to that function with global
> 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?
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)
e.g.
> 1) pre selected language for 1 line
(global-set-key (kbd "C-c w y")
(lambda ()
(interactive)
(tj/wrap-in-src-block "shell" 1)))
emacs-lisp is kind of preselected, but you could add this after the
> 2) pre selected language prompting for number of lines to wrap
((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
[Prev in Thread] | Current Thread | [Next in Thread] |