summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Davison <davison@stats.ox.ac.uk>2010-10-12 11:52:29 +0100
committerDan Davison <davison@stats.ox.ac.uk>2010-10-12 11:57:29 +0100
commit70e52ba9ac15c95a49ca2052438b3d9680b1f8b3 (patch)
treebe75b4066b66eb8267e9af8a0098c1855d6c80e9
parentc354cb8effa3a93273b40423cae2f5c57eea78c0 (diff)
downloadorg-mode-70e52ba9ac15c95a49ca2052438b3d9680b1f8b3.tar.gz
babel: `org-babel-lob-ingest': message reporting number of src blocks added
* ob-lob.el (org-babel-lob-ingest): Provide message stating number of blocks added to Library of Babel.
-rw-r--r--lisp/ob-lob.el23
1 files changed, 14 insertions, 9 deletions
diff --git a/lisp/ob-lob.el b/lisp/ob-lob.el
index 857e43f..e88bd87 100644
--- a/lisp/ob-lob.el
+++ b/lisp/ob-lob.el
@@ -45,16 +45,21 @@ To add files to this list use the `org-babel-lob-ingest' command."
;;;###autoload
(defun org-babel-lob-ingest (&optional file)
- "Add all source-blocks defined in FILE to `org-babel-library-of-babel'."
+ "Add all named source-blocks defined in FILE to
+`org-babel-library-of-babel'."
(interactive "f")
- (org-babel-map-src-blocks file
- (let* ((info (org-babel-get-src-block-info))
- (source-name (nth 4 info)))
- (when source-name
- (setq source-name (intern source-name)
- org-babel-library-of-babel
- (cons (cons source-name info)
- (assq-delete-all source-name org-babel-library-of-babel)))))))
+ (let ((lob-ingest-count 0))
+ (org-babel-map-src-blocks file
+ (let* ((info (org-babel-get-src-block-info))
+ (source-name (nth 4 info)))
+ (when source-name
+ (setq source-name (intern source-name)
+ org-babel-library-of-babel
+ (cons (cons source-name info)
+ (assq-delete-all source-name org-babel-library-of-babel))
+ lob-ingest-count (1+ lob-ingest-count)))))
+ (message "%d src block%s added to Library of Babel"
+ lob-ingest-count (if (> lob-ingest-count 1) "s" ""))))
(defconst org-babel-lob-call-aliases '("lob" "call")
"Aliases to call a source block function.