branch: elpa/org-auto-tangle
commit d3036a040a4f9a448e3c1317a1d46b7e9886b1d8
Author: Unknown <[email protected]>
Commit: Unknown <[email protected]>
moved the method definations to top level to remove error warnings
---
org-auto-tangle.el | 53 +++++++++++++++++++++++++++--------------------------
1 file changed, 27 insertions(+), 26 deletions(-)
diff --git a/org-auto-tangle.el b/org-auto-tangle.el
index 08bcd19fe0..781c8452d4 100644
--- a/org-auto-tangle.el
+++ b/org-auto-tangle.el
@@ -59,35 +59,36 @@
:type 'boolean
:group 'auto-tangle)
+(defun org-auto-tangle-find-value (buffer)
+ "Search the `auto_tangle' property in BUFFER and extracts it when found."
+ (with-current-buffer buffer
+ (save-restriction
+ (widen)
+ (save-excursion
+ (goto-char (point-min))
+ (when (re-search-forward "^#\\+auto_tangle: \\(.*\\)" nil :noerror)
+ (match-string 1))))))
+
+(defun org-auto-tangle-async (file)
+ "Invoke `org-babel-tangle-file' asynchronously."
+ (message "Tangling %s..." (buffer-file-name))
+ (async-start
+ (let ((args (list file)))
+ `(lambda ()
+ (require 'org)
+ (let ((start-time (current-time)))
+ (apply #'org-babel-tangle-file ',args)
+ (format "%.2f" (float-time (time-since start-time))))))
+ (let ((message-string (format "Tangling %S completed after " file)))
+ `(lambda (tangle-time)
+ (message (concat ,message-string
+ (format "%s seconds" tangle-time)))))))
+
+
+
(add-hook 'org-mode-hook
(lambda ()
(when org-auto-tangle-tangle-on-save
- (defun org-auto-tangle-find-value (buffer)
- "Search the `auto_tangle' property in BUFFER and extracts it
when found."
- (with-current-buffer buffer
- (save-restriction
- (widen)
- (save-excursion
- (goto-char (point-min))
- (when (re-search-forward "^#\\+auto_tangle: \\(.*\\)" nil
:noerror)
- (match-string 1))))))
-
-
- (defun org-auto-tangle-async (file)
- "Invoke `org-babel-tangle-file' asynchronously."
- (message "Tangling %s..." (buffer-file-name))
- (async-start
- (let ((args (list file)))
- `(lambda ()
- (require 'org)
- (let ((start-time (current-time)))
- (apply #'org-babel-tangle-file ',args)
- (format "%.2f" (float-time (time-since start-time))))))
- (let ((message-string (format "Tangling %S completed after "
file)))
- `(lambda (tangle-time)
- (message (concat ,message-string
- (format "%s seconds" tangle-time)))))))
-
(add-hook 'after-save-hook
(lambda () (when (and (org-auto-tangle-find-value
(current-buffer))
(not (string=
(org-auto-tangle-find-value(current-buffer)) "nil")))