emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Bug: Write file while editing babel code block doesn't work as e


From: Vladimir Lomov
Subject: Re: [O] 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
User-agent: Mutt/1.6.1 (2016-04-27)

Hello,
** Nicolas Goaziou [2016-05-15 19:03:57 +0200]:

> Hello,
> 
> Vladimir Lomov <address@hidden> 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



reply via email to

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