1
0
mirror of https://github.com/djcb/mu.git synced 2024-06-27 07:35:16 +02:00
This commit is contained in:
Pedro Ribeiro Mendes Júnior 2020-01-16 08:28:08 -03:00
commit 5d087a130b
7 changed files with 521 additions and 531 deletions

View File

@ -63,6 +63,16 @@
- Add message-id's to messages when saving drafts, so we can find them even
with ~mu4e-headers-skip-duplicates~.
- Bookmarks (as in ~mu4e-bookmarks~) are now simple plists (instead of cl
structs). ~make-mu4e-bookmark~ has been updated to produce such plists (for
backward compatibility). A bookmark now looks like a list of e.g.
~(:name "My bookmark" :query "banana OR pear" :key ?f)~
this format is a bit easier extensible.
- For instance, we now recognize an attribute ~:hide t~, which will hide the
bookmark item from the main-screen (and speedbar), but keep it avilable
through the completion UI.
*** toys
- Updated the ~mug~ toy UI to use Webkit2/GTK+. Note that this is just a toy

View File

@ -437,7 +437,7 @@ You can append flags."
;; otherwise...
(concat
(mu4e~draft-header "To" (mu4e~draft-recipients-construct :to origmsg))
(mu4e~draft-header "Cc" (mu4e~draft-recipients-construct :cc origmsg))))))))
(mu4e~draft-header "Cc" (mu4e~draft-recipients-construct :cc origmsg :reply-all))))))))
(defun mu4e~draft-reply-construct-recipients-list (origmsg)
"Determine the to/cc recipients for a reply message to a

View File

@ -1,6 +1,6 @@
;;; mu4e-main.el -- part of mu4e, the mu mail user agent -*- lexical-binding: t -*-
;;
;; Copyright (C) 2011-2016 Dirk-Jan C. Binnema
;; Copyright (C) 2011-2020 Dirk-Jan C. Binnema
;; Author: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
;; Maintainer: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
@ -142,10 +142,11 @@ clicked."
;; TODO: it's a bit uncool to hard-code the "b" shortcut...
(mapconcat
(lambda (bm)
(unless (plist-get bm :hide)
(mu4e~main-action-str
(concat "\t* [b" (make-string 1 (mu4e-bookmark-key bm)) "] "
(mu4e-bookmark-name bm))
(concat "b" (make-string 1 (mu4e-bookmark-key bm)))))
(concat "\t* [b" (make-string 1 (plist-get bm :key)) "] "
(plist-get bm :name))
(concat "b" (make-string 1 (plist-get bm :key))))))
(mu4e-bookmarks) "\n")
"\n\n"
(propertize " Misc\n\n" 'face 'mu4e-title-face)
@ -252,11 +253,4 @@ clicked."
(sit-for 1)
(mu4e~main-menu))))))
;; (progn
;; (define-key mu4e-compose-mode-map (kbd "C-c m") 'mu4e~main-toggle-mail-sending-mode)
;; (define-key mu4e-view-mode-map (kbd "C-c m") 'mu4e~main-toggle-mail-sending-mode)
;; (define-key mu4e-compose-mode-map (kbd "C-c m") 'mu4e~main-toggle-mail-sending-mode)
;; (define-key mu4e-headers-mode-map (kbd "C-c m") 'mu4e~main-toggle-mail-sending-mode)
;; )
(provide 'mu4e-main)

View File

@ -1,6 +1,6 @@
;;; mu4e-speedbar --- Speedbar support for mu4e -*- lexical-binding: t -*-
;; Copyright (C) 2012-2018 Antono Vasiljev, Dirk-Jan C. Binnema
;; Copyright (C) 2012-2020 Antono Vasiljev, Dirk-Jan C. Binnema
;;
;; Author: Antono Vasiljev <self@antono.info>
;; Version: 0.1
@ -98,12 +98,13 @@
"Insert the list of bookmarks in the speedbar"
(interactive)
(mapcar (lambda (bookmark)
(unless (plist-get bookmark :hide)
(speedbar-insert-button
(concat " " (mu4e-bookmark-name bookmark))
(concat " " (plist-get bookmark :name))
'mu4e-highlight-face
'highlight
'mu4e~speedbar-bookmark
(mu4e-bookmark-query bookmark)))
(plist-get bookmark :query))))
(mu4e-bookmarks)))
(defun mu4e~speedbar-bookmark (&optional _text token _ident)

View File

@ -1,6 +1,6 @@
;;; mu4e-utils.el -- part of mu4e, the mu mail user agent -*- lexical-binding: t -*-
;;
;; Copyright (C) 2011-2019 Dirk-Jan C. Binnema
;; Copyright (C) 2011-2020 Dirk-Jan C. Binnema
;; Author: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
;; Maintainer: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
@ -397,21 +397,17 @@ and offer to create it if it does not exist yet."
mdir))
(defun mu4e-bookmarks ()
"Get `mu4e-bookmarks' in the (new) format, converting from the old
format if needed."
"Get `mu4e-bookmarks' in the (new) format, converting from the
old format if needed."
(cl-map 'list
(lambda (item)
(if (mu4e-bookmark-p item)
item ;; already in the right format
(if (and (listp item) (= (length item) 3))
(make-mu4e-bookmark
:name (nth 1 item)
:query (nth 0 item)
:key (nth 2 item))
(mu4e-error "Invalid bookmark in mu4e-bookmarks"))))
`(:name ,(nth 1 item)
:query ,(nth 0 item)
:key ,(nth 2 item))
item))
mu4e-bookmarks))
(defun mu4e-ask-bookmark (prompt &optional kar)
"Ask the user for a bookmark (using PROMPT) as defined in
`mu4e-bookmarks', then return the corresponding query."
@ -421,10 +417,10 @@ format if needed."
(mapconcat
(lambda (bm)
(concat
"[" (propertize (make-string 1 (mu4e-bookmark-key bm))
"[" (propertize (make-string 1 (plist-get bm :key))
'face 'mu4e-highlight-face)
"]"
(mu4e-bookmark-name bm))) (mu4e-bookmarks) ", "))
(plist-get bm :name))) (mu4e-bookmarks) ", "))
(kar (read-char (concat prompt bmarks))))
(mu4e-get-bookmark-query kar)))
@ -434,10 +430,10 @@ KAR, or raise an error if none is found."
(let* ((chosen-bm
(or (cl-find-if
(lambda (bm)
(= kar (mu4e-bookmark-key bm)))
(= kar (plist-get bm :key)))
(mu4e-bookmarks))
(mu4e-warn "Unknown shortcut '%c'" kar)))
(expr (mu4e-bookmark-query chosen-bm))
(expr (plist-get chosen-bm :query))
(expr (if (not (functionp expr)) expr
(funcall expr)))
(query (eval expr)))
@ -453,14 +449,12 @@ replaces any existing bookmark with KEY."
(setq mu4e-bookmarks
(cl-remove-if
(lambda (bm)
(= (mu4e-bookmark-key bm) key))
(= (plist-get bm :key) key))
(mu4e-bookmarks)))
(cl-pushnew (make-mu4e-bookmark
:name name
:query query
:key key)
mu4e-bookmarks
:test 'equal))
(cl-pushnew `(:name ,name
:query ,query
:key ,key)
mu4e-bookmarks :test 'equal))
;;; converting flags->string and vice-versa ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -201,43 +201,41 @@ If the string exceeds this limit, it will be truncated to fit."
(defvar mu4e-debug nil
"When set to non-nil, log debug information to the *mu4e-log* buffer.")
(cl-defstruct mu4e-bookmark
"A mu4e bookmarl object with the following members:
;; for backward compatibility, when a bookmark was defined with defstruct.
(cl-defun make-mu4e-bookmark (&key name query key)
"Create a mu4e proplist with the following elements:
- `name': the user-visible name of the bookmark
- `key': a single key to search for this bookmark
- `query': the query for this bookmark. Either a literal string or a function
that evaluates to a string."
name ;; name/description of the bookmark
query ;; a query (a string or a function evaluation to string)
key ;; key to activate the bookmark
)
`(:name ,name :query ,query :key ,key))
(make-obsolete 'make-mu4e-bookmark "`unneeded; `mu4e-bookmarks'
are plists" "1.3.7")
(defcustom mu4e-bookmarks
`( ,(make-mu4e-bookmark
:name "Unread messages"
'(( :name "Unread messages"
:query "flag:unread AND NOT flag:trashed"
:key ?u)
,(make-mu4e-bookmark
:name "Today's messages"
( :name "Today's messages"
:query "date:today..now"
:key ?t)
,(make-mu4e-bookmark
:name "Last 7 days"
( :name "Last 7 days"
:query "date:7d..now"
:key ?w)
,(make-mu4e-bookmark
:name "Messages with images"
( :name "Messages with images"
:query "mime:image/*"
:key ?p))
"A list of pre-defined queries.
These will show up in the main screen. Each of the list elements
is a three-element list of the form (QUERY DESCRIPTION KEY),
where QUERY is a string with a mu query, DESCRIPTION is a short
description of the query (this will show up in the UI), and KEY
is a shortcut key for the query."
:type '(repeat (list (string :tag "Query")
(string :tag "Description")
character))
"List of pre-defined queries that are shown on the main screen.
Each of the list elements is a plist with at least:
:name - the name of the queryt
:query - the query expression
:key - the shortcut key.
Optionally, you add the following:
:hide - if t, bookmark is hdden from the main-view and speedbar.
"
:type '(repeat (plist))
:group 'mu4e)
(defcustom mu4e-split-view 'horizontal

View File

@ -1962,25 +1962,21 @@ mu4e-search-bookmark-edit}) which lets you edit the bookmark first.
@subsection Setting up bookmarks
@t{mu4e} provides a number of default bookmarks. Their definition is
instructive:
@t{mu4e} provides a number of default bookmarks. Their definition may
be instructive:
@lisp
(defvar mu4e-bookmarks
`( ,(make-mu4e-bookmark
:name "Unread messages"
'( ( :name "Unread messages"
:query "flag:unread AND NOT flag:trashed"
:key ?u)
,(make-mu4e-bookmark
:name "Today's messages"
( :name "Today's messages"
:query "date:today..now"
:key ?t)
,(make-mu4e-bookmark
:name "Last 7 days"
( :name "Last 7 days"
:query "date:7d..now"
:key ?w)
,(make-mu4e-bookmark
:name "Messages with images"
( :name "Messages with images"
:query "mime:image/*"
:key ?p))
"A list of pre-defined queries. Each query is represented by a
@ -1997,8 +1993,7 @@ You can replace these or add your own items, by putting in your
configuration (@file{~/.emacs}) something like:
@lisp
(add-to-list 'mu4e-bookmarks
(make-mu4e-bookmark
:name "Big messages"
'( :name "Big messages"
:query "size:5M..500M"
:key ?b))
@end lisp
@ -2023,8 +2018,7 @@ inbox:
@lisp
(add-to-list 'mu4e-bookmarks
(make-mu4e-bookmark
:name "Inbox messages in the last 7 days"
'( :name "Inbox messages in the last 7 days"
:query (lambda () (concat "maildir:/inbox AND date:"
(format-time-string "%Y%m%d"
(subtract-time (current-time) (days-to-time 7)))))
@ -2042,9 +2036,8 @@ shown:
(format-time-string "%Y%m%d" start-date))))
(add-to-list 'mu4e-bookmarks
(make-mu4e-bookmark
:name "Inbox messages in the last 7 days"
:query (lambda () (call-interactively 'my/mu4e-bookmark-num-days-old-query))
`(:name "Inbox messages in the last 7 days"
:query ,(lambda () (call-interactively 'my/mu4e-bookmark-num-days-old-query))
:key ?o) t)
@end lisp