From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thorsten Jolitz Subject: Re: function for inserting a block Date: Sun, 10 Dec 2017 10:36:59 +0100 Message-ID: <87mv2qores.fsf@gmail.com> References: <877exghblx.fsf@ericabrahamsen.net> <87po9q2e8k.fsf@nicolasgoaziou.fr> <87tvyyvpst.fsf@ericabrahamsen.net> <87fuaiz069.fsf@nicolasgoaziou.fr> <87lgk9eo4d.fsf@ericabrahamsen.net> <87fuahxxvs.fsf@nicolasgoaziou.fr> <87r2u1cuwj.fsf@ericabrahamsen.net> <87infdctzq.fsf@ericabrahamsen.net> <87k1zsbizs.fsf@ericabrahamsen.net> <87k1zp4rxj.fsf@ericabrahamsen.net> <871slx4j6p.fsf@ericabrahamsen.net> <87r2ttoq5k.fsf@ericabrahamsen.net> <871sltst0t.fsf@nicolasgoaziou.fr> <87y3o14cul.fsf@ericabrahamsen.net> <87po9czqy8.fsf@nicolasgoaziou.fr> <87she2rjqr.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53578) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eNy2u-0001K7-R6 for emacs-orgmode@gnu.org; Sun, 10 Dec 2017 04:37:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eNy2r-0004VZ-OM for emacs-orgmode@gnu.org; Sun, 10 Dec 2017 04:37:16 -0500 Received: from [195.159.176.226] (port=48543 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eNy2r-0004Uo-H5 for emacs-orgmode@gnu.org; Sun, 10 Dec 2017 04:37:13 -0500 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1eNy2i-0000mW-9K for emacs-orgmode@gnu.org; Sun, 10 Dec 2017 10:37:04 +0100 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" To: emacs-orgmode@gnu.org Hello, this is a long thread so I did not read everything, just want to mention that in org-dp.el I did something similar using - tempo templates (for a programmer who wants to insert an org-dp-create call in his emacs-lisp program) and - a universal (org) prompt function for a user who wants to insert a src-block in his org file. This one for productive use in emacs-lisp programs (note that there is tab completion for values): ,----[ C-h f tempo-template-org-dp-create RET ] | tempo-template-org-dp-create is an interactive Lisp function. | | (tempo-template-org-dp-create &optional ARG) | | Insert org-dp-create template. | | [back] `---- This one with comments to give a bit more explanation to the programmer: ,----[ C-h f tempo-template-org-dp-create-with-comments RET ] | tempo-template-org-dp-create-with-comments is an interactive Lisp | function. | | (tempo-template-org-dp-create-with-comments &optional ARG) | | Insert org-dp-create template. | | [back] `---- This one is on the user level (in org files), C-c w w ist just my personnal key binding from my .emacs: ,----[ C-h f org-dp-wrap-in-block RET ] | org-dp-wrap-in-block is an interactive Lisp function in | ‘org-dp-lib.el’. | | It is bound to C-c w w. | | (org-dp-wrap-in-block &optional LINES USER-INFO &rest PROMPT-SPEC) | | Wrap sexp-at-point or region in Org block. | | A region instead of the sexp-at-point is wrapped if either | | - optional arg LINES is an (positive or negative) integer or | | - the region is active | | In the first case the region is determined by moving LINES lines | up (LINES is positive) or down (LINES is negative) from point | using ‘forward-line’, in the second case the active region is | used. | | If point is already inside of a block, modify it or unwrap its | content/value instead of wrapping it in another block, except if | explicitly asked for by user. | | If USER-INFO is given, it should be a list in the format returned | by ‘org-dp-prompt-all’, i.e. | | (elem-type contents replace affiliated args) | | Look up that function’s docstring for more information about the | list’s elements. A non-nil USER-INFO suppresses calls to | ‘org-dp-prompt-all’ and is used instead of its return value. | | Possible &rest PROMPT-SPEC should be keyword/value pairs used for | restricting user-prompting via ‘org-dp-prompt-all’, e.g. | | :noprompt-affiliated t :noprompt-replace t | | see the docstring of that function for more info. | | [back] `---- org-dp-prompt-all is the universal function, with &rest argument PROMPT-SPEC you can reduce the prompting and such easily create your own specific 'wrap in block' utility commands without much programming. Hope this is not off-topic. -- cheers, Thorsten