Update notmuch shortcuts #emacs
This commit is contained in:
@ -20,7 +20,7 @@
|
|||||||
(map!
|
(map!
|
||||||
(:leader
|
(:leader
|
||||||
(:prefix "e"
|
(:prefix "e"
|
||||||
:desc "Open (i)nbox" "i" #'=mail
|
:desc "Open (i)nbox" "i" #'=notmuch
|
||||||
:desc "Open (n)otmuch" "n" #'notmuch
|
:desc "Open (n)otmuch" "n" #'notmuch
|
||||||
:desc "(C)ompose mail" "c" #'notmuch-mua-new-mail))))
|
:desc "(C)ompose mail" "c" #'notmuch-mua-new-mail))))
|
||||||
|
|
||||||
@ -34,8 +34,8 @@
|
|||||||
;; (add-hook 'notmuch-message-mode-hook '+mail/buffer-face-mode-notmuch)
|
;; (add-hook 'notmuch-message-mode-hook '+mail/buffer-face-mode-notmuch)
|
||||||
(add-hook 'notmuch-message-mode-hook (lambda () (set (make-local-variable 'company-backends) '(notmuch-company (company-ispell :with company-yasnippet)))))
|
(add-hook 'notmuch-message-mode-hook (lambda () (set (make-local-variable 'company-backends) '(notmuch-company (company-ispell :with company-yasnippet)))))
|
||||||
(add-hook 'notmuch-tree-mode-hook (lambda () (setq-local line-spacing nil)))
|
(add-hook 'notmuch-tree-mode-hook (lambda () (setq-local line-spacing nil)))
|
||||||
(remove-hook 'message-mode-hook #'turn-on-auto-fill)
|
;;(remove-hook 'message-mode-hook #'turn-on-auto-fill)
|
||||||
(remove-hook 'notmuch-message-mode-hook #'turn-on-auto-fill)
|
;;(remove-hook 'notmuch-message-mode-hook #'turn-on-auto-fill)
|
||||||
;; (push 'notmuch-tree-mode evil-snipe-disabled-modes)
|
;; (push 'notmuch-tree-mode evil-snipe-disabled-modes)
|
||||||
;; (push 'notmuch-hello-mode evil-snipe-disabled-modes)
|
;; (push 'notmuch-hello-mode evil-snipe-disabled-modes)
|
||||||
;; (push 'notmuch-search-mode evil-snipe-disabled-modes)
|
;; (push 'notmuch-search-mode evil-snipe-disabled-modes)
|
||||||
@ -318,127 +318,127 @@ matched."
|
|||||||
nil))))
|
nil))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +mail/notmuch-hello-insert-searches (title query-list &rest options)
|
;(defun +mail/notmuch-hello-insert-searches (title query-list &rest options)
|
||||||
"Insert a section with TITLE showing a list of buttons made from QUERY-LIST.
|
; "Insert a section with TITLE showing a list of buttons made from QUERY-LIST.
|
||||||
QUERY-LIST should ideally be a plist but for backwards
|
;QUERY-LIST should ideally be a plist but for backwards
|
||||||
compatibility other forms are also accepted (see
|
;compatibility other forms are also accepted (see
|
||||||
`notmuch-saved-searches' for details). The plist should
|
;`notmuch-saved-searches' for details). The plist should
|
||||||
contain keys :name and :query; if :count-query is also present
|
;contain keys :name and :query; if :count-query is also present
|
||||||
then it specifies an alternate query to be used to generate the
|
;then it specifies an alternate query to be used to generate the
|
||||||
count for the associated search.
|
;count for the associated search.
|
||||||
Supports the following entries in OPTIONS as a plist:
|
;Supports the following entries in OPTIONS as a plist:
|
||||||
:initially-hidden - if non-nil, section will be hidden on startup
|
;:initially-hidden - if non-nil, section will be hidden on startup
|
||||||
:show-empty-searches - show buttons with no matching messages
|
;:show-empty-searches - show buttons with no matching messages
|
||||||
:hide-if-empty - hide if no buttons would be shown
|
;:hide-if-empty - hide if no buttons would be shown
|
||||||
(only makes sense without :show-empty-searches)
|
; (only makes sense without :show-empty-searches)
|
||||||
:filter - This can be a function that takes the search query as its argument and
|
;:filter - This can be a function that takes the search query as its argument and
|
||||||
returns a filter to be used in conjuction with the query for that search or nil
|
; returns a filter to be used in conjuction with the query for that search or nil
|
||||||
to hide the element. This can also be a string that is used as a combined with
|
; to hide the element. This can also be a string that is used as a combined with
|
||||||
each query using \"and\".
|
; each query using \"and\".
|
||||||
:filter-count - Separate filter to generate the count displayed each search. Accepts
|
;:filter-count - Separate filter to generate the count displayed each search. Accepts
|
||||||
the same values as :filter. If :filter and :filter-count are specified, this
|
; the same values as :filter. If :filter and :filter-count are specified, this
|
||||||
will be used instead of :filter, not in conjunction with it."
|
; will be used instead of :filter, not in conjunction with it."
|
||||||
(widget-insert (propertize title 'face 'org-agenda-structure))
|
; (widget-insert (propertize title 'face 'org-agenda-structure))
|
||||||
(if (and notmuch-hello-first-run (plist-get options :initially-hidden))
|
; (if (and notmuch-hello-first-run (plist-get options :initially-hidden))
|
||||||
(add-to-list 'notmuch-hello-hidden-sections title))
|
; (add-to-list 'notmuch-hello-hidden-sections title))
|
||||||
(let ((is-hidden (member title notmuch-hello-hidden-sections))
|
; (let ((is-hidden (member title notmuch-hello-hidden-sections))
|
||||||
(widget-push-button-prefix "")
|
; (widget-push-button-prefix "")
|
||||||
(widget-push-button-suffix "")
|
; (widget-push-button-suffix "")
|
||||||
(start (point)))
|
; (start (point)))
|
||||||
(if is-hidden
|
; (if is-hidden
|
||||||
(widget-create 'push-button
|
; (widget-create 'push-button
|
||||||
:notify `(lambda (widget &rest ignore)
|
; :notify `(lambda (widget &rest ignore)
|
||||||
(setq notmuch-hello-hidden-sections
|
; (setq notmuch-hello-hidden-sections
|
||||||
(delete ,title notmuch-hello-hidden-sections))
|
; (delete ,title notmuch-hello-hidden-sections))
|
||||||
(notmuch-hello-update))
|
; (notmuch-hello-update))
|
||||||
(propertize " +" 'face 'org-agenda-structure))
|
; (propertize " +" 'face 'org-agenda-structure))
|
||||||
(widget-create 'push-button
|
; (widget-create 'push-button
|
||||||
:notify `(lambda (widget &rest ignore)
|
; :notify `(lambda (widget &rest ignore)
|
||||||
(add-to-list 'notmuch-hello-hidden-sections
|
; (add-to-list 'notmuch-hello-hidden-sections
|
||||||
,title)
|
; ,title)
|
||||||
(notmuch-hello-update))
|
; (notmuch-hello-update))
|
||||||
" -"))
|
; " -"))
|
||||||
(widget-insert "\n")
|
; (widget-insert "\n")
|
||||||
(when (not is-hidden)
|
; (when (not is-hidden)
|
||||||
(let ((searches (apply 'notmuch-hello-query-counts query-list options)))
|
; (let ((searches (apply 'notmuch-hello-query-counts query-list options)))
|
||||||
(when (or (not (plist-get options :hide-if-empty))
|
; (when (or (not (plist-get options :hide-if-empty))
|
||||||
searches)
|
; searches)
|
||||||
(widget-insert "\n")
|
; (widget-insert "\n")
|
||||||
(notmuch-hello-insert-buttons searches)
|
; (notmuch-hello-insert-buttons searches)
|
||||||
(indent-rigidly start (point) notmuch-hello-indent))))))
|
; (indent-rigidly start (point) notmuch-hello-indent))))))
|
||||||
|
;
|
||||||
;;;###autoload
|
;;;;###autoload
|
||||||
(defun +mail/notmuch-hello-insert-saved-searches ()
|
;(defun +mail/notmuch-hello-insert-saved-searches ()
|
||||||
"Insert the saved-searches section."
|
; "Insert the saved-searches section."
|
||||||
(let ((searches (notmuch-hello-query-counts
|
; (let ((searches (notmuch-hello-query-counts
|
||||||
(if notmuch-saved-search-sort-function
|
; (if notmuch-saved-search-sort-function
|
||||||
(funcall notmuch-saved-search-sort-function
|
; (funcall notmuch-saved-search-sort-function
|
||||||
notmuch-saved-searches)
|
; notmuch-saved-searches)
|
||||||
notmuch-saved-searches)
|
; notmuch-saved-searches)
|
||||||
:show-empty-searches notmuch-show-empty-saved-searches)))
|
; :show-empty-searches notmuch-show-empty-saved-searches)))
|
||||||
(when searches
|
; (when searches
|
||||||
(widget-insert (propertize "Notmuch" 'face 'org-agenda-date-today))
|
; (widget-insert (propertize "Notmuch" 'face 'org-agenda-date-today))
|
||||||
(widget-insert "\n\n")
|
; (widget-insert "\n\n")
|
||||||
(widget-insert (propertize "Saved searches" 'face 'org-agenda-structure))
|
; (widget-insert (propertize "Saved searches" 'face 'org-agenda-structure))
|
||||||
(widget-insert "\n\n")
|
; (widget-insert "\n\n")
|
||||||
(let ((start (point)))
|
; (let ((start (point)))
|
||||||
(notmuch-hello-insert-buttons searches)
|
; (notmuch-hello-insert-buttons searches)
|
||||||
(indent-rigidly start (point) notmuch-hello-indent)))))
|
; (indent-rigidly start (point) notmuch-hello-indent)))))
|
||||||
|
;
|
||||||
;;;###autoload
|
;;;;###autoload
|
||||||
(defun +mail/notmuch-hello-insert-buttons (searches)
|
;(defun +mail/notmuch-hello-insert-buttons (searches)
|
||||||
"Insert buttons for SEARCHES.
|
; "Insert buttons for SEARCHES.
|
||||||
SEARCHES must be a list of plists each of which should contain at
|
;SEARCHES must be a list of plists each of which should contain at
|
||||||
least the properties :name NAME :query QUERY and :count COUNT,
|
;least the properties :name NAME :query QUERY and :count COUNT,
|
||||||
where QUERY is the query to start when the button for the
|
;where QUERY is the query to start when the button for the
|
||||||
corresponding entry is activated, and COUNT should be the number
|
;corresponding entry is activated, and COUNT should be the number
|
||||||
of messages matching the query. Such a plist can be computed
|
;of messages matching the query. Such a plist can be computed
|
||||||
with `notmuch-hello-query-counts'."
|
;with `notmuch-hello-query-counts'."
|
||||||
(let* ((widest (notmuch-hello-longest-label searches))
|
; (let* ((widest (notmuch-hello-longest-label searches))
|
||||||
(tags-and-width (notmuch-hello-tags-per-line widest))
|
; (tags-and-width (notmuch-hello-tags-per-line widest))
|
||||||
(tags-per-line (car tags-and-width))
|
; (tags-per-line (car tags-and-width))
|
||||||
(column-width (cdr tags-and-width))
|
; (column-width (cdr tags-and-width))
|
||||||
(column-indent 0)
|
; (column-indent 0)
|
||||||
(count 0)
|
; (count 0)
|
||||||
(reordered-list (notmuch-hello-reflect searches tags-per-line))
|
; (reordered-list (notmuch-hello-reflect searches tags-per-line))
|
||||||
;; Hack the display of the buttons used.
|
; ;; Hack the display of the buttons used.
|
||||||
(widget-push-button-prefix "")
|
; (widget-push-button-prefix "")
|
||||||
(widget-push-button-suffix ""))
|
; (widget-push-button-suffix ""))
|
||||||
;; dme: It feels as though there should be a better way to
|
; ;; dme: It feels as though there should be a better way to
|
||||||
;; implement this loop than using an incrementing counter.
|
; ;; implement this loop than using an incrementing counter.
|
||||||
(mapc (lambda (elem)
|
; (mapc (lambda (elem)
|
||||||
;; (not elem) indicates an empty slot in the matrix.
|
; ;; (not elem) indicates an empty slot in the matrix.
|
||||||
(when elem
|
; (when elem
|
||||||
(if (> column-indent 0)
|
; (if (> column-indent 0)
|
||||||
(widget-insert (make-string column-indent ? )))
|
; (widget-insert (make-string column-indent ? )))
|
||||||
(let* ((name (plist-get elem :name))
|
; (let* ((name (plist-get elem :name))
|
||||||
(query (plist-get elem :query))
|
; (query (plist-get elem :query))
|
||||||
(oldest-first (case (plist-get elem :sort-order)
|
; (oldest-first (case (plist-get elem :sort-order)
|
||||||
(newest-first nil)
|
; (newest-first nil)
|
||||||
(oldest-first t)
|
; (oldest-first t)
|
||||||
(otherwise notmuch-search-oldest-first)))
|
; (otherwise notmuch-search-oldest-first)))
|
||||||
(search-type (eq (plist-get elem :search-type) 'tree))
|
; (search-type (eq (plist-get elem :search-type) 'tree))
|
||||||
(msg-count (plist-get elem :count)))
|
; (msg-count (plist-get elem :count)))
|
||||||
(widget-insert (format "\n%5s "
|
; (widget-insert (format "\n%5s "
|
||||||
(notmuch-hello-nice-number msg-count)))
|
; (notmuch-hello-nice-number msg-count)))
|
||||||
(widget-create 'push-button
|
; (widget-create 'push-button
|
||||||
:notify #'notmuch-hello-widget-search
|
; :notify #'notmuch-hello-widget-search
|
||||||
:notmuch-search-terms query
|
; :notmuch-search-terms query
|
||||||
:notmuch-search-oldest-first oldest-first
|
; :notmuch-search-oldest-first oldest-first
|
||||||
:notmuch-search-type search-type
|
; :notmuch-search-type search-type
|
||||||
name)
|
; name)
|
||||||
(setq column-indent
|
; (setq column-indent
|
||||||
(1+ (max 0 (- column-width (length name)))))))
|
; (1+ (max 0 (- column-width (length name)))))))
|
||||||
(setq count (1+ count))
|
; (setq count (1+ count))
|
||||||
(when (eq (% count tags-per-line) 0)
|
; (when (eq (% count tags-per-line) 0)
|
||||||
(setq column-indent 0)
|
; (setq column-indent 0)
|
||||||
(widget-insert "\n")))
|
; (widget-insert "\n")))
|
||||||
reordered-list)
|
; reordered-list)
|
||||||
|
;
|
||||||
;; If the last line was not full (and hence did not include a
|
; ;; If the last line was not full (and hence did not include a
|
||||||
;; carriage return), insert one now.
|
; ;; carriage return), insert one now.
|
||||||
(unless (eq (% count tags-per-line) 0)
|
; (unless (eq (% count tags-per-line) 0)
|
||||||
(widget-insert "\n"))))
|
; (widget-insert "\n"))))
|
||||||
|
|
||||||
|
|
||||||
; Kill email message buffers when you close them
|
; Kill email message buffers when you close them
|
||||||
|
|||||||
Reference in New Issue
Block a user