emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/org-auto-tangle 2e4a664210 19/56: moved the anonymous func


From: ELPA Syncer
Subject: [nongnu] elpa/org-auto-tangle 2e4a664210 19/56: moved the anonymous function inside the hooks to a named function
Date: Mon, 6 Jun 2022 11:58:52 -0400 (EDT)

branch: elpa/org-auto-tangle
commit 2e4a6642109f04e6097623a00ed3408abfb7d1de
Author: lispy-dobby <yilkalargawworkneh@gmail.com>
Commit: lispy-dobby <yilkalargawworkneh@gmail.com>

    moved the anonymous function inside the hooks to a named function
---
 org-auto-tangle.el | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/org-auto-tangle.el b/org-auto-tangle.el
index e31eb90e00..d957f1854c 100644
--- a/org-auto-tangle.el
+++ b/org-auto-tangle.el
@@ -79,6 +79,13 @@
        (message (concat ,message-string
                         (format "%s seconds" tangle-time)))))))
 
+(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))
+            (not (string= (org-auto-tangle-find-value(current-buffer)) "nil")))
+    (org-auto-tangle-async (buffer-file-name)))
+  )
+
 (define-minor-mode org-auto-tangle-mode
   "Automatically tangle org-mode files with the option #+auto_tangle: t."
   :lighter " org-a-t"
@@ -86,10 +93,8 @@
   (when org-auto-tangle-mode
     (add-hook 'org-mode-hook
              (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")))
-                                    (org-auto-tangle-async 
(buffer-file-name)))))
-             nil 'local)))
+                       (org-auto-tangle-tangle-if-tag-exists)
+                       nil 'local))))
 
 (provide 'org-auto-tangle)
 



reply via email to

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