all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] org-transpose-word: inherit text mode syntax table?
@ 2014-11-03 19:24 Eric Abrahamsen
  2014-11-03 20:12 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Abrahamsen @ 2014-11-03 19:24 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 604 bytes --]

Something that has subconsciously bothered me for years:
`org-transpose-words' does its transposition using a blank syntax table,
rather than inheriting from text-mode-syntax-table, meaning we don't get
any of the default text-mode transposition behavior. The most immediate
problem is that apostrophes get "left behind" during transposition. Ie:

I can't| transpose this --> I can transpose|'t this

and not

I can't| transpose this --> I transpose can't| this

The fix would be as simple as the attached patch. I don't know if this
would break anything elsewhere, but I can't imagine it would...

Eric

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Make-org-transpose-words-use-text-mode-syntax-table.patch --]
[-- Type: text/x-diff, Size: 865 bytes --]

From a11bb44a6ab200c4159b03094948bc9b77c0e983 Mon Sep 17 00:00:00 2001
From: Eric Abrahamsen <eric@ericabrahamsen.net>
Date: Mon, 3 Nov 2014 11:22:13 -0800
Subject: [PATCH] Make org-transpose-words use text-mode-syntax-table

* lisp/org.el (org-mode-transpose-word-syntax-table): Make this table
  inherit from `text-mode-syntax-table'.
---
 lisp/org.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 1e7d8d9..c6b0a1c 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5542,7 +5542,7 @@ The following commands are available:
 		   ("8.2.6" . "24.4")))
 
 (defvar org-mode-transpose-word-syntax-table
-  (let ((st (make-syntax-table)))
+  (let ((st (make-syntax-table text-mode-syntax-table)))
     (mapc (lambda(c) (modify-syntax-entry
 		      (string-to-char (car c)) "w p" st))
 	  org-emphasis-alist)
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-11-03 20:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-03 19:24 [PATCH] org-transpose-word: inherit text mode syntax table? Eric Abrahamsen
2014-11-03 20:12 ` Nicolas Goaziou

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.