branch: elpa/org-auto-tangle
commit b9c28533ee362dbb132c7a534ac4bfe5db6d3c48
Author: lispy-dobby <[email protected]>
Commit: lispy-dobby <[email protected]>
added a remove-hook if org-auto-tangle-mode is nil
---
org-auto-tangle.el | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/org-auto-tangle.el b/org-auto-tangle.el
index df531e9d22..09a9454c20 100644
--- a/org-auto-tangle.el
+++ b/org-auto-tangle.el
@@ -81,7 +81,8 @@
(defun org-auto-tangle-tangle-if-tag-exists ()
"Check if the #+auto_tangle option exists and call org-auto-tangle-async if
it exists."
- (when (and (org-auto-tangle-find-value (current-buffer))
+ (when (and (string= (buffer-local-value 'major-mode (current-buffer))
"org-mode")
+ (org-auto-tangle-find-value (current-buffer))
(not (string= (org-auto-tangle-find-value(current-buffer)) "nil")))
(org-auto-tangle-async (buffer-file-name))))
@@ -89,11 +90,10 @@
"Automatically tangle org-mode files with the option #+auto_tangle: t."
:lighter " org-a-t"
- (when org-auto-tangle-mode
- (add-hook 'org-mode-hook
- (add-hook 'after-save-hook
- (org-auto-tangle-tangle-if-tag-exists)
- nil 'local))))
+ (if org-auto-tangle-mode
+ (add-hook 'after-save-hook 'org-auto-tangle-tangle-if-tag-exists
+ nil 'local)
+ (remove-hook 'after-save-hook 'org-auto-tangle-tangle-if-tag-exists)))
(provide 'org-auto-tangle)