emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-edit-src-code outside of org
@ 2014-05-13 20:49 Jorge A. Alfaro-Murillo
  2014-05-13 20:58 ` Ken Mankoff
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Jorge A. Alfaro-Murillo @ 2014-05-13 20:49 UTC (permalink / raw)
  To: emacs-orgmode

Hi, I would like to use org-edit-src-code outside of org, I think it
would be very handy in Message mode, to send messages that contain code
and edit that code in the proper mode.

I put something like this

     #+BEGIN_SRC emacs-lisp
       (defun mm-org-try-structure-completion ()
         (interactive)
         (if (not (org-try-structure-completion))
             (message-tab)))
       (eval-after-load "message"
         '(progn
            (define-key message-mode-map (kbd "<tab>")
            'mm-org-try-structure-completion)))
     #+END_SRC

which allows me now to do <'a letter' and hit <tab> and get a the proper
source block just as in org.

I can enter the editing of the source block without problems with
org-edit-src-code (which I plan to bind to C-c ', just as in org),
however when I am want to close the editing and go back to the message
buffer it fails, specifically the part of org-edit-src-exit that says:

     #+BEGIN_SRC emacs-lisp
       (unless (org-bound-and-true-p org-edit-src-from-org-mode)
          (error "This is not a sub-editing buffer, something is wrong"))
     #+END_SRC
          
Is there a particular reason why the code has to check to see if it is
coming from org-mode? Shouldn't it be enough that already the
org-in-block-p was passed?

If I evaluate the function definition of org-edit-src-exit without the
last part everything works as expect, I can exit with C-c ' and the code
is there. Even doing C-x C-s before exiting works as well.

Best,

Jorge.

PS: What is the alternative when you write messages with code, do you
guys first write it in org and then copy and yank it?

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-05-27  8:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-13 20:49 org-edit-src-code outside of org Jorge A. Alfaro-Murillo
2014-05-13 20:58 ` Ken Mankoff
2014-05-13 21:12   ` Jorge A. Alfaro-Murillo
2014-05-14 13:44 ` Hubert Chathi
2014-05-17  6:33   ` Jorge A. Alfaro-Murillo
2014-05-17  8:23     ` Alexander Baier
2014-05-27  8:32 ` Thorsten Jolitz

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).