From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thorsten Jolitz Subject: Re: [RFC] Add commmand for wrapping sexp/region in src-blocks to Org? Date: Tue, 05 Aug 2014 15:15:56 +0200 Message-ID: <87zjfjulf7.fsf@gmail.com> References: <87k36wqirh.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56763) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEebE-0006SA-Fq for emacs-orgmode@gnu.org; Tue, 05 Aug 2014 09:16:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XEeb7-00050l-0T for emacs-orgmode@gnu.org; Tue, 05 Aug 2014 09:16:20 -0400 Received: from plane.gmane.org ([80.91.229.3]:38407) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEeb6-0004zF-Pi for emacs-orgmode@gnu.org; Tue, 05 Aug 2014 09:16:12 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XEeb4-0006tV-Ig for emacs-orgmode@gnu.org; Tue, 05 Aug 2014 15:16:10 +0200 Received: from e178062049.adsl.alicedsl.de ([85.178.62.49]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 05 Aug 2014 15:16:10 +0200 Received: from tjolitz by e178062049.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 05 Aug 2014 15:16:10 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Xebar Saram 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