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.
This commit is contained in:
Dan Davison 2010-10-12 11:52:29 +01:00
parent c354cb8eff
commit 70e52ba9ac
1 changed files with 14 additions and 9 deletions

View File

@ -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.