Function: org-mobile-move-capture

org-mobile-move-capture is an interactive and byte-compiled function defined in org-mobile.el.gz.

Signature

(org-mobile-move-capture)

Documentation

Move the contents of the capture file to the inbox file.

Return a marker to the location where the new content has been added. If nothing new has been added, return nil.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-mobile.el.gz
(defun org-mobile-move-capture ()
  "Move the contents of the capture file to the inbox file.
Return a marker to the location where the new content has been added.
If nothing new has been added, return nil."
  (interactive)
  (let* ((encfile nil)
	 (capture-file (expand-file-name org-mobile-capture-file
					 org-mobile-directory))
	 (inbox-buffer (find-file-noselect org-mobile-inbox-for-pull))
	 (capture-buffer
	  (if (not org-mobile-use-encryption)
	      (find-file-noselect capture-file)
	    (org-mobile-cleanup-encryption-tempfile)
	    (setq encfile (concat org-mobile-encryption-tempfile "_enc"))
	    (copy-file capture-file encfile)
	    (org-mobile-decrypt-file encfile org-mobile-encryption-tempfile)
	    (find-file-noselect org-mobile-encryption-tempfile)))
	 (insertion-point (make-marker))
	 not-empty content)
    (with-current-buffer capture-buffer
      (setq content (buffer-string))
      (setq not-empty (string-match "\\S-" content))
      (when not-empty
	(set-buffer inbox-buffer)
	(widen)
	(goto-char (point-max))
	(or (bolp) (newline))
	(move-marker insertion-point
		     (prog1 (point) (insert content)))
	(save-buffer)
	(set-buffer capture-buffer)
	(erase-buffer)
	(save-buffer)
	(org-mobile-update-checksum-for-capture-file (buffer-string))))
    (kill-buffer capture-buffer)
    (when org-mobile-use-encryption
      (org-mobile-encrypt-and-move org-mobile-encryption-tempfile
				   capture-file)
      (org-mobile-cleanup-encryption-tempfile))
    (if not-empty insertion-point)))