summaryrefslogtreecommitdiff
path: root/lisp/org-mhe.el
diff options
context:
space:
mode:
authorSébastien Delafond <sdelafond@gmail.com>2016-11-07 10:41:54 +0100
committerSébastien Delafond <sdelafond@gmail.com>2016-11-07 10:41:54 +0100
commitec84430cf4e09ba25ec675debdf802bc28111e06 (patch)
tree9c64bc8a0cd5e8cac82aa5fdf369d40529f140f8 /lisp/org-mhe.el
parent84539dca3aa301ecfe48858eceef1ced0505388b (diff)
Imported Upstream version 9.0
Diffstat (limited to 'lisp/org-mhe.el')
-rw-r--r--lisp/org-mhe.el39
1 files changed, 15 insertions, 24 deletions
diff --git a/lisp/org-mhe.el b/lisp/org-mhe.el
index e8abef9..5d9ae58 100644
--- a/lisp/org-mhe.el
+++ b/lisp/org-mhe.el
@@ -1,4 +1,4 @@
-;;; org-mhe.el --- Support for links to MH-E messages from within Org-mode
+;;; org-mhe.el --- Support for Links to MH-E Messages -*- lexical-binding: t; -*-
;; Copyright (C) 2004-2016 Free Software Foundation, Inc.
@@ -24,8 +24,8 @@
;;
;;; Commentary:
-;; This file implements links to MH-E messages from within Org-mode.
-;; Org-mode loads this module by default - if this is not what you want,
+;; This file implements links to MH-E messages from within Org.
+;; Org mode loads this module by default - if this is not what you want,
;; configure the variable `org-modules'.
;;; Code:
@@ -74,34 +74,25 @@ supported by MH-E."
(defvar mh-search-regexp-builder)
;; Install the link type
-(org-add-link-type "mhe" 'org-mhe-open)
-(add-hook 'org-store-link-functions 'org-mhe-store-link)
+(org-link-set-parameters "mhe" :follow #'org-mhe-open :store #'org-mhe-store-link)
;; Implementation
(defun org-mhe-store-link ()
"Store a link to an MH-E folder or message."
- (when (or (equal major-mode 'mh-folder-mode)
- (equal major-mode 'mh-show-mode))
+ (when (or (eq major-mode 'mh-folder-mode)
+ (eq major-mode 'mh-show-mode))
(save-window-excursion
(let* ((from (org-mhe-get-header "From:"))
(to (org-mhe-get-header "To:"))
(message-id (org-mhe-get-header "Message-Id:"))
(subject (org-mhe-get-header "Subject:"))
(date (org-mhe-get-header "Date:"))
- (date-ts (and date (format-time-string
- (org-time-stamp-format t) (date-to-time date))))
- (date-ts-ia (and date (format-time-string
- (org-time-stamp-format t t)
- (date-to-time date))))
link desc)
- (org-store-link-props :type "mh" :from from :to to
+ (org-store-link-props :type "mh" :from from :to to :date date
:subject subject :message-id message-id)
- (when date
- (org-add-link-props :date date :date-timestamp date-ts
- :date-timestamp-inactive date-ts-ia))
(setq desc (org-email-link-description))
(setq link (concat "mhe:" (org-mhe-get-message-real-folder) "#"
- (org-remove-angle-brackets message-id)))
+ (org-unbracket-string "<" ">" message-id)))
(org-add-link-props :link link :description desc)
link))))
@@ -120,7 +111,7 @@ supported by MH-E."
So if you use sequences, it will now work."
(save-excursion
(let* ((folder
- (if (equal major-mode 'mh-folder-mode)
+ (if (eq major-mode 'mh-folder-mode)
mh-current-folder
;; Refer to the show buffer
mh-show-folder-buffer))
@@ -132,7 +123,7 @@ So if you use sequences, it will now work."
;; mh-index-data is always nil in a show buffer.
(if (and (boundp 'mh-index-folder)
(string= mh-index-folder (substring folder 0 end-index)))
- (if (equal major-mode 'mh-show-mode)
+ (if (eq major-mode 'mh-show-mode)
(save-window-excursion
(let (pop-up-frames)
(when (buffer-live-p (get-buffer folder))
@@ -158,7 +149,7 @@ So if you use sequences, it will now work."
"Return the name of the current message folder.
Be careful if you use sequences."
(save-excursion
- (if (equal major-mode 'mh-folder-mode)
+ (if (eq major-mode 'mh-folder-mode)
mh-current-folder
;; Refer to the show buffer
mh-show-folder-buffer)))
@@ -167,7 +158,7 @@ Be careful if you use sequences."
"Return the number of the current message.
Be careful if you use sequences."
(save-excursion
- (if (equal major-mode 'mh-folder-mode)
+ (if (eq major-mode 'mh-folder-mode)
(mh-get-msg-num nil)
;; Refer to the show buffer
(mh-show-buffer-message-number))))
@@ -182,12 +173,12 @@ you have a better idea of how to do this then please let us know."
(header-field))
(with-current-buffer buffer
(mh-display-msg num folder)
- (if (equal major-mode 'mh-folder-mode)
+ (if (eq major-mode 'mh-folder-mode)
(mh-header-display)
(mh-show-header-display))
(set-buffer buffer)
(setq header-field (mh-get-header-field header))
- (if (equal major-mode 'mh-folder-mode)
+ (if (eq major-mode 'mh-folder-mode)
(mh-show)
(mh-show-show))
(org-trim header-field))))
@@ -206,7 +197,7 @@ folders."
(if (not article)
(mh-visit-folder (mh-normalize-folder-name folder))
(mh-search-choose)
- (if (equal mh-searcher 'pick)
+ (if (eq mh-searcher 'pick)
(progn
(setq article (org-add-angle-brackets article))
(mh-search folder (list "--message-id" article))