mu4e: add NEWS(.org) as a main menu item

This commit is contained in:
djcb 2015-06-07 21:07:59 +03:00
parent 29230a787b
commit 041a79fdb5
4 changed files with 37 additions and 28 deletions

View File

@ -57,6 +57,7 @@
(define-key map "$" 'mu4e-show-log) (define-key map "$" 'mu4e-show-log)
(define-key map "A" 'mu4e-about) (define-key map "A" 'mu4e-about)
(define-key map "N" 'mu4e-news)
(define-key map "H" 'mu4e-display-manual) (define-key map "H" 'mu4e-display-manual)
map) map)
@ -146,6 +147,7 @@ clicked."
(mu4e~main-view-queue) (mu4e~main-view-queue)
"") "")
"\n" "\n"
(mu4e~main-action-str "\t* [N]ews\n" 'mu4e-news)
(mu4e~main-action-str "\t* [A]bout mu4e\n" 'mu4e-about) (mu4e~main-action-str "\t* [A]bout mu4e\n" 'mu4e-about)
(mu4e~main-action-str "\t* [H]elp\n" 'mu4e-display-manual) (mu4e~main-action-str "\t* [H]elp\n" 'mu4e-display-manual)
(mu4e~main-action-str "\t* [q]uit\n" 'mu4e-quit)) (mu4e~main-action-str "\t* [q]uit\n" 'mu4e-quit))

View File

@ -5,4 +5,7 @@
(defconst mu4e-builddir "@abs_top_builddir@" (defconst mu4e-builddir "@abs_top_builddir@"
"Top-level build directory.") "Top-level build directory.")
(defconst mu4e-doc-dir "@MU_DOC_DIR@"
"Mu4e's data-dir.")
(provide 'mu4e-meta) (provide 'mu4e-meta)

View File

@ -32,7 +32,7 @@
(eval-when-compile (require 'org nil 'noerror)) (eval-when-compile (require 'org nil 'noerror))
(require 'mu4e-vars) (require 'mu4e-vars)
(require 'mu4e-about) (require 'mu4e-meta)
(require 'mu4e-lists) (require 'mu4e-lists)
(require 'doc-view) (require 'doc-view)
@ -1060,32 +1060,34 @@ displaying it). Do _not_ bury the current buffer, though."
(apply 'encode-time (mu4e-parse-time-string timestr)))) (apply 'encode-time (mu4e-parse-time-string timestr))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defconst mu4e~main-about-buffer-name "*mu4e-about*" (define-derived-mode mu4e-org-mode org-mode "mu4e:org"
"Name for the mu4e-about buffer.") "Major mode for mu4e documents, derived from
`org-mode'.")
(define-derived-mode mu4e-about-mode org-mode "mu4e:about" (defun mu4e-info (path)
"Major mode for the mu4e About page, derived from `org-mode'.") "Show a buffer with the information (an org-file) at PATH."
(interactive)
(unless (file-exists-p path)
(mu4e-error "Cannot find %s" path))
(lexical-let ((curbuf (current-buffer)))
(find-file path)
(mu4e-org-mode)
(setq buffer-read-only t)
(define-key mu4e-org-mode-map (kbd "q")
(lambda ()
(interactive)
(bury-buffer)
(switch-to-buffer curbuf)))))
(defun mu4e-about () (defun mu4e-about ()
"Show a buffer with the mu4e-about text." "Show the mu4e 'about' page."
(interactive) (interactive)
(lexical-let ((oldbuf (current-buffer))) (mu4e-info (concat mu4e-doc-dir "/mu4e-about.org")))
(with-current-buffer
(get-buffer-create mu4e~main-about-buffer-name) (defun mu4e-news ()
(define-key mu4e-about-mode-map (kbd "q") "Show the mu4e 'about' page."
(lambda () ;; XXX it seems unnecessarily hard to do this... (interactive)
(interactive) (mu4e-info (concat mu4e-doc-dir "/NEWS.org")))
(bury-buffer)
(when (buffer-live-p oldbuf)
(switch-to-buffer oldbuf))))
(let ((inhibit-read-only t))
(erase-buffer)
(insert mu4e-about)
(mu4e-about-mode)
(show-all))))
(switch-to-buffer mu4e~main-about-buffer-name)
(setq buffer-read-only t)
(goto-char (point-min)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun mu4e-refresh-message (path maildir) (defun mu4e-refresh-message (path maildir)

View File

@ -57,11 +57,13 @@ link."
(defcustom mu4e-get-mail-command "true" (defcustom mu4e-get-mail-command "true"
"Shell command to run to retrieve new mail. "Shell command to run to retrieve new mail.
Common values are \"offlineimap\", \"fetchmail\" and \"mbsync\", Common values are \"offlineimap\", \"fetchmail\" or \"mbsync\", but
but you use arbitrary shell-commands. If you set it to arbitrary shell-commands can be used.
\"true\" (the default), the command won't don't anything, which is
useful if you get your mail without the need to explicitly run any When set to \"true\" (the default), the command simply finishes
scripts, for example when running your own mail-server." succesfully (running the 'true' command) without retrieving any
mail. This can be useful when mail is already retrieved in another
way."
:type 'string :type 'string
:group 'mu4e :group 'mu4e
:safe 'stringp) :safe 'stringp)