mirror of https://github.com/djcb/mu.git
mu4e: revamp emacs bookmark support
The support for emacs in bookmarks in mu4e-contrib has been broken for a while; we removed it an now re-implement it as part of mu4e-proper. Fixes: issue #2255.
This commit is contained in:
parent
8720310679
commit
59022e066d
|
@ -1190,6 +1190,9 @@ The following specs are supported:
|
|||
(add-function :before-until (local 'eldoc-documentation-function)
|
||||
#'mu4e-headers-eldoc-function))))
|
||||
|
||||
;; support bookmarks.
|
||||
(set (make-local-variable 'bookmark-make-record-function)
|
||||
'mu4e--make-bookmark-record)
|
||||
;; maybe update the current headers upon indexing changes
|
||||
(add-hook 'mu4e-index-updated-hook #'mu4e~headers-maybe-auto-update)
|
||||
(setq
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
;;; mu4e-helpers.el -- part of mu4e -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2021 Dirk-Jan C. Binnema
|
||||
;; Copyright (C) 2022 Dirk-Jan C. Binnema
|
||||
|
||||
;; Author: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||
;; Maintainer: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||
|
@ -30,6 +30,7 @@
|
|||
(require 'seq)
|
||||
(require 'ido)
|
||||
(require 'cl-lib)
|
||||
(require 'bookmark)
|
||||
|
||||
(require 'mu4e-config)
|
||||
|
||||
|
@ -521,6 +522,30 @@ Or go to the top level if there is none."
|
|||
('mu4e-view-mode "(mu4e)Message view")
|
||||
(_ "mu4e"))))
|
||||
|
||||
|
||||
;;; bookmarks
|
||||
(defun mu4e--make-bookmark-record ()
|
||||
"Create a bookmark for the message at point."
|
||||
(let* ((msg (mu4e-message-at-point))
|
||||
(subject (or (plist-get msg :subject) "No subject"))
|
||||
(date (plist-get msg :date))
|
||||
(date (if date (format-time-string "%F: " date) ""))
|
||||
(title (format "%s%s" date subject))
|
||||
(msgid (or (plist-get msg :message-id)
|
||||
(mu4e-error "Cannot bookmark message without message-id"))))
|
||||
`(,title
|
||||
,@(bookmark-make-record-default 'no-file 'no-context)
|
||||
(message-id . ,msgid)
|
||||
(handler . mu4e--jump-to-bookmark))))
|
||||
|
||||
(declare-function mu4e-view-message-with-message-id "mu4e-view")
|
||||
(declare-function mu4e-message-at-point "mu4e-message")
|
||||
|
||||
(defun mu4e--jump-to-bookmark (bookmark)
|
||||
"View the message referred to by BOOKMARK."
|
||||
(when-let ((msgid (bookmark-prop-get bookmark 'message-id)))
|
||||
(mu4e-view-message-with-message-id msgid)))
|
||||
|
||||
;;; Macros
|
||||
|
||||
(defmacro mu4e-setq-if-nil (var val)
|
||||
|
|
|
@ -1052,6 +1052,11 @@ Based on Gnus' article-mode."
|
|||
(mu4e-context-minor-mode)
|
||||
(mu4e-search-minor-mode)
|
||||
(setq buffer-undo-list t);; don't record undo info
|
||||
|
||||
;; support bookmarks.
|
||||
(set (make-local-variable 'bookmark-make-record-function)
|
||||
'mu4e--make-bookmark-record)
|
||||
|
||||
;; autopair mode gives error when pressing RET
|
||||
;; turn it off
|
||||
(when (boundp 'autopair-dont-activate)
|
||||
|
|
|
@ -2996,6 +2996,7 @@ with other tools.
|
|||
|
||||
@menu
|
||||
* Emacs default::Making mu4e the default emacs e-mail program
|
||||
* Emacs bookmarks::Using Emacs' bookmark system
|
||||
* Org-mode links::Adding mu4e to your organized life
|
||||
* Org-contacts::Hooking up with org-contacts
|
||||
* BBDB::Hooking up with the Insidious Big Brother Database
|
||||
|
@ -3028,6 +3029,16 @@ mail, customize the variable @code{read-mail-command}.
|
|||
|
||||
(@pxref{Top,,Emacs,Sending Mail, Mail Methods})
|
||||
|
||||
|
||||
@node Emacs bookmarks
|
||||
@section Emacs bookmarks
|
||||
|
||||
@t{mu4e} supports linking to the message-at-point through the normal
|
||||
Emacs built-in bookmark system. The links are based on the message's
|
||||
message-id, and thus the bookmarks stay valid even if you move the
|
||||
message around.
|
||||
|
||||
|
||||
@node Org-mode links
|
||||
@section Org-mode links
|
||||
|
||||
|
|
Loading…
Reference in New Issue