2019-08-19 12:41:33 +02:00
|
|
|
;;; mu4e-view.el -- part of mu4e, the mu mail user agent -*- lexical-binding: t -*-
|
2020-02-11 12:23:40 +01:00
|
|
|
|
2021-03-10 19:36:47 +01:00
|
|
|
;; Copyright (C) 2021 Dirk-Jan C. Binnema
|
2011-09-18 13:39:36 +02:00
|
|
|
|
|
|
|
;; Author: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
|
|
|
;; Maintainer: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
|
|
|
|
|
|
|
;; This file is not part of GNU Emacs.
|
2020-02-11 12:23:40 +01:00
|
|
|
|
2011-09-18 13:39:36 +02:00
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
2012-03-31 16:20:03 +02:00
|
|
|
;; In this file we define mu4e-view-mode (+ helper functions), which is used for
|
|
|
|
;; viewing e-mail messages
|
2011-09-18 13:39:36 +02:00
|
|
|
|
|
|
|
;;; Code:
|
2021-03-10 19:36:47 +01:00
|
|
|
(declare-function mu4e~view-gnus "mu4e-view-gnus")
|
|
|
|
(declare-function mu4e~view-old "mu4e-view-old")
|
|
|
|
(declare-function mu4e~headers-update-handler "mu4e-headers")
|
|
|
|
(declare-function mu4e-headers-search "mu4e-headers")
|
|
|
|
(declare-function mu4e-error "mu4e-utils")
|
2020-02-11 15:10:35 +01:00
|
|
|
|
2021-03-10 19:36:47 +01:00
|
|
|
(require 'mu4e-view-common)
|
2021-03-16 18:49:27 +01:00
|
|
|
(require (if mu4e-view-use-old 'mu4e-view-old 'mu4e-view-gnus))
|
2014-04-27 10:54:15 +02:00
|
|
|
|
2017-05-18 03:42:52 +02:00
|
|
|
(defun mu4e-view (msg)
|
2011-09-18 13:39:36 +02:00
|
|
|
"Display the message MSG in a new buffer, and keep in sync with HDRSBUF.
|
|
|
|
'In sync' here means that moving to the next/previous message in
|
2012-04-29 21:03:27 +02:00
|
|
|
the the message view affects HDRSBUF, as does marking etc.
|
2014-10-10 17:34:57 +02:00
|
|
|
|
2011-09-18 13:39:36 +02:00
|
|
|
As a side-effect, a message that is being viewed loses its 'unread'
|
2018-04-24 13:21:15 +02:00
|
|
|
marking if it still had that.
|
|
|
|
|
2021-03-16 18:49:27 +01:00
|
|
|
Depending on the value of `mu4e-view-use-old', either use mu4e's
|
|
|
|
internal display mode, or a (by default) display mode based on
|
|
|
|
Gnus' article-mode."
|
|
|
|
|
|
|
|
;; sanity checks.
|
|
|
|
(if (and mu4e-view-use-old (featurep 'mu4e-view-gnus))
|
|
|
|
(error "Cannot use old view when gnus-view is loaded; restart emacs")
|
|
|
|
(if (and (not mu4e-view-use-old) (featurep 'mu4e-view-old))
|
|
|
|
(error "Cannot use gnus-based view with old view loaded; restart emacs")))
|
|
|
|
|
2020-06-10 16:36:38 +02:00
|
|
|
(mu4e~headers-update-handler msg nil nil);; update headers, if necessary.
|
|
|
|
|
2021-03-16 18:49:27 +01:00
|
|
|
(if mu4e-view-use-old
|
|
|
|
(mu4e~view-old msg)
|
|
|
|
(mu4e~view-gnus msg)))
|
2021-03-07 22:27:45 +01:00
|
|
|
|
2021-03-10 19:36:47 +01:00
|
|
|
(defun mu4e-view-message-with-message-id (msgid)
|
|
|
|
"View message with message-id MSGID. This (re)creates a
|
|
|
|
headers-buffer with a search for MSGID, then open a view for that
|
|
|
|
message."
|
|
|
|
(mu4e-headers-search (concat "msgid:" msgid) nil nil t msgid t))
|
2021-03-07 22:27:45 +01:00
|
|
|
|
2011-12-13 08:07:38 +01:00
|
|
|
(provide 'mu4e-view)
|
2020-02-11 12:38:01 +01:00
|
|
|
;;; mu4e-view.el ends here
|