1
0
mirror of https://github.com/djcb/mu.git synced 2024-06-30 08:01:07 +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 - Add message-id's to messages when saving drafts, so we can find them even
with ~mu4e-headers-skip-duplicates~. 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 *** toys
- Updated the ~mug~ toy UI to use Webkit2/GTK+. Note that this is just a toy - 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... ;; otherwise...
(concat (concat
(mu4e~draft-header "To" (mu4e~draft-recipients-construct :to origmsg)) (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) (defun mu4e~draft-reply-construct-recipients-list (origmsg)
"Determine the to/cc recipients for a reply message to a "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 -*- ;;; 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> ;; Author: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
;; Maintainer: 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... ;; TODO: it's a bit uncool to hard-code the "b" shortcut...
(mapconcat (mapconcat
(lambda (bm) (lambda (bm)
(unless (plist-get bm :hide)
(mu4e~main-action-str (mu4e~main-action-str
(concat "\t* [b" (make-string 1 (mu4e-bookmark-key bm)) "] " (concat "\t* [b" (make-string 1 (plist-get bm :key)) "] "
(mu4e-bookmark-name bm)) (plist-get bm :name))
(concat "b" (make-string 1 (mu4e-bookmark-key bm))))) (concat "b" (make-string 1 (plist-get bm :key))))))
(mu4e-bookmarks) "\n") (mu4e-bookmarks) "\n")
"\n\n" "\n\n"
(propertize " Misc\n\n" 'face 'mu4e-title-face) (propertize " Misc\n\n" 'face 'mu4e-title-face)
@ -252,11 +253,4 @@ clicked."
(sit-for 1) (sit-for 1)
(mu4e~main-menu)))))) (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) (provide 'mu4e-main)

View File

@ -1,6 +1,6 @@
;;; mu4e-speedbar --- Speedbar support for mu4e -*- lexical-binding: t -*- ;;; 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> ;; Author: Antono Vasiljev <self@antono.info>
;; Version: 0.1 ;; Version: 0.1
@ -98,12 +98,13 @@
"Insert the list of bookmarks in the speedbar" "Insert the list of bookmarks in the speedbar"
(interactive) (interactive)
(mapcar (lambda (bookmark) (mapcar (lambda (bookmark)
(unless (plist-get bookmark :hide)
(speedbar-insert-button (speedbar-insert-button
(concat " " (mu4e-bookmark-name bookmark)) (concat " " (plist-get bookmark :name))
'mu4e-highlight-face 'mu4e-highlight-face
'highlight 'highlight
'mu4e~speedbar-bookmark 'mu4e~speedbar-bookmark
(mu4e-bookmark-query bookmark))) (plist-get bookmark :query))))
(mu4e-bookmarks))) (mu4e-bookmarks)))
(defun mu4e~speedbar-bookmark (&optional _text token _ident) (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 -*- ;;; 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> ;; Author: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
;; Maintainer: 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)) mdir))
(defun mu4e-bookmarks () (defun mu4e-bookmarks ()
"Get `mu4e-bookmarks' in the (new) format, converting from the old "Get `mu4e-bookmarks' in the (new) format, converting from the
format if needed." old format if needed."
(cl-map 'list (cl-map 'list
(lambda (item) (lambda (item)
(if (mu4e-bookmark-p item)
item ;; already in the right format
(if (and (listp item) (= (length item) 3)) (if (and (listp item) (= (length item) 3))
(make-mu4e-bookmark `(:name ,(nth 1 item)
:name (nth 1 item) :query ,(nth 0 item)
:query (nth 0 item) :key ,(nth 2 item))
:key (nth 2 item)) item))
(mu4e-error "Invalid bookmark in mu4e-bookmarks"))))
mu4e-bookmarks)) mu4e-bookmarks))
(defun mu4e-ask-bookmark (prompt &optional kar) (defun mu4e-ask-bookmark (prompt &optional kar)
"Ask the user for a bookmark (using PROMPT) as defined in "Ask the user for a bookmark (using PROMPT) as defined in
`mu4e-bookmarks', then return the corresponding query." `mu4e-bookmarks', then return the corresponding query."
@ -421,10 +417,10 @@ format if needed."
(mapconcat (mapconcat
(lambda (bm) (lambda (bm)
(concat (concat
"[" (propertize (make-string 1 (mu4e-bookmark-key bm)) "[" (propertize (make-string 1 (plist-get bm :key))
'face 'mu4e-highlight-face) 'face 'mu4e-highlight-face)
"]" "]"
(mu4e-bookmark-name bm))) (mu4e-bookmarks) ", ")) (plist-get bm :name))) (mu4e-bookmarks) ", "))
(kar (read-char (concat prompt bmarks)))) (kar (read-char (concat prompt bmarks))))
(mu4e-get-bookmark-query kar))) (mu4e-get-bookmark-query kar)))
@ -434,10 +430,10 @@ KAR, or raise an error if none is found."
(let* ((chosen-bm (let* ((chosen-bm
(or (cl-find-if (or (cl-find-if
(lambda (bm) (lambda (bm)
(= kar (mu4e-bookmark-key bm))) (= kar (plist-get bm :key)))
(mu4e-bookmarks)) (mu4e-bookmarks))
(mu4e-warn "Unknown shortcut '%c'" kar))) (mu4e-warn "Unknown shortcut '%c'" kar)))
(expr (mu4e-bookmark-query chosen-bm)) (expr (plist-get chosen-bm :query))
(expr (if (not (functionp expr)) expr (expr (if (not (functionp expr)) expr
(funcall expr))) (funcall expr)))
(query (eval expr))) (query (eval expr)))
@ -453,14 +449,12 @@ replaces any existing bookmark with KEY."
(setq mu4e-bookmarks (setq mu4e-bookmarks
(cl-remove-if (cl-remove-if
(lambda (bm) (lambda (bm)
(= (mu4e-bookmark-key bm) key)) (= (plist-get bm :key) key))
(mu4e-bookmarks))) (mu4e-bookmarks)))
(cl-pushnew (make-mu4e-bookmark (cl-pushnew `(:name ,name
:name name :query ,query
:query query :key ,key)
:key key) mu4e-bookmarks :test 'equal))
mu4e-bookmarks
:test 'equal))
;;; converting flags->string and vice-versa ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; converting flags->string and vice-versa ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -633,7 +627,7 @@ used as a simple way to invoke some action when a message
changed.") changed.")
(make-obsolete-variable 'mu4e-msg-changed-hook (make-obsolete-variable 'mu4e-msg-changed-hook
'mu4e-message-changed-hook "0.9.19") 'mu4e-message-changed-hook "0.9.19")
;; some handler functions for server messages ;; some handler functions for server messages
;; ;;

View File

@ -201,43 +201,41 @@ If the string exceeds this limit, it will be truncated to fit."
(defvar mu4e-debug nil (defvar mu4e-debug nil
"When set to non-nil, log debug information to the *mu4e-log* buffer.") "When set to non-nil, log debug information to the *mu4e-log* buffer.")
(cl-defstruct mu4e-bookmark ;; for backward compatibility, when a bookmark was defined with defstruct.
"A mu4e bookmarl object with the following members: (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 - `name': the user-visible name of the bookmark
- `key': a single key to search for this bookmark - `key': a single key to search for this bookmark
- `query': the query for this bookmark. Either a literal string or a function - `query': the query for this bookmark. Either a literal string or a function
that evaluates to a string." that evaluates to a string."
name ;; name/description of the bookmark `(:name ,name :query ,query :key ,key))
query ;; a query (a string or a function evaluation to string) (make-obsolete 'make-mu4e-bookmark "`unneeded; `mu4e-bookmarks'
key ;; key to activate the bookmark are plists" "1.3.7")
)
(defcustom mu4e-bookmarks (defcustom mu4e-bookmarks
`( ,(make-mu4e-bookmark '(( :name "Unread messages"
:name "Unread messages"
:query "flag:unread AND NOT flag:trashed" :query "flag:unread AND NOT flag:trashed"
:key ?u) :key ?u)
,(make-mu4e-bookmark ( :name "Today's messages"
:name "Today's messages"
:query "date:today..now" :query "date:today..now"
:key ?t) :key ?t)
,(make-mu4e-bookmark ( :name "Last 7 days"
:name "Last 7 days"
:query "date:7d..now" :query "date:7d..now"
:key ?w) :key ?w)
,(make-mu4e-bookmark ( :name "Messages with images"
:name "Messages with images"
:query "mime:image/*" :query "mime:image/*"
:key ?p)) :key ?p))
"A list of pre-defined queries. "List of pre-defined queries that are shown on the main screen.
These will show up in the main screen. Each of the list elements
is a three-element list of the form (QUERY DESCRIPTION KEY), Each of the list elements is a plist with at least:
where QUERY is a string with a mu query, DESCRIPTION is a short :name - the name of the queryt
description of the query (this will show up in the UI), and KEY :query - the query expression
is a shortcut key for the query." :key - the shortcut key.
:type '(repeat (list (string :tag "Query")
(string :tag "Description") Optionally, you add the following:
character)) :hide - if t, bookmark is hdden from the main-view and speedbar.
"
:type '(repeat (plist))
:group 'mu4e) :group 'mu4e)
(defcustom mu4e-split-view 'horizontal (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 @subsection Setting up bookmarks
@t{mu4e} provides a number of default bookmarks. Their definition is @t{mu4e} provides a number of default bookmarks. Their definition may
instructive: be instructive:
@lisp @lisp
(defvar mu4e-bookmarks (defvar mu4e-bookmarks
`( ,(make-mu4e-bookmark '( ( :name "Unread messages"
:name "Unread messages"
:query "flag:unread AND NOT flag:trashed" :query "flag:unread AND NOT flag:trashed"
:key ?u) :key ?u)
,(make-mu4e-bookmark ( :name "Today's messages"
:name "Today's messages"
:query "date:today..now" :query "date:today..now"
:key ?t) :key ?t)
,(make-mu4e-bookmark ( :name "Last 7 days"
:name "Last 7 days"
:query "date:7d..now" :query "date:7d..now"
:key ?w) :key ?w)
,(make-mu4e-bookmark ( :name "Messages with images"
:name "Messages with images"
:query "mime:image/*" :query "mime:image/*"
:key ?p)) :key ?p))
"A list of pre-defined queries. Each query is represented by a "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: configuration (@file{~/.emacs}) something like:
@lisp @lisp
(add-to-list 'mu4e-bookmarks (add-to-list 'mu4e-bookmarks
(make-mu4e-bookmark '( :name "Big messages"
:name "Big messages"
:query "size:5M..500M" :query "size:5M..500M"
:key ?b)) :key ?b))
@end lisp @end lisp
@ -2023,8 +2018,7 @@ inbox:
@lisp @lisp
(add-to-list 'mu4e-bookmarks (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:" :query (lambda () (concat "maildir:/inbox AND date:"
(format-time-string "%Y%m%d" (format-time-string "%Y%m%d"
(subtract-time (current-time) (days-to-time 7))))) (subtract-time (current-time) (days-to-time 7)))))
@ -2042,9 +2036,8 @@ shown:
(format-time-string "%Y%m%d" start-date)))) (format-time-string "%Y%m%d" start-date))))
(add-to-list 'mu4e-bookmarks (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 () (call-interactively 'my/mu4e-bookmark-num-days-old-query))
:query (lambda () (call-interactively 'my/mu4e-bookmark-num-days-old-query))
:key ?o) t) :key ?o) t)
@end lisp @end lisp