summaryrefslogtreecommitdiff
path: root/lisp/org/org-src.el
diff options
context:
space:
mode:
authorBastien Guerry <bzg@gnu.org>2014-10-03 10:13:51 +0200
committerBastien Guerry <bzg@gnu.org>2014-10-03 10:13:51 +0200
commita81e5de3a34d27cea43d49ffdfd9755f0eddb262 (patch)
tree94d0e2b93f054d2cc9f7f7dc5423561ea3c00a2c /lisp/org/org-src.el
parente197284d4789d7caa613fc406516f58fbec02547 (diff)
downloademacs-a81e5de3a34d27cea43d49ffdfd9755f0eddb262.tar.gz
emacs-a81e5de3a34d27cea43d49ffdfd9755f0eddb262.tar.bz2
emacs-a81e5de3a34d27cea43d49ffdfd9755f0eddb262.zip
Sync with Org 8.2.8.
Diffstat (limited to 'lisp/org/org-src.el')
-rw-r--r--lisp/org/org-src.el37
1 files changed, 16 insertions, 21 deletions
diff --git a/lisp/org/org-src.el b/lisp/org/org-src.el
index f870b2c714d..752fa30bd12 100644
--- a/lisp/org/org-src.el
+++ b/lisp/org/org-src.el
@@ -376,23 +376,21 @@ the display of windows containing the Org buffer and the code buffer."
(when (fboundp edit-prep-func)
(funcall edit-prep-func full-info)))
(or org-edit-src-code-timer
+ (zerop org-edit-src-auto-save-idle-delay)
(setq org-edit-src-code-timer
- (unless (zerop org-edit-src-auto-save-idle-delay)
- (run-with-idle-timer
- org-edit-src-auto-save-idle-delay t
- (lambda ()
- (cond
- ((and (string-match "\*Org Src" (buffer-name))
- (buffer-modified-p))
- (org-edit-src-save))
- ((not
- (delq nil (mapcar
- (lambda (b)
- (string-match "\*Org Src" (buffer-name b)))
- (buffer-list))))
- (cancel-timer org-edit-src-code-timer)
- (setq org-edit-src-code-timer)))))))))
- t)))
+ (run-with-idle-timer
+ org-edit-src-auto-save-idle-delay t
+ (lambda ()
+ (cond
+ ((org-string-match-p "\\`\\*Org Src" (buffer-name))
+ (when (buffer-modified-p) (org-edit-src-save)))
+ ((not (org-some (lambda (b)
+ (org-string-match-p "\\`\\*Org Src"
+ (buffer-name b)))
+ (buffer-list)))
+ (cancel-timer org-edit-src-code-timer)
+ (setq org-edit-src-code-timer nil))))))))
+ t)))
(defun org-edit-src-continue (e)
"Continue editing source blocks." ;; Fixme: be more accurate
@@ -757,8 +755,8 @@ with \",*\", \",#+\", \",,*\" and \",,#+\"."
(delete-region beg (max beg end))
(unless (string-match "\\`[ \t]*\\'" code)
(insert code))
- ;; Make sure the overlay stays in place
- (when (eq context 'save) (move-overlay ovl beg (point)))
+ ;; Make sure the overlay stays in place
+ (when (eq context 'save) (move-overlay ovl beg (point)))
(goto-char beg)
(if single (just-one-space)))
(if (memq t (mapcar (lambda (overlay)
@@ -774,9 +772,6 @@ with \",*\", \",#+\", \",,*\" and \",,#+\"."
(unless (eq context 'save)
(move-marker beg nil)
(move-marker end nil)))
- (when org-edit-src-code-timer
- (cancel-timer org-edit-src-code-timer)
- (setq org-edit-src-code-timer nil))
(unless (eq context 'save)
(when org-edit-src-saved-temp-window-config
(set-window-configuration org-edit-src-saved-temp-window-config)