[Org] Add link types for Outlook and OneNote

This commit is contained in:
Daniel - 2019-05-31 21:28:44 +02:00
parent 71a11c52db
commit 63b2e34be4
No known key found for this signature in database
GPG Key ID: 1C7071A75BB72D64
2 changed files with 30 additions and 1 deletions

19
init.el
View File

@ -567,7 +567,9 @@ search commands like `db/helm-shortcuts."
db/pretty-print-xml
db/bookmark-add-external
db/bookmark-add-url
db/lookup-smime-key))
db/lookup-smime-key
db/org-onenote-open
db/org-outlook-open))
(use-package hydra
:commands (defhydra))
@ -643,6 +645,16 @@ search commands like `db/helm-shortcuts."
hydra-org-clock/body
db/make-org-capture-frame))
(defcustom db/path-to-onenote "c:/Program Files (x86)/Microsoft Office/Office15/ONENOTE.EXE"
"Path to OneNote executable, for opening corresponding org-mode links."
:group 'personal-settings
:type 'file)
(defcustom db/path-to-outlook "c:/Program Files (x86)/Microsoft Office/Office15/OUTLOOK.EXE"
"Path to Outlook executable, for opening corresponding org-mode links."
:group 'personal-settings
:type 'file)
(use-package org
:commands (org-store-link)
:bind (:map org-mode-map
@ -762,6 +774,11 @@ search commands like `db/helm-shortcuts."
(when (eq system-type 'cygwin)
(add-to-list 'org-file-apps '(t . "cygstart %s") t))
;; Custom link types for Windows
(when (eq system-type 'windows-nt)
(org-link-set-parameters "onenote" :follow #'db/org-onenote-open)
(org-link-set-parameters "outlook" :follow #'db/org-outlook-open))
;; Skip some org mode regions to be skipped by ispell
(add-hook 'org-mode-hook #'endless/org-ispell)

View File

@ -507,6 +507,18 @@ This is done only if the value of this variable is not null."
(call-process "xrandr" nil nil nil
"--output" "HDMI-3" "--off"))
(defun db/org-onenote-open (path)
"Visit OneNote document on PATH."
(unless (file-executable-p db/path-to-onenote)
(user-error "Path for OneNote is not executable, please customize `db/path-to-onenote."))
(start-process "OneNote" nil db/path-to-onenote "/hyperlink" path))
(defun db/org-outlook-open (id)
"Open the Outlook item identified by ID.
ID should be an Outlook GUID."
(unless (file-executable-p db/path-to-outlook)
(user-error "Path for Outlook is not executable, please customize `db/path-to-outlook."))
(w32-shell-execute "open" db/path-to-outlook (concat "/select outlook:" id)))
;;; Bookmarks