Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 56 lines (51 sloc) 1.671 kb
a59470b @seanohalpin Added more link types; removed redundant code
authored
1 ;;; org-link-minor-mode.el -- Enable org-mode links in non-org modes
cee4479 @seanohalpin initial commit
authored
2 ;;
3 ;; Copyright (C) 2012
4 ;; Author: Sean O'Halpin <sean dot ohalpin at gmail dot com>
5 ;;
a59470b @seanohalpin Added more link types; removed redundant code
authored
6 ;; Enables org-mode links of the form:
cee4479 @seanohalpin initial commit
authored
7 ;;
a59470b @seanohalpin Added more link types; removed redundant code
authored
8 ;; http://www.bbc.co.uk
86a8481 @seanohalpin added man: link as example
authored
9 ;; man:emacs
a59470b @seanohalpin Added more link types; removed redundant code
authored
10 ;; <http://www.bbc.co.uk>
cee4479 @seanohalpin initial commit
authored
11 ;; [[http://www.bbc.co.uk][BBC]]
12 ;; [[org-link-minor-mode]]
a59470b @seanohalpin Added more link types; removed redundant code
authored
13 ;; [2012-08-18]
14 ;; <2012-08-18>
cee4479 @seanohalpin initial commit
authored
15 ;;
16 ;; Note that =org-toggle-link-display= will also work when this mode
17 ;; is enabled.
18 ;;
19
20 (require 'org)
21
22 (define-minor-mode org-link-minor-mode
23 "Toggle display of org-mode style bracket links in non-org-mode buffers."
24 :lighter " org-link"
25
27aca66 @seanohalpin added plain links
authored
26 (let ((org-link-minor-mode-keywords
27 (list
a59470b @seanohalpin Added more link types; removed redundant code
authored
28 '(org-activate-angle-links (0 'org-link t))
27aca66 @seanohalpin added plain links
authored
29 '(org-activate-plain-links)
30 '(org-activate-bracket-links (0 'org-link t))
a59470b @seanohalpin Added more link types; removed redundant code
authored
31 '(org-activate-dates (0 'org-date t))
27aca66 @seanohalpin added plain links
authored
32 ))
33 )
34 (if org-link-minor-mode
35 (if (derived-mode-p 'org-mode)
cee4479 @seanohalpin initial commit
authored
36 (progn
27aca66 @seanohalpin added plain links
authored
37 (message "org-mode doesn't need org-link-minor-mode")
38 (org-link-minor-mode -1)
39 )
40 (font-lock-add-keywords nil org-link-minor-mode-keywords t)
a59470b @seanohalpin Added more link types; removed redundant code
authored
41 (org-set-local 'org-descriptive-links org-descriptive-links)
27aca66 @seanohalpin added plain links
authored
42 (if org-descriptive-links (add-to-invisibility-spec '(org-link)))
43 (org-set-local 'font-lock-unfontify-region-function
44 'org-unfontify-region)
45 (org-restart-font-lock)
46 )
47 (unless (derived-mode-p 'org-mode)
a59470b @seanohalpin Added more link types; removed redundant code
authored
48 (font-lock-remove-keywords nil org-link-minor-mode-keywords)
49 (org-restart-font-lock)
cee4479 @seanohalpin initial commit
authored
50 )
51 )
52 )
53 )
54
55 (provide 'org-link-minor-mode)
Something went wrong with that request. Please try again.