Skip to content
Newer
Older
100644 61 lines (46 sloc) 1.93 KB
7d75a14 @magnars Added expansions for org-mode
authored Mar 27, 2012
1 ;;; org-mode-expansions.el --- Expansions for expand-region to be used in org-mode
2
3 ;; Copyright (C) 2012 Magnar Sveen
4
5 ;; Author: Magnar Sveen
6 ;; Based on text-mode-expansions by: Ivan Andrus
7 ;; Keywords: marking region
8
9 ;; This program is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation, either version 3 of the License, or
12 ;; (at your option) any later version.
13
14 ;; This program is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
18
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
21
22 ;;; Commentary:
23
24 ;; Feel free to contribute any other expansions for org-mode at
25 ;;
26 ;; https://github.com/magnars/expand-region.el
27
28 ;;; Code:
29
30 (require 'expand-region-core)
31
32 (defun er/mark-sentence ()
33 "Marks one sentence."
34 (interactive)
35 (forward-char 1)
36 (backward-sentence 1)
37 (set-mark (point))
38 (forward-sentence 1)
39 (exchange-point-and-mark))
40
41 (defun er/mark-paragraph ()
42 "Marks one paragraph."
43 (interactive)
44 (mark-paragraph)
45 (exchange-point-and-mark)
46 (skip-chars-backward er--space-str)
47 (exchange-point-and-mark)
48 (skip-chars-forward er--space-str))
49
50 (defun er/add-org-mode-expansions ()
51 "Adds org-specific expansions for buffers in org-mode"
52 (set (make-local-variable 'er/try-expand-list) (append
53 er/try-expand-list
54 '(org-mark-subtree
55 er/mark-sentence
56 er/mark-paragraph))))
57
e45df6d @magnars Use er/enable-mode-expansions when loading mode expansions
authored Oct 23, 2012
58 (er/enable-mode-expansions org-mode er/add-org-mode-expansions)
7d75a14 @magnars Added expansions for org-mode
authored Mar 27, 2012
59
60 (provide 'org-mode-expansions)
Something went wrong with that request. Please try again.