瀏覽代碼

Fix commit 5cdf84ea68

* org.el (org-mode): Don't make characters from
`org-emphasis-alist' word constituants.
(org-mode-transpose-word-syntax-table): Rename from
`org-syntax-table'.
(org-transpose-words): Use
`org-mode-transpose-word-syntax-table'.

Thanks to Achim Gratz and T.F. Torrey for reporting the broken tests.
Bastien Guerry 12 年之前
父節點
當前提交
e8a6b56db9
共有 1 個文件被更改,包括 18 次插入2 次删除
  1. 18 2
      lisp/org.el

+ 18 - 2
lisp/org.el

@@ -5198,8 +5198,7 @@ The following commands are available:
     (org-set-tag-faces 'org-tag-faces org-tag-faces))
   ;; Calc embedded
   (org-set-local 'calc-embedded-open-mode "# ")
-  (mapc (lambda(c) (modify-syntax-entry (string-to-char (car c)) "w p"))
-	org-emphasis-alist)
+  ;; Modify a few syntax entries
   (modify-syntax-entry ?< "(")
   (modify-syntax-entry ?> ")")
   (modify-syntax-entry ?{ "(")
@@ -5297,6 +5296,13 @@ The following commands are available:
   ;; Try to set org-hide correctly
   (set-face-foreground 'org-hide (org-find-invisible-foreground)))
 
+(defvar org-mode-transpose-word-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))
+
 (when (fboundp 'abbrev-table-put)
   (abbrev-table-put org-mode-abbrev-table
 		    :parents (list text-mode-abbrev-table)))
@@ -19043,6 +19049,16 @@ COMMANDS is a list of alternating OLDDEF NEWDEF command names."
 	  (org-defkey map (vector 'remap old) new)
 	(substitute-key-definition old new map global-map)))))
 
+(defun org-transpose-words ()
+  "Transpose words for Org.
+This uses the `org-mode-transpose-word-syntax-table' syntax
+table, which interprets characters in `org-emphasis-alist' as
+word constituants."
+  (interactive)
+  (with-syntax-table org-mode-transpose-word-syntax-table
+    (call-interactively 'transpose-words)))
+(org-remap org-mode-map 'transpose-words 'org-transpose-words)
+
 (when (eq org-enable-table-editor 'optimized)
   ;; If the user wants maximum table support, we need to hijack
   ;; some standard editing functions