emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: emacs-orgmode@gnu.org
Subject: [PATCH] org-transpose-word: inherit text mode syntax table?
Date: Mon, 03 Nov 2014 11:24:58 -0800	[thread overview]
Message-ID: <87y4rsgk8l.fsf@ericabrahamsen.net> (raw)

[-- 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


             reply	other threads:[~2014-11-03 19:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-03 19:24 Eric Abrahamsen [this message]
2014-11-03 20:12 ` [PATCH] org-transpose-word: inherit text mode syntax table? Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y4rsgk8l.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).