diff options
author | Bastien Guerry <bzg@altern.org> | 2012-12-23 00:31:14 +0100 |
---|---|---|
committer | Bastien Guerry <bzg@altern.org> | 2012-12-23 00:31:14 +0100 |
commit | 0f7500704e41ce4291feeefd85fd4974cb4b5eee (patch) | |
tree | 75ed48f06abc467661115b624ecf0451ea4e7667 | |
parent | 416357c82c3e72bbc5722f71d488618fa5aa6823 (diff) | |
download | org-mode-0f7500704e41ce4291feeefd85fd4974cb4b5eee.tar.gz |
org.el: Introduce a tiny syntax table for a new function `org-transpose-words'
* org.el (org-syntax-table): New variable.
(org-transpose-words): New command, simply wrapping the new
syntax table around `transpose-words'.
(org-mode-map): Bind `org-transpose-words' to `M-t'.
Thanks to Eric Abrahamsen for this idea.
-rw-r--r-- | lisp/org.el | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lisp/org.el b/lisp/org.el index 4b17950..267495b 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -3882,6 +3882,13 @@ Use customize to modify this, or restart Emacs after changing it." (string :tag "HTML end tag") (option (const verbatim))))) +(defvar org-syntax-table + (let ((st (make-syntax-table))) + (mapc (lambda(c) (modify-syntax-entry + (string-to-char (car c)) "w p" st)) + org-emphasis-alist) + st)) + (defvar org-protecting-blocks '("src" "example" "latex" "ascii" "html" "docbook" "ditaa" "dot" "r" "R") "Blocks that contain text that is quoted, i.e. not processed as Org syntax. @@ -18287,6 +18294,7 @@ BEG and END default to the buffer boundaries." (org-defkey narrow-map "e" 'org-narrow-to-element) (org-defkey org-mode-map "\C-xne" 'org-narrow-to-element)) (org-defkey org-mode-map "\C-\M-t" 'org-transpose-element) +(org-defkey org-mode-map "\M-t" 'org-transpose-words) (org-defkey org-mode-map "\M-}" 'org-forward-element) (org-defkey org-mode-map "\M-{" 'org-backward-element) (org-defkey org-mode-map "\C-c\C-^" 'org-up-element) @@ -22513,6 +22521,12 @@ ones already marked." (org-element-property :begin elem) (org-element-property :end elem)))))) +(defun org-transpose-words () + "Transpose words, using `org-mode' syntax table." + (interactive) + (with-syntax-table org-syntax-table + (call-interactively 'transpose-words))) + (defun org-transpose-element () "Transpose current and previous elements, keeping blank lines between. Point is moved after both elements." |