瀏覽代碼

added litorgy-eval-buffer function

Eric Schulte 17 年之前
父節點
當前提交
fbb141f72e
共有 1 個文件被更改,包括 9 次插入3 次删除
  1. 9 3
      litorgy/litorgy.el

+ 9 - 3
litorgy/litorgy.el

@@ -95,14 +95,20 @@ don't dump results into buffer."
     (setq result (funcall cmd body params))
     (unless arg (litorgy-insert-result result (assoc :replace params)))))
 
+(defun litorgy-eval-buffer (&optional arg)
+  "Replace EVAL snippets in the entire buffer."
+  (interactive "P")
+  (save-excursion
+    (goto-char (point-min))
+    (while (re-search-forward litorgy-regexp nil t)
+      (litorgy-eval-src-block arg))))
+
 (defun litorgy-eval-subtree (&optional arg)
   "Replace EVAL snippets in the entire subtree."
   (interactive "P")
   (save-excursion
     (org-narrow-to-subtree)
-    (goto-char (point-min))
-    (while (re-search-forward litorgy-regexp nil t)
-      (litorgy-eval-src-block arg))
+    (litorgy-eval-buffer)
     (widen)))
 
 (defun litorgy-get-src-block-info ()