From mboxrd@z Thu Jan 1 00:00:00 1970 From: jorge.a.alfaro@gmail.com (Jorge A. Alfaro-Murillo) Subject: org-edit-src-code outside of org Date: Tue, 13 May 2014 16:49:57 -0400 Message-ID: <87y4y55rpm.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33642) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkJeY-00034R-RL for emacs-orgmode@gnu.org; Tue, 13 May 2014 16:50:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WkJeR-0004hf-AT for emacs-orgmode@gnu.org; Tue, 13 May 2014 16:50:22 -0400 Received: from plane.gmane.org ([80.91.229.3]:39903) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkJeR-0004hZ-3O for emacs-orgmode@gnu.org; Tue, 13 May 2014 16:50:15 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1WkJeP-0003VV-Gx for emacs-orgmode@gnu.org; Tue, 13 May 2014 22:50:13 +0200 Received: from 66-87-84-149.pools.spcsdns.net ([66.87.84.149]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 13 May 2014 22:50:13 +0200 Received: from jorge.a.alfaro by 66-87-84-149.pools.spcsdns.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 13 May 2014 22:50:13 +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 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 "") 'mm-org-try-structure-completion))) #+END_SRC which allows me now to do <'a letter' and hit 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?