unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Should not syntax for ?- char be word in text mode?
@ 2009-07-16  1:41 Lennart Borgman
  2009-07-16  2:26 ` Miles Bader
  2009-07-16  5:39 ` Stephen J. Turnbull
  0 siblings, 2 replies; 8+ messages in thread
From: Lennart Borgman @ 2009-07-16  1:41 UTC (permalink / raw)
  To: Emacs-Devel devel

There are plenty of word with a hyphen in them.




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

* Re: Should not syntax for ?- char be word in text mode?
  2009-07-16  1:41 Should not syntax for ?- char be word in text mode? Lennart Borgman
@ 2009-07-16  2:26 ` Miles Bader
  2009-07-16 12:11   ` Lennart Borgman
  2009-07-16  5:39 ` Stephen J. Turnbull
  1 sibling, 1 reply; 8+ messages in thread
From: Miles Bader @ 2009-07-16  2:26 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: Emacs-Devel devel

No.  Doing so would massively fuck with people's expectations.

It's long-standing Emacs practice to distinguish between "words" and
"symbols", where symbols typically include some extra punctuation such
as "-".

If I see "foo-bar" in _any_ buffer, including in text, I (and perhaps
more importantly, my fingers) expect M-f to skip over foo, and stop at
"-"; if I want to skip over the whole thing, I'll use C-M-f.  Using
modes that violate this convention is extremely disconcerting (and
inconvenient).  Text buffers are no different in this respect.

-Miles

-- 
Erudition, n. Dust shaken out of a book into an empty skull.




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

* Should not syntax for ?- char be word in text mode?
  2009-07-16  1:41 Should not syntax for ?- char be word in text mode? Lennart Borgman
  2009-07-16  2:26 ` Miles Bader
@ 2009-07-16  5:39 ` Stephen J. Turnbull
  2009-07-16  5:53   ` Miles Bader
  1 sibling, 1 reply; 8+ messages in thread
From: Stephen J. Turnbull @ 2009-07-16  5:39 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: Emacs-Devel devel

Lennart Borgman writes:

 > There are plenty of word with a hyphen in them.

python-mode does (or used to do) this with underscore (hyphen of
course denotes an operator in Python).  It got a *lot* of pushback.

The big problem with this suggestion is that it's very often useful to
change part of a hyphenated word, eg, from "pre-2000" to "pre-2005",
or from "sino-soviet" to "Sino-Soviet".

Just use C-M-f etc. when you want wordlike movement that skips past
hyphens and underscores.





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

* Re: Should not syntax for ?- char be word in text mode?
  2009-07-16  5:39 ` Stephen J. Turnbull
@ 2009-07-16  5:53   ` Miles Bader
  2009-07-16 14:05     ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: Miles Bader @ 2009-07-16  5:53 UTC (permalink / raw)
  To: Stephen J. Turnbull; +Cc: Lennart Borgman, Emacs-Devel devel

"Stephen J. Turnbull" <stephen@xemacs.org> writes:
>  > There are plenty of word with a hyphen in them.
>
> python-mode does (or used to do) this with underscore (hyphen of
> course denotes an operator in Python).  It got a *lot* of pushback.

It seems that many mode authors who don't know any better do that (make
things like "_" have word syntax) because it makes writing font-lock
regexps easier.  It's still a horrible idea of course.

[Lua-mode does this as well; it drives me _nuts_...]

Now that we have ?_< and ?_> regexp patterns, there's no technical
reason any more I think...

-miles

-- 
Defenceless, adj. Unable to attack.




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

* Re: Should not syntax for ?- char be word in text mode?
  2009-07-16  2:26 ` Miles Bader
@ 2009-07-16 12:11   ` Lennart Borgman
  2009-07-16 13:40     ` Miles Bader
  2009-07-16 14:02     ` Stefan Monnier
  0 siblings, 2 replies; 8+ messages in thread
From: Lennart Borgman @ 2009-07-16 12:11 UTC (permalink / raw)
  To: Miles Bader; +Cc: Emacs-Devel devel

On Thu, Jul 16, 2009 at 4:26 AM, Miles Bader<miles@gnu.org> wrote:
> No.  Doing so would massively fuck with people's expectations.
>
> It's long-standing Emacs practice to distinguish between "words" and
> "symbols", where symbols typically include some extra punctuation such
> as "-".
>
> If I see "foo-bar" in _any_ buffer, including in text, I (and perhaps
> more importantly, my fingers) expect M-f to skip over foo, and stop at
> "-"; if I want to skip over the whole thing, I'll use C-M-f.  Using
> modes that violate this convention is extremely disconcerting (and
> inconvenient).  Text buffers are no different in this respect.

I think text buffers are different. You normally enter text there, not
programming symbols.

The reason it came to my mind is that I had to change this to get
Predictive to work with Company Mode. Predictive serves the user with
suggestions of English words. (It is supposed to be a
"spell-checker-while-you-write" and make it quicker to write long
words.) Many of these English words includes a hyphen.




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

* Re: Should not syntax for ?- char be word in text mode?
  2009-07-16 12:11   ` Lennart Borgman
@ 2009-07-16 13:40     ` Miles Bader
  2009-07-16 14:02     ` Stefan Monnier
  1 sibling, 0 replies; 8+ messages in thread
From: Miles Bader @ 2009-07-16 13:40 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: Emacs-Devel devel

Lennart Borgman <lennart.borgman@gmail.com> writes:
> I think text buffers are different.

You are wrong.

> You normally enter text there, not programming symbols.

Don't think of "words" and "symbols" as being rigidly linked to outside
definitions.  There's certainly some connection (thus syntax tables),
but they are also _Emacs_ concepts, and in many cases, that's more
important.  This is one such case.

The preservation of user's intuitions about what commands do, and the
"feel" of movement is far more important than being pedantic about
adherence to dictionary definitions.

My fingers don't lie.

-Miles

-- 
Alliance, n. In international politics, the union of two thieves who have
their hands so deeply inserted in each other's pockets that they cannot
separately plunder a third.




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

* Re: Should not syntax for ?- char be word in text mode?
  2009-07-16 12:11   ` Lennart Borgman
  2009-07-16 13:40     ` Miles Bader
@ 2009-07-16 14:02     ` Stefan Monnier
  1 sibling, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2009-07-16 14:02 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: Emacs-Devel devel, Miles Bader

> The reason it came to my mind is that I had to change this to get
> Predictive to work with Company Mode. Predictive serves the user with
> suggestions of English words. (It is supposed to be a
> "spell-checker-while-you-write" and make it quicker to write long
> words.) Many of these English words includes a hyphen.

It's very common to need slight variants of syntax-tables for
various operations.  So just change the syntax-table you use
during completion.


        Stefan




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

* Re: Should not syntax for ?- char be word in text mode?
  2009-07-16  5:53   ` Miles Bader
@ 2009-07-16 14:05     ` Stefan Monnier
  0 siblings, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2009-07-16 14:05 UTC (permalink / raw)
  To: Miles Bader; +Cc: Stephen J. Turnbull, Lennart Borgman, Emacs-Devel devel

> Now that we have ?_< and ?_> regexp patterns, there's no technical
> reason any more I think...

Neither was there before since you could always use
font-lock-syntax-table to get the same result.  Temporarily switching
the syntax-table is a cheap operation that you shouldn't be afraid
to do.  The only operations for which it's difficult/impossible is
buffer navigation like M-f, so the main syntax-table should be careful
not to mark _ as word constituent.


        Stefan




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

end of thread, other threads:[~2009-07-16 14:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-16  1:41 Should not syntax for ?- char be word in text mode? Lennart Borgman
2009-07-16  2:26 ` Miles Bader
2009-07-16 12:11   ` Lennart Borgman
2009-07-16 13:40     ` Miles Bader
2009-07-16 14:02     ` Stefan Monnier
2009-07-16  5:39 ` Stephen J. Turnbull
2009-07-16  5:53   ` Miles Bader
2009-07-16 14:05     ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).