emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* including emphasis characters as word characters?
@ 2012-11-21  5:19 Eric Abrahamsen
  2012-11-21 13:46 ` Suvayu Ali
  2012-12-22 23:30 ` Bastien
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Abrahamsen @ 2012-11-21  5:19 UTC (permalink / raw)
  To: emacs-orgmode

Would it make sense to add the markup characters (ie, the car of every
item in `org-emphasis-alist') to the list of word characters, so that as
we're moving/deleting/transposing by word in org, the markup characters
are included? I mean with a sentence like:

#+BEGIN_SRC org
I read a book called /Fortress Besieged/ and it was awful.
#+END_SRC

If point is at end of the sentence, I'd like to be able to hit "M-6 M-b"
and have point end up just before the first slash, then hit "M-2 M-d" and
kill both words plus second slash.

Would this be a bad idea for some reason?

Ta,
Eric

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

* Re: including emphasis characters as word characters?
  2012-11-21  5:19 including emphasis characters as word characters? Eric Abrahamsen
@ 2012-11-21 13:46 ` Suvayu Ali
  2012-11-22  2:10   ` Eric Abrahamsen
  2012-12-22 23:30 ` Bastien
  1 sibling, 1 reply; 5+ messages in thread
From: Suvayu Ali @ 2012-11-21 13:46 UTC (permalink / raw)
  To: emacs-orgmode

On Wed, Nov 21, 2012 at 01:19:54PM +0800, Eric Abrahamsen wrote:
> Would it make sense to add the markup characters (ie, the car of every
> item in `org-emphasis-alist') to the list of word characters, so that as
> we're moving/deleting/transposing by word in org, the markup characters
> are included? I mean with a sentence like:
> 
> #+BEGIN_SRC org
> I read a book called /Fortress Besieged/ and it was awful.
> #+END_SRC
> 
> If point is at end of the sentence, I'd like to be able to hit "M-6 M-b"
> and have point end up just before the first slash, then hit "M-2 M-d" and
> kill both words plus second slash.
> 
> Would this be a bad idea for some reason?
> 

IMO unless it can be done conditionally, as in it is not part of a word
when not used as markup, it will be very bad.  What about legitimate
uses like:

  I am feeling blue / green.

or,

  Addition is denoted by the + sign.

...?

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: including emphasis characters as word characters?
  2012-11-21 13:46 ` Suvayu Ali
@ 2012-11-22  2:10   ` Eric Abrahamsen
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Abrahamsen @ 2012-11-22  2:10 UTC (permalink / raw)
  To: emacs-orgmode

Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:

> On Wed, Nov 21, 2012 at 01:19:54PM +0800, Eric Abrahamsen wrote:
>> Would it make sense to add the markup characters (ie, the car of every
>> item in `org-emphasis-alist') to the list of word characters, so that as
>> we're moving/deleting/transposing by word in org, the markup characters
>> are included? I mean with a sentence like:
>> 
>> #+BEGIN_SRC org
>> I read a book called /Fortress Besieged/ and it was awful.
>> #+END_SRC
>> 
>> If point is at end of the sentence, I'd like to be able to hit "M-6 M-b"
>> and have point end up just before the first slash, then hit "M-2 M-d" and
>> kill both words plus second slash.
>> 
>> Would this be a bad idea for some reason?
>> 
>
> IMO unless it can be done conditionally, as in it is not part of a word
> when not used as markup, it will be very bad.  What about legitimate
> uses like:
>
>   I am feeling blue / green.
>
> or,
>
>   Addition is denoted by the + sign.

Interesting! In these cases, actually, I like having the slash and plus
be a one-character "word", I find editing the sentence much more
intuitive. But I did notice that now, `transpose-words' can produce some
ugly results. Before, with point between the two words:

/Fortress Beseiged/ -->  /Beseiged Fortress/

Now:

/Beseiged Fortress/ --> Fortress/ /Beseiged

Not so good. Perhaps what I actually want is to give these markup
characters "parenthesis"-type syntax. I'll give that a shot.

Editing preferences are subjective, but I'm also worried this will play
havoc with export/tables/table formulas/source blocks. I'll just run it
for a while and see what breaks.

Thanks for the input.

Eric


FYI, here's what I'm using, in a hook:

--8<---------------cut here---------------start------------->8---
(defun my-emph-to-word ()
  (when (eq major-mode 'org-mode)
    (mapc (lambda (x)
	    (modify-syntax-entry (string-to-char (car x)) "w"))
	  org-emphasis-alist)))
--8<---------------cut here---------------end--------------->8---

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

* Re: including emphasis characters as word characters?
  2012-11-21  5:19 including emphasis characters as word characters? Eric Abrahamsen
  2012-11-21 13:46 ` Suvayu Ali
@ 2012-12-22 23:30 ` Bastien
  2012-12-23  4:14   ` Eric Abrahamsen
  1 sibling, 1 reply; 5+ messages in thread
From: Bastien @ 2012-12-22 23:30 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: emacs-orgmode

Hi Eric,

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Would it make sense to add the markup characters (ie, the car of every
> item in `org-emphasis-alist') to the list of word characters, so that as
> we're moving/deleting/transposing by word in org, the markup characters
> are included? I mean with a sentence like:
>
> #+BEGIN_SRC org
> I read a book called /Fortress Besieged/ and it was awful.
> #+END_SRC
>
> If point is at end of the sentence, I'd like to be able to hit "M-6 M-b"
> and have point end up just before the first slash, then hit "M-2 M-d" and
> kill both words plus second slash.
>
> Would this be a bad idea for some reason?

I think it is a good idea to use a syntax table for these characters,
but not for org-mode in general.  So there is now `org-transpose-words'
which uses the new syntax table temporarily.

Thanks for this,

-- 
 Bastien

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

* Re: including emphasis characters as word characters?
  2012-12-22 23:30 ` Bastien
@ 2012-12-23  4:14   ` Eric Abrahamsen
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Abrahamsen @ 2012-12-23  4:14 UTC (permalink / raw)
  To: emacs-orgmode

Bastien <bzg@altern.org> writes:

> Hi Eric,
>
> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> Would it make sense to add the markup characters (ie, the car of every
>> item in `org-emphasis-alist') to the list of word characters, so that as
>> we're moving/deleting/transposing by word in org, the markup characters
>> are included? I mean with a sentence like:
>>
>> #+BEGIN_SRC org
>> I read a book called /Fortress Besieged/ and it was awful.
>> #+END_SRC
>>
>> If point is at end of the sentence, I'd like to be able to hit "M-6 M-b"
>> and have point end up just before the first slash, then hit "M-2 M-d" and
>> kill both words plus second slash.
>>
>> Would this be a bad idea for some reason?
>
> I think it is a good idea to use a syntax table for these characters,
> but not for org-mode in general.  So there is now `org-transpose-words'
> which uses the new syntax table temporarily.

Cool!

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

end of thread, other threads:[~2012-12-23  4:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-21  5:19 including emphasis characters as word characters? Eric Abrahamsen
2012-11-21 13:46 ` Suvayu Ali
2012-11-22  2:10   ` Eric Abrahamsen
2012-12-22 23:30 ` Bastien
2012-12-23  4:14   ` Eric Abrahamsen

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).