mirror of https://github.com/djcb/mu.git
* mu4e: add support for display mailing list (short)names in headers/view mode
This commit is contained in:
parent
58a6ac1a13
commit
10ad5ce2ca
|
@ -29,6 +29,7 @@ dist_lisp_LISP= \
|
|||
mu4e-compose.el \
|
||||
mu4e-draft.el \
|
||||
mu4e-headers.el \
|
||||
mu4e-lists.el \
|
||||
mu4e-main.el \
|
||||
mu4e-mark.el \
|
||||
mu4e-message.el \
|
||||
|
|
|
@ -47,10 +47,11 @@
|
|||
:group 'mu4e)
|
||||
|
||||
(defcustom mu4e-headers-fields
|
||||
'( (:human-date . 12)
|
||||
(:flags . 6)
|
||||
(:from . 22)
|
||||
(:subject . nil))
|
||||
'( (:human-date . 12)
|
||||
(:flags . 6)
|
||||
(:mailing-list . 10)
|
||||
(:from . 22)
|
||||
(:subject . nil))
|
||||
"A list of header fields to show in the headers buffer.
|
||||
Each element has the form (HEADER . WIDTH), where HEADER is one
|
||||
of the available headers (see `mu4e-header-info') and WIDTH is
|
||||
|
@ -356,6 +357,13 @@ date. The formats used for date and time are
|
|||
(format-time-string mu4e-headers-time-format date)
|
||||
(format-time-string mu4e-headers-date-format date))))
|
||||
|
||||
|
||||
(defsubst mu4e~headers-mailing-list (list)
|
||||
"Get some identifier for the mailing list."
|
||||
(let* ((short (and list (mu4e-get-mailing-list-shortname list))))
|
||||
(if short
|
||||
(propertize (or short "List") 'help-echo list) "")))
|
||||
|
||||
;; note: this function is very performance-sensitive
|
||||
(defun mu4e~headers-header-handler (msg &optional point)
|
||||
"Create a one line description of MSG in this buffer, at POINT,
|
||||
|
@ -377,6 +385,7 @@ if provided, or at the end of the buffer otherwise."
|
|||
;; 'To', otherwise show From
|
||||
(:from-or-to (mu4e~headers-from-or-to msg))
|
||||
(:date (format-time-string mu4e-headers-date-format val))
|
||||
(:mailing-list (mu4e~headers-mailing-list val))
|
||||
(:human-date (mu4e~headers-human-date msg))
|
||||
(:flags (propertize (mu4e~headers-flags-str val)
|
||||
'help-echo (format "%S" val)))
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
;;; mu4e-lists.el -- part of mu4e, the mu mail user agent
|
||||
;;
|
||||
;; Copyright (C) 2011-2012 Dirk-Jan C. Binnema
|
||||
|
||||
;; Author: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||
;; Maintainer: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
;; 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:
|
||||
|
||||
;; In this file, we create a table of list-id -> shortname for mailing lists.
|
||||
|
||||
|
||||
|
||||
(defvar mu4e~mailing-lists
|
||||
'(
|
||||
("bbdb-info.lists.sourceforge.net" . "BBDB")
|
||||
("boost-announce.lists.boost.org" . "BoostA")
|
||||
("boost-interest.lists.boost.org" . "BoostI")
|
||||
("conkeror.mozdev.org" . "Conkeror")
|
||||
("crypto-gram-list.schneier.com " . "CryptoGr")
|
||||
("dbus.lists.freedesktop.org" . "DBus")
|
||||
("desktop-devel-list.gnome.org" . "GnomeDT")
|
||||
("emacs-devel.gnu.org" . "EmacsDev")
|
||||
("emacs-orgmode.gnu.org" . "Orgmode")
|
||||
("emms-help.gnu.org" . "Emms")
|
||||
("enlightenment-devel.lists.sourceforge.net" . "E-Dev")
|
||||
("erlang-questions.erlang.org" . "Erlang")
|
||||
("evolution-hackers.lists.ximian.com" . "EvoDev")
|
||||
("farsight-devel.lists.sourceforge.net" . "Farsight")
|
||||
("gcc-help.gcc.gnu.org" . "Gcc")
|
||||
("gmime-devel-list.gnome.org" . "GMimeDev")
|
||||
("gnome-shell-list.gnome.org" . "GnomeSh")
|
||||
("gnu-emacs-sources.gnu.org" . "EmacsSrc")
|
||||
("gnupg-users.gnupg.org" . "GnupgU")
|
||||
("gpe.handhelds.org" . "GPE")
|
||||
("gstreamer-devel.lists.freedesktop.org" . "GstDev")
|
||||
("gstreamer-devel.lists.sourceforge.net" . "GstDev")
|
||||
("gstreamer-openmax.lists.sourceforge.net" . "GstOmx")
|
||||
("gtk-devel-list.gnome.org" . "GtkDev")
|
||||
("gtkmm-list.gnome.org" . "GtkmmDev")
|
||||
("guile-devel.gnu.org" . "GuileDev")
|
||||
("guile-user.gnu.org" . "GuileUsr")
|
||||
("help-gnu-emacs.gnu.org" . "EmacsUsr")
|
||||
("lggdh-algemeen.vvtp.tudelft.nl" . "LGGDH")
|
||||
("maemo-developers.maemo.org" . "MaemoDev")
|
||||
("maemo-users.maemo.org" . "MaemoUsr")
|
||||
("mailman.lists.freedesktop.org" . "Mailman")
|
||||
("monit-general.nongnu.org" . "Monit")
|
||||
("mu-discuss.googlegroups.com" . "Mu")
|
||||
("nautilus-list.gnome.org" . "Nautilus")
|
||||
("notmuch.notmuchmail.org" . "Notmuch")
|
||||
("orbit-list.gnome.org" . "ORBit")
|
||||
("pulseaudio-discuss.lists.freedesktop.org" . "PulseA")
|
||||
("sqlite-dev.sqlite.org" . "SQLiteDev")
|
||||
("sup-talk.rubyforge.org" . "Sup")
|
||||
("sylpheed-claws-users.lists.sourceforge.net" . "Sylpheed")
|
||||
("tinymail-devel-list.gnome.org" . "Tinymail")
|
||||
("unicode.sarasvati.unicode.org" . "Unicode")
|
||||
("xapian-discuss.lists.xapian.org" . "Xapian")
|
||||
("xdg.lists.freedesktop.org" . "XDG")
|
||||
("zsh-users.zsh.org" . "ZshUsr"))
|
||||
"AList of mailing lists id -> shortname")
|
||||
|
||||
(defvar mu4e-user-mailing-lists nil
|
||||
"A list of (MAILING-LIST-ID . SHORTNAME); these are uses in
|
||||
addition to the 'built-in' list `mu4e~user-lists'.")
|
||||
|
||||
(provide 'mu4e-lists)
|
||||
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
(require 'mu4e-vars)
|
||||
(require 'mu4e-about)
|
||||
(require 'mu4e-lists)
|
||||
(require 'doc-view)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
@ -467,7 +468,19 @@ that has a live window), and vice versa."
|
|||
(view-mode)))
|
||||
(switch-to-buffer buf)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(defvar mu4e~lists-hash nil
|
||||
"Hashtable of mailing-list-id => shortname, based on `mu4e~mailing-lists'
|
||||
and `mu4e-user-mailing-lists'.")
|
||||
|
||||
(defun mu4e-get-mailing-list-shortname (list-id)
|
||||
"Get the shortname for a mailing-list with list-id LIST-ID. based on `mu4e~mailing-lists'
|
||||
and `mu4e-user-mailing-lists'."
|
||||
(unless mu4e~lists-hash
|
||||
(setq mu4e~lists-hash (make-hash-table :test 'equal))
|
||||
(dolist (cell mu4e~mailing-lists) (puthash (car cell) (cdr cell) mu4e~lists-hash))
|
||||
(dolist (cell mu4e-user-mailing-lists) (puthash (car cell) (cdr cell) mu4e~lists-hash)))
|
||||
(gethash list-id mu4e~lists-hash))
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defvar mu4e-index-updated-hook nil
|
||||
|
|
|
@ -516,6 +516,11 @@ I.e. a message with the draft flag set."
|
|||
:shortname "Maildir"
|
||||
:help "Maildir for this message"
|
||||
:sortable t))
|
||||
(:mailing-list .
|
||||
( :name "List"
|
||||
:shortname "List"
|
||||
:help "Mailing list for this message"
|
||||
:sortable t))
|
||||
(:path .
|
||||
( :name "Path"
|
||||
:shortname "Path"
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
:group 'mu4e)
|
||||
|
||||
(defcustom mu4e-view-fields
|
||||
'(:from :to :cc :subject :flags :date :maildir :tags :attachments :signature)
|
||||
'(:from :to :cc :subject :flags :date :maildir :mailing-list :tags :attachments :signature)
|
||||
"Header fields to display in the message view buffer.
|
||||
For the complete list of available headers, see `mu4e-header-info'."
|
||||
:type (list 'symbol)
|
||||
|
@ -157,7 +157,7 @@ messages - for example, `mu4e-org'."
|
|||
(:path (mu4e~view-construct-header field fieldval))
|
||||
(:maildir (mu4e~view-construct-header field fieldval))
|
||||
((:flags :tags) (mu4e~view-construct-flags-tags-header field fieldval))
|
||||
|
||||
|
||||
;; contact fields
|
||||
(:to (mu4e~view-construct-contacts-header msg field))
|
||||
(:from (mu4e~view-construct-contacts-header msg field))
|
||||
|
@ -181,6 +181,8 @@ messages - for example, `mu4e-org'."
|
|||
;; size
|
||||
(:size
|
||||
(mu4e~view-construct-header field (mu4e-display-size fieldval)))
|
||||
(:mailing-list
|
||||
(mu4e~view-construct-header field fieldval))
|
||||
;; attachments
|
||||
(:attachments (mu4e~view-construct-attachments-header msg))
|
||||
;; pgp-signatures
|
||||
|
|
Loading…
Reference in New Issue