mirror of https://github.com/djcb/mu.git
* mu4e: make contacts in address field in the message view 'clickable': toggle
between long/short display and compose. Make short display the default
This commit is contained in:
parent
a2bceff17c
commit
668327da84
4
TODO
4
TODO
|
@ -12,8 +12,6 @@
|
||||||
threads when searching
|
threads when searching
|
||||||
- refactor fill_database function in test cases
|
- refactor fill_database function in test cases
|
||||||
- handling of command line options / help
|
- handling of command line options / help
|
||||||
- fix 'mu find maildir:/'
|
|
||||||
- check for valid flags (i.e.., flag:foobar should raise an error)
|
|
||||||
- handle exception 'The revision being read has been discarded - you should
|
- handle exception 'The revision being read has been discarded - you should
|
||||||
call Xapian::Database::reopen() and retry the operation'
|
call Xapian::Database::reopen() and retry the operation'
|
||||||
|
|
||||||
|
@ -52,9 +50,11 @@
|
||||||
- open links to mails through headers-mode somehow (i.e..,
|
- open links to mails through headers-mode somehow (i.e..,
|
||||||
mu4e-view-message-with-msgid)
|
mu4e-view-message-with-msgid)
|
||||||
- improve mouse interaction (i.e., cursor vs point)
|
- improve mouse interaction (i.e., cursor vs point)
|
||||||
|
- add example 'run shellscript on message'
|
||||||
|
|
||||||
** Done (0.9.9)
|
** Done (0.9.9)
|
||||||
|
|
||||||
|
- make contacts in the view clickable (toggle long/short display, compose message)
|
||||||
- opening urls is too eager (now use M-RET for opening url at point, not just
|
- opening urls is too eager (now use M-RET for opening url at point, not just
|
||||||
RET, which conflicted with using RET for scrolling)
|
RET, which conflicted with using RET for scrolling)
|
||||||
- document quoting of queries
|
- document quoting of queries
|
||||||
|
|
|
@ -273,6 +273,11 @@ flag set)."
|
||||||
"Face for showing URLs and attachments in the message view."
|
"Face for showing URLs and attachments in the message view."
|
||||||
:group 'mu4e-faces)
|
:group 'mu4e-faces)
|
||||||
|
|
||||||
|
(defface mu4e-view-contact-face
|
||||||
|
'((t :inherit font-lock-variable-name-face))
|
||||||
|
"Face for showing URLs and attachments in the message view."
|
||||||
|
:group 'mu4e-faces)
|
||||||
|
|
||||||
(defface mu4e-highlight-face
|
(defface mu4e-highlight-face
|
||||||
'((t :inherit font-lock-pseudo-keyword-face :bold t))
|
'((t :inherit font-lock-pseudo-keyword-face :bold t))
|
||||||
"Face for highlighting things."
|
"Face for highlighting things."
|
||||||
|
|
|
@ -59,10 +59,11 @@ complete list of available headers, see `mu4e-header-info'."
|
||||||
:type 'string
|
:type 'string
|
||||||
:group 'mu4e-view)
|
:group 'mu4e-view)
|
||||||
|
|
||||||
(defcustom mu4e-view-show-addresses t
|
(defcustom mu4e-view-show-addresses nil
|
||||||
"Whether to show e-mail addresses for contacts in address-fields,
|
"Whether to initially show full e-mail addresses for contacts in
|
||||||
if names are available as well (note that the e-mail addresses
|
address fields, rather than only their names. Note that you can
|
||||||
are still available as a tooltip."
|
toggle between long/short display by klicking / M-RET on the
|
||||||
|
contact."
|
||||||
:type 'boolean
|
:type 'boolean
|
||||||
:group 'mu4e-view)
|
:group 'mu4e-view)
|
||||||
|
|
||||||
|
@ -263,21 +264,64 @@ add text-properties to VAL."
|
||||||
(buffer-string))
|
(buffer-string))
|
||||||
"")))
|
"")))
|
||||||
|
|
||||||
|
(defun mu4e~view-toggle-contact (&optional point)
|
||||||
|
"Toggle between the long and short versions of long/short string
|
||||||
|
at POINT, or if nil, at (point)."
|
||||||
|
(interactive)
|
||||||
|
(unless (get-text-property (or point (point)) 'long)
|
||||||
|
(error "point is not toggleable"))
|
||||||
|
(let* ((point (or point (point)))
|
||||||
|
;; find the first pos part of the button
|
||||||
|
(start (previous-property-change point))
|
||||||
|
(start (if start (next-property-change start) (point-min)))
|
||||||
|
;; find the first pos not part of the button (possibly nil)
|
||||||
|
(end (next-property-change point))
|
||||||
|
(end (or end (1+ (point-max)))) ;; one beyond
|
||||||
|
(longtext (get-text-property point 'long))
|
||||||
|
(shorttext (get-text-property point 'short))
|
||||||
|
(inhibit-read-only t))
|
||||||
|
(if (string= (get-text-property point 'display) longtext)
|
||||||
|
(add-text-properties start end `(display ,shorttext))
|
||||||
|
(add-text-properties start end `(display ,longtext)))))
|
||||||
|
|
||||||
|
(defun mu4e~view-compose-contact (&optional point)
|
||||||
|
"Compose a message for the address at point."
|
||||||
|
(interactive)
|
||||||
|
(unless (get-text-property (or point (point)) 'email)
|
||||||
|
(error "No address at point"))
|
||||||
|
(mu4e~compose-mail (get-text-property (or point (point)) 'email)))
|
||||||
|
|
||||||
(defun mu4e~view-construct-contacts-header (msg field)
|
(defun mu4e~view-construct-contacts-header (msg field)
|
||||||
"Add a header for a contact field (ie., :to, :from, :cc, :bcc)."
|
"Add a header for a contact field (ie., :to, :from, :cc, :bcc)."
|
||||||
(mu4e~view-construct-header field
|
(mu4e~view-construct-header field
|
||||||
(mapconcat
|
(mapconcat
|
||||||
(lambda(c)
|
(lambda(c)
|
||||||
(let ((name (car c)) (email (cdr c)))
|
(let* ((name (car c))
|
||||||
|
(email (cdr c))
|
||||||
|
(short (or name email)) ;; name may be nil
|
||||||
|
(long (if name (format "%s <%s>" name email) email))
|
||||||
|
(map (make-sparse-keymap)))
|
||||||
|
(define-key map [mouse-1] 'mu4e~view-toggle-contact)
|
||||||
|
(define-key map [?\M-\r] 'mu4e~view-toggle-contact)
|
||||||
|
(define-key map [mouse-2] 'mu4e~view-compose-contact)
|
||||||
|
(define-key map "C" 'mu4e~view-compose-contact)
|
||||||
(propertize
|
(propertize
|
||||||
(if name
|
(if mu4e-view-show-addresses long short)
|
||||||
(if mu4e-view-show-addresses
|
'long long
|
||||||
(format "%s <%s>" name email)
|
'short short
|
||||||
(format "%s" name))
|
'email email
|
||||||
(format "%s" email))
|
'display (if mu4e-view-show-addresses long short)
|
||||||
'help-echo email)))
|
'keymap map
|
||||||
(plist-get msg field) ", ")))
|
'face 'mu4e-view-contact-face
|
||||||
|
'mouse-face 'highlight
|
||||||
|
'help-echo
|
||||||
|
(format (concat
|
||||||
|
"<" email ">\n"
|
||||||
|
"[mouse-1] or [M-RET] to toggle long/short display\n"
|
||||||
|
"[mouse-2] or C to compose a mail for this recipient")))))
|
||||||
|
(plist-get msg field) ", ") t))
|
||||||
|
|
||||||
|
|
||||||
(defun mu4e~view-open-save-attach-func (msg attachnum is-open)
|
(defun mu4e~view-open-save-attach-func (msg attachnum is-open)
|
||||||
"Return a function that offers to save attachment NUM. If IS-OPEN
|
"Return a function that offers to save attachment NUM. If IS-OPEN
|
||||||
is nil, and otherwise open it."
|
is nil, and otherwise open it."
|
||||||
|
|
|
@ -743,10 +743,12 @@ variable @code{mu4e-view-fields}.
|
||||||
@item You can customize the date format by setting the variable
|
@item You can customize the date format by setting the variable
|
||||||
@code{mu4e-date-format-long}, using the same format that
|
@code{mu4e-date-format-long}, using the same format that
|
||||||
@code{format-time-string} uses.
|
@code{format-time-string} uses.
|
||||||
@item If you only want to see the name and not the e-mail address of the
|
@item By default, @t{mu4e} shows only the names of contacts in address fields,
|
||||||
contacts in address fields, you can set @option{mu4e-view-show-addresses} to
|
and not the e-mail addresses. You can see the e-mail addresses by clicking on
|
||||||
@t{nil}. This will hide the addresses for contacts that also have a name. The
|
the name, or pressing @key{M-RET}. Furthermore, you can compose a message for
|
||||||
e-mail address is still available as a tool-tip.
|
the contact at point by either @key{[mouse-2]} or pressing @key{C}. If you
|
||||||
|
always want to see the addresses, you can set
|
||||||
|
@option{mu4e-view-show-addresses} to @t{t}.
|
||||||
@item The body text can be line-wrapped (toggle between wrapped/not-wrapped with
|
@item The body text can be line-wrapped (toggle between wrapped/not-wrapped with
|
||||||
@key{w}) and/or cited parts can be hidden (toggle between hidden/not-hidden
|
@key{w}) and/or cited parts can be hidden (toggle between hidden/not-hidden
|
||||||
with @key{h}. If you want to do this by default when viewing messages, you can
|
with @key{h}. If you want to do this by default when viewing messages, you can
|
||||||
|
|
Loading…
Reference in New Issue