From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: [BABEL] Seemless editing of Babel Blocks Date: Tue, 20 Jul 2010 15:58:07 -0700 Message-ID: <87k4opu5fk.fsf@gmail.com> References: <4C459236.3@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=54816 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ObLlM-0000WN-Fb for emacs-orgmode@gnu.org; Tue, 20 Jul 2010 18:58:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1ObLlL-0002zf-3Q for emacs-orgmode@gnu.org; Tue, 20 Jul 2010 18:58:12 -0400 Received: from mail-pz0-f41.google.com ([209.85.210.41]:40845) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ObLlK-0002zW-OF for emacs-orgmode@gnu.org; Tue, 20 Jul 2010 18:58:11 -0400 Received: by pzk33 with SMTP id 33so4668596pzk.0 for ; Tue, 20 Jul 2010 15:58:09 -0700 (PDT) In-Reply-To: <4C459236.3@gmail.com> (Jambunathan K.'s message of "Tue, 20 Jul 2010 17:40:30 +0530") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Jambunathan K Cc: emacs-orgmode@gnu.org Hi Jambunathan, I like the idea of displaying the begin/end_src lines as commented sections in the org-edit-special code buffer, and then potentially using them to change the values of the begin/end_src lines in the original org-mode buffer after exiting the src-edit buffer. It would be very cool to be able to edit header arguments while editing source code. It may be hard to implement, but could be worth the effort. I'm afraid I don't see how the code snippet you pasted below could be applied, could you reformat it as a patch to Org-mode with usage instructions? As for different key-bindings for exiting src edit buffers, you could certainly setup your own in your personal configuration using the org-src-mode-hook. Thanks for the neat idea -- Eric Jambunathan K writes: > I am presenting a code snippet that would make editing of babel blocks > quite seemless. The editor parallels (inline!) editing of table > blocks. A suitable variation thereof could be considered for inclusion > in the core distribution. > > Few other suggestions: > 1. While invoking babel editor, offer babel guard lines as comment > blocks in the native mode. > > 2. On saving code blocks, do the reverse. > > For example, in case of emacs-lisp > > #+begin_src emacs_lisp: > (message "Hello World") > #+end_src > > could be offered as: > > ;; begin_src emacs_lisp: > (message "Hello World") > ;; end_src > > One could then add say a ':tangle ...' directive and have it persisted > as > > #+begin_src emacs_lisp: :tangle HelloWorld.el > (message "Hello World") > #+end_src > > 2. Is it possible to do org-edit-src-exit with more 'natural' > keybinding like C-x C-w or C-x C-s. Furthermore, C-x C-w could fix > up '#+srcname: ' directive as well. > > > ;; CODE SNIPPET > > ;; make org-cycle look for babel blocks > ((org-at-babel-p) > (call-interactively 'org-edit-special)) > > ;; A semicolon followed by would invoke the babel editor. > ;; A tab within the babel block would invoke the babel editor. > > (defconst org-babel-invoke-editor-regexp "^[ \t]*\\(;\\)" > "Detect beginning of babel src code") > > (defun org-at-babel-p () > "" > (beginning-of-line 1) > > (cond > ((looking-at org-babel-invoke-editor-regexp) > (unless (org-babel-where-is-src-block-head) > (insert "#+begin_src emacs-lisp :\n\n") > > (insert "#+end_src") > (kill-line) > (forward-line -1) > t) > ) > > ((org-babel-where-is-src-block-head) t) > (t nil) > ) > ) > I have no idea how/where the above could be applied. > > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode