Function: org-protocol-create

org-protocol-create is an interactive and byte-compiled function defined in org-protocol.el.gz.

Signature

(org-protocol-create &optional PROJECT-PLIST)

Documentation

Create a new org-protocol project interactively.

An org-protocol project is an entry in org-protocol-project-alist which is used by org-protocol-open-source. Optionally use PROJECT-PLIST to initialize the defaults for this project. If PROJECT-PLIST is the cdr of an element in org-publish-project-alist, reuse
:base-directory, :html-extension and :base-extension.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-protocol.el.gz
(defun org-protocol-create (&optional project-plist)
  "Create a new org-protocol project interactively.
An org-protocol project is an entry in
`org-protocol-project-alist' which is used by
`org-protocol-open-source'.  Optionally use PROJECT-PLIST to
initialize the defaults for this project.  If PROJECT-PLIST is
the cdr of an element in `org-publish-project-alist', reuse
:base-directory, :html-extension and :base-extension."
  (interactive)
  (let ((working-dir (expand-file-name
		      (or (plist-get project-plist :base-directory)
			  default-directory)))
        (base-url "https://orgmode.org/worg/")
        (strip-suffix (or (plist-get project-plist :html-extension) ".html"))
        (working-suffix (if (plist-get project-plist :base-extension)
                            (concat "." (plist-get project-plist :base-extension))
                          ".org"))
        (insert-default-directory t)
        (minibuffer-allow-text-properties nil))

    (setq base-url (read-string "Base URL of published content: " base-url nil base-url t))
    (or (string-suffix-p "/" base-url)
	(setq base-url (concat base-url "/")))

    (setq working-dir
          (expand-file-name
           (read-directory-name "Local working directory: " working-dir working-dir t)))
    (or (string-suffix-p "/" working-dir)
	(setq working-dir (concat working-dir "/")))

    (setq strip-suffix
          (read-string
           (concat "Extension to strip from published URLs (" strip-suffix "): ")
	   strip-suffix nil strip-suffix t))

    (setq working-suffix
          (read-string
           (concat "Extension of editable files (" working-suffix "): ")
	   working-suffix nil working-suffix t))

    (when (yes-or-no-p "Save the new org-protocol-project to your init file? ")
      (setq org-protocol-project-alist
            (cons `(,base-url . (:base-url ,base-url
					   :working-directory ,working-dir
					   :online-suffix ,strip-suffix
					   :working-suffix ,working-suffix))
                  org-protocol-project-alist))
      (customize-save-variable 'org-protocol-project-alist org-protocol-project-alist))))