emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] [BABEL] Seemless editing of Babel Blocks


From: Eric Schulte
Subject: Re: [Orgmode] [BABEL] Seemless editing of Babel Blocks
Date: Tue, 20 Jul 2010 15:58:07 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

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 <address@hidden> 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 <TAB> 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.
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode



reply via email to

[Prev in Thread] Current Thread [Next in Thread]