From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vladimir Lomov Subject: Re: Bug: Write file while editing babel code block doesn't work as expected [8.3.4 (release_8.3.4-778-g8127b3 @ /usr/local/share/emacs/site-lisp/org/)] Date: Mon, 16 May 2016 10:48:03 +0800 Message-ID: <20160516024803.GC1188@smoon.vl-lomov.ru> References: <87vb2ki8vl.fsf@saiph.selenimh> <87eg969697.fsf@gmail.com> <87d1oq9mxn.fsf@saiph.selenimh> <20160515041152.GA1188@smoon.vl-lomov.ru> <87h9dzwyzw.fsf@saiph.selenimh> <20160515110016.GB1188@smoon.vl-lomov.ru> <87twhzuubm.fsf@saiph.selenimh> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45657) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b28Zn-0005kY-CP for emacs-orgmode@gnu.org; Sun, 15 May 2016 22:48:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b28Zj-0003Wv-48 for emacs-orgmode@gnu.org; Sun, 15 May 2016 22:48:10 -0400 Received: from mail-lb0-x22b.google.com ([2a00:1450:4010:c04::22b]:34287) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b28Zi-0003Wq-SY for emacs-orgmode@gnu.org; Sun, 15 May 2016 22:48:07 -0400 Received: by mail-lb0-x22b.google.com with SMTP id n11so45756865lbh.1 for ; Sun, 15 May 2016 19:48:06 -0700 (PDT) Received: from smoon ([164.215.81.77]) by smtp.gmail.com with ESMTPSA id e187sm1093073lfg.10.2016.05.15.19.48.04 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 May 2016 19:48:05 -0700 (PDT) Content-Disposition: inline In-Reply-To: <87twhzuubm.fsf@saiph.selenimh> 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, ** Nicolas Goaziou [2016-05-15 19:03:57 +0200]: > Hello, > > Vladimir Lomov writes: > >> Correct me if I understand you wrong, but you suggest to bind ~F2~ key >> to ~org-edit-src-save~. But then this will work only in Org buffer, and >> how about LaTeX mode then. Or I should bind ~F2~ to something like that: >> (global-set-key [f2] >> (if (functionp org-edit-src-save) org-edit-src-save save-buffer)) > > Actually, I meant to bind F2 to `org-edit-src-save' in > `org-src-mode-map'. With your advice I came to following code for my init file: #+BEGIN_SRC emacs-lisp (add-hook 'org-src-mode-hook (lambda () (define-key org-src-mode-map [f2] 'org-edit-src-save) ) ) #+END_SRC This works fine, though at first I thought it would be enough to add only following code #+BEGIN_SRC emacs-lisp (define-key org-src-mode-map [f2] 'org-edit-src-save) #+END_SRC into emacs init file. Of course, this don't work and emacs complains about ~org-src-mode-map~. Only one thing bother me: is it normal to add such hook into ~org-src-mode-hook~ ? >> On second thought, I considered org-src buffer as auxiliary buffer, >> depending on (main) Org document buffer, so saving org-src buffer should >> save Org document buffer. > > This is the case already with C-x C-s, not for `save-buffer'. > > Regards, > > -- > Nicolas Goaziou -- "If you can, help others. If you can't, at least don't hurt others." -- the Dalai Lama