Some settings for Gnus caching (same as default values).
;;; stmcrblog-mode.el --- static micro-blogging engine from Emacs
;; Copyright (C) 2011 by Oleksandr Gavenko <gavenkoa@gmail.com>
;; You can do anything with this file without any warranty.
;; Author: Oleksandr Gavenko <gavenkoa@gmail.com>
;; Maintainer: Oleksandr Gavenko <gavenkoa@gmail.com>
;; Created: 2011-11-10
;; Version: 0.1
;; Keywords: blog, microblog, blogging, gtd
;;; Commentary:
;;
;; Very pure release.
;;
;; Depricated. Use 'jdone' mode.
;;; Code:
(defconst stmcrblog-major-version 0
"stmcrblog major version.")
(defconst stmcrblog-minor-version 1
"stmcrblog major version.")
(defun stmcrblog-version (&optional here)
"Return stmcrblog version."
(interactive "P")
(let ( (version-string (format "stmcrblog %d.%d" stmcrblog-major-version stmcrblog-minor-version)) )
(if here
(insert version-string)
(if (called-interactively-p 'interactive)
(message "%s" version-string)
version-string))
))
(defvar stmcrblog-file "~/.stmcrblog"
"Blog entries storage file name.")
(defvar stmcrblog-after-add-entry-hook nil
"`stmcrblog-after-add-entry-hook' called after adding entries.
You can use this hook to render and publish `stmcrblog-file'.")
(defun stmcrblog-add-entry (msg)
"Add post to blog.
Automatically set time to current value. Only first line of MSG
was added.
`stmcrblog-after-add-entry-hook' called after adding entries. You
can use this hook to render and publish `stmcrblog-file'."
(let (
(coding-system-for-read 'utf-8)
(coding-system-for-write 'utf-8)
pos
)
(setq pos (string-match "\n" msg))
(when pos
(setq msg (substring msg 0 pos)))
(save-excursion ;save-window-excursion
(find-file stmcrblog-file)
(beginning-of-buffer)
(insert
(format-time-string "%Y-%m-%d %H:%M" (current-time))
" "
msg
"\n")
(save-buffer)
(kill-buffer)
)
(run-hooks 'stmcrblog-after-add-entry-hook)
))
(defvar stmcrblog-buffer-name "*stmcrblog-entry*"
"`stmcrblog' buffer name for composing editing message")
(defun stmcrblog-post-edit (&optional msg)
(let (
(buffer (get-buffer-create stmcrblog-buffer-name))
(current-buffer (current-buffer))
)
(switch-to-buffer buffer)
(local-key-binding )
(kill-buffer buffer)
(error "not-implemented")
))
;;;###autoload
(defun stmcrblog-post (&optional prefix start end)
"Post entry.
Interactively, in Transient Mark mode when the mark is active,
operate on the contents of the region. Otherwise, open
`stmcrblog-buffer-name' buffer for message editing."
(interactive "P\nr")
(let ( msg )
(when (and (called-interactively-p 'interactive) transient-mark-mode mark-active)
(setq msg (buffer-substring-no-properties start end))
)
(if msg
(stmcrblog-add-entry msg)
)
))
;;;###autoload
(defun stmcrblog-post-current-line (prefix)
"Post current line.
With prefix remove current line."
(interactive "P")
(stmcrblog-add-entry (buffer-substring-no-properties (line-beginning-position) (line-end-position)))
(when prefix
(move-beginning-of-line 1)
(kill-line)
)
)
(provide 'stmcrblog-mode)
;;; stmcrblog-mode.el ends here