✍ Muse-post

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 tca@diale.org (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 is.gd."
  (interactive "M")
  (let ((url-request-method "GET"))
    (url-retrieve (concat "http://is.gd/create.php?format=simple&url=" 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

Última actualização/Last updated: 2014-11-13 [00:04]

1999-2014 (ç) Tiago Charters de Azevedo

São permitidas cópias textuais parciais/integrais em qualquer meio com/sem alterações desde que se mantenha este aviso.

Verbatim copying and redistribution of this entire page are permitted provided this notice is preserved.