Some functions for emacs muse
(defcustom muse-post-register ?R
  "The register in which the window configuration is stored."
  :type 'character
  :group 'muse-post)

(defcustom muse-post-header
  "#title\n#author (Tiago Charters de Azevedo)\n#desc\n#keywords\n"

(defun muse-insert-date ()
  (insert "#date " (format-time-string "%y%m%d\n")))

(defvar muse-post-buffer "*muse post*"
  "The name of the muse post buffer.")

(defun muse-post (&optional initial)
   (list (when current-prefix-arg
           (buffer-substring (point) (mark)))))
  (window-configuration-to-register muse-post-register)
  (get-buffer-create muse-post-buffer)
  (switch-to-buffer-other-window muse-post-buffer)
  (goto-char (point-min))
  (when initial
    (insert initial))
  (goto-char (point-min))
  (insert muse-post-header)

(defun muse-post-buffer-desc ()
  "Using the first line of the current buffer."
    (let ((post (buffer-substring (point-min)
                                    (goto-char (point-min))
                                    (if (> (- (point) (point-min)) 60)
                                        (goto-char (+ (point-min) 60)))

      (muse-post post)))

(defun muse-post-clipboard ()
  "Post to muse the contents of the current clipboard.
Most useful for posting things from any where."
  (muse-post (current-kill 0)))

(defun muse-post-destroy ()
  "Destroy the current muse post buffer."
  (when (equal muse-post-buffer (buffer-name))
    (kill-buffer (current-buffer))
    (jump-to-register muse-post-register)))

(defun muse-short-url (url)
  "Short URL function, uses"
  (interactive "M")
  (let ((url-request-method "GET"))
    (url-retrieve (concat "" url)
                   (lambda (x)
                     (goto-char (point-min))
                     (search-forward-regexp "http://.*")
                     (setq s-url (match-string-no-properties 0))))
   (insert s-url)))

(provide 'muse-post)

Palavras chave/keywords: muse, emacs, muse

Criado/Created: NaN

Última actualização/Last updated: 13-07-2018 [09:50]

Voltar à página inicial.

GNU/Emacs Creative Commons License

(c) Tiago Charters de Azevedo