forked from mirrors/org-mode
org-src.el (org-edit-src-turn-on-auto-save): New option
* org-src.el (org-edit-src-turn-on-auto-save): New option. (org-edit-src-code): Use it. (org-edit-src-auto-save-idle-delay): Enhance docstring. * doc/org.texi (Editing source code): Document `org-edit-src-auto-save-idle-delay' and `org-edit-src-turn-on-auto-save'. Thanks to Charles C. Berry for bringing this up again.
This commit is contained in:
parent
f20de09dcb
commit
7790a97cdd
13
doc/org.texi
13
doc/org.texi
|
@ -13465,11 +13465,16 @@ Source code in the specified language.
|
|||
@cindex code block, editing
|
||||
@cindex source code, editing
|
||||
|
||||
@vindex org-edit-src-auto-save-idle-delay
|
||||
@vindex org-edit-src-turn-on-auto-save
|
||||
@kindex C-c '
|
||||
Use @kbd{C-c '} to edit the current code block. This brings up
|
||||
a language major-mode edit buffer containing the body of the code
|
||||
block. Saving this buffer will write the new contents back to the Org
|
||||
buffer. Use @kbd{C-c '} again to exit.
|
||||
Use @kbd{C-c '} to edit the current code block. This brings up a language
|
||||
major-mode edit buffer containing the body of the code block. Manually
|
||||
saving this buffer with @key{C-x C-s} will write the contents back to the Org
|
||||
buffer. You can also set @var{org-edit-src-auto-save-idle-delay} to save the
|
||||
base buffer after some idle delay, or @code{org-edit-src-turn-on-auto-save}
|
||||
to auto-save this buffer into a separate file using @code{auto-save-mode}.
|
||||
Use @kbd{C-c '} again to exit.
|
||||
|
||||
The @code{org-src-mode} minor mode will be active in the edit buffer. The
|
||||
following variables can be used to configure the behavior of the edit
|
||||
|
|
|
@ -64,10 +64,25 @@ there are kept outside the narrowed region."
|
|||
(const :tag "from `lang' element")
|
||||
(const :tag "from `style' element")))))
|
||||
|
||||
(defcustom org-edit-src-turn-on-auto-save nil
|
||||
"Non-nil means turn `auto-save-mode' on when editing a source block.
|
||||
This will save the content of the source code editing buffer into
|
||||
a newly created file, not the base buffer for this source block.
|
||||
|
||||
If you want to regularily save the base buffer instead of the source
|
||||
code editing buffer, see `org-edit-src-auto-save-idle-delay' instead."
|
||||
:group 'org-edit-structure
|
||||
:version "24.4"
|
||||
:package-version '(Org . "8.0")
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom org-edit-src-auto-save-idle-delay 0
|
||||
"Delay of idle time before auto-saving src code buffers.
|
||||
"Delay before saving a source code buffer back into its base buffer.
|
||||
When a positive integer N, save after N seconds of idle time.
|
||||
When 0 (the default), don't auto-save."
|
||||
When 0 (the default), don't auto-save.
|
||||
|
||||
If you want to save the source code buffer itself, don't use this.
|
||||
Check `org-edit-src-turn-on-auto-save' instead."
|
||||
:group 'org-edit-structure
|
||||
:version "24.4"
|
||||
:package-version '(Org . "8.0")
|
||||
|
@ -351,7 +366,7 @@ the display of windows containing the Org buffer and the code buffer."
|
|||
(org-src-mode)
|
||||
(set-buffer-modified-p nil)
|
||||
(setq buffer-file-name nil)
|
||||
(when auto-save-default
|
||||
(when org-edit-src-turn-on-auto-save
|
||||
(setq buffer-auto-save-file-name
|
||||
(concat (make-temp-name "org-src-")
|
||||
(format-time-string "-%Y-%d-%m") ".txt")))
|
||||
|
|
Loading…
Reference in New Issue