Function: org-attach-buffer

org-attach-buffer is an interactive and byte-compiled function defined in org-attach.el.gz.

Signature

(org-attach-buffer BUFFER-NAME)

Documentation

Attach BUFFER-NAME's contents to current outline node.

BUFFER-NAME is a string. Signals a file-already-exists error if it would overwrite an existing filename.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-attach.el.gz
(defun org-attach-buffer (buffer-name)
  "Attach BUFFER-NAME's contents to current outline node.
BUFFER-NAME is a string.  Signals a `file-already-exists' error
if it would overwrite an existing filename."
  (interactive "bBuffer whose contents should be attached: ")
  (let* ((attach-dir (org-attach-dir 'get-create))
	 (output (expand-file-name buffer-name attach-dir)))
    (when (file-exists-p output)
      (signal 'file-already-exists (list "File exists" output)))
    (run-hook-with-args 'org-attach-after-change-hook attach-dir)
    (org-attach-tag)
    (with-temp-file output
      (insert-buffer-substring buffer-name))))