unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* mark-word
@ 2007-11-14  7:35 Andreas Röhler
  2007-11-14  8:11 ` mark-word Stephen J. Turnbull
  0 siblings, 1 reply; 15+ messages in thread
From: Andreas Röhler @ 2007-11-14  7:35 UTC (permalink / raw)
  To: emacs-devel


If mark-word is called while inside a word, it marks
from this point until the end of word first AFAIS, thus
leaving the first part of the word unmarked.

IMO marking the word-at-point completely then would be
a more convenient behaviour.

Any opinions?

Thanks

Andreas Röhler

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

* mark-word
  2007-11-14  7:35 mark-word Andreas Röhler
@ 2007-11-14  8:11 ` Stephen J. Turnbull
  2007-11-14  8:26   ` mark-word David Kastrup
  2007-11-14  8:37   ` mark-word Leo
  0 siblings, 2 replies; 15+ messages in thread
From: Stephen J. Turnbull @ 2007-11-14  8:11 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: emacs-devel

Andreas Röhler writes:

 > If mark-word is called while inside a word, it marks
 > from this point until the end of word first AFAIS, thus
 > leaving the first part of the word unmarked.

 > IMO marking the word-at-point completely then would be
 > a more convenient behaviour.

`mark-word' itself should remain compatible with `kill-word' and
`mark-sexp'.  I think it would be a good idea to have a
`mark-entire-word' command and bind it to M-@, especially since C-@
doesn't mark a character.  Ditto `mark-entire-sexp' and C-M-@.

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

* Re: mark-word
  2007-11-14  8:11 ` mark-word Stephen J. Turnbull
@ 2007-11-14  8:26   ` David Kastrup
  2007-11-14 11:27     ` mark-word Andreas Röhler
  2007-11-14 17:02     ` mark-word Stephen J. Turnbull
  2007-11-14  8:37   ` mark-word Leo
  1 sibling, 2 replies; 15+ messages in thread
From: David Kastrup @ 2007-11-14  8:26 UTC (permalink / raw)
  To: Stephen J. Turnbull; +Cc: Andreas Röhler, emacs-devel

"Stephen J. Turnbull" <stephen@xemacs.org> writes:

> Andreas Röhler writes:
>
>  > If mark-word is called while inside a word, it marks
>  > from this point until the end of word first AFAIS, thus
>  > leaving the first part of the word unmarked.
>
>  > IMO marking the word-at-point completely then would be
>  > a more convenient behaviour.
>
> `mark-word' itself should remain compatible with `kill-word' and
> `mark-sexp'.  I think it would be a good idea to have a
> `mark-entire-word' command and bind it to M-@, especially since C-@
> doesn't mark a character.  Ditto `mark-entire-sexp' and C-M-@.

Since "mark whole ..." for both directions is useful for more than
words, I think it would be more useful to have a prefix for that.

C-u C-u feels natural for "both directions", but to make it
non-surprising, one would likely have to assign separate meaning to C-u
(as opposed to C-u 4).  So probably rather C-u C-@.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: mark-word
  2007-11-14  8:11 ` mark-word Stephen J. Turnbull
  2007-11-14  8:26   ` mark-word David Kastrup
@ 2007-11-14  8:37   ` Leo
  2007-11-14 16:35     ` mark-word Stephen J. Turnbull
  2007-11-15  3:07     ` mark-word Richard Stallman
  1 sibling, 2 replies; 15+ messages in thread
From: Leo @ 2007-11-14  8:37 UTC (permalink / raw)
  To: emacs-devel

On 2007-11-14 08:11 +0000, Stephen J. Turnbull wrote:
> Andreas Röhler writes:
>
>  > If mark-word is called while inside a word, it marks
>  > from this point until the end of word first AFAIS, thus
>  > leaving the first part of the word unmarked.
>
>  > IMO marking the word-at-point completely then would be
>  > a more convenient behaviour.
>
> `mark-word' itself should remain compatible with `kill-word' and
> `mark-sexp'.

Why?

Is mark-paragraph compatible with kill-paragraph?

> I think it would be a good idea to have a `mark-entire-word' command
> and bind it to M-@, especially since C-@ doesn't mark a character.
> Ditto `mark-entire-sexp' and C-M-@.

-- 
.:  Leo  :.  [ sdl.web AT gmail.com ]  .:  [ GPG Key: 9283AA3F ]  :.

          Use the best OS -- http://www.fedoraproject.org/

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

* Re: mark-word
  2007-11-14  8:26   ` mark-word David Kastrup
@ 2007-11-14 11:27     ` Andreas Röhler
  2007-11-14 17:24       ` mark-word Stephen J. Turnbull
  2007-11-14 17:02     ` mark-word Stephen J. Turnbull
  1 sibling, 1 reply; 15+ messages in thread
From: Andreas Röhler @ 2007-11-14 11:27 UTC (permalink / raw)
  To: emacs-devel; +Cc: Stephen Turnbull

Am Mittwoch, 14. November 2007 09:26 schrieb David Kastrup:
> "Stephen J. Turnbull" <stephen@xemacs.org> writes:
> > Andreas Röhler writes:
> >  > If mark-word is called while inside a word, it marks
> >  > from this point until the end of word first AFAIS, thus
> >  > leaving the first part of the word unmarked.
> >  >
> >  > IMO marking the word-at-point completely then would be
> >  > a more convenient behaviour.
> >
> > `mark-word' itself should remain compatible with `kill-word' and
> > `mark-sexp'.  I think it would be a good idea to have a
> > `mark-entire-word' command and bind it to M-@, especially since C-@
> > doesn't mark a character.  Ditto `mark-entire-sexp' and C-M-@.
>
> Since "mark whole ..." for both directions is useful for more than
> words, I think it would be more useful to have a prefix for that.
>
> C-u C-u feels natural for "both directions", but to make it
> non-surprising, one would likely have to assign separate meaning to C-u
> (as opposed to C-u 4).  So probably rather C-u C-@.


What about this?

(defun mark-word-at-point ()
  " "
  (interactive)
  (beginning-of-thing 'word)
  (push-mark nil nil t)
  (end-of-thing 'word))

Andreas Röhler

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

* Re: mark-word
  2007-11-14  8:37   ` mark-word Leo
@ 2007-11-14 16:35     ` Stephen J. Turnbull
  2007-11-15  3:07     ` mark-word Richard Stallman
  1 sibling, 0 replies; 15+ messages in thread
From: Stephen J. Turnbull @ 2007-11-14 16:35 UTC (permalink / raw)
  To: Leo; +Cc: emacs-devel

Leo writes:

 > > `mark-word' itself should remain compatible with `kill-word' and
 > > `mark-sexp'.
 > 
 > Why?

Erm, backward compatibility is a good thing.  "Why *not* preserve it?"
is the right question, and it better have a good answer.

More specifically, mostly because it's a pain in the neck to deal with
functions whose specifications change for the convenience of the UI,
and because it's an offense against the general regularity of names
with no good reason.  True, symbol names are somewhat scarce, but I
rather doubt anyone in their right mind would give `mark-entire-word'
anything but the proposed semantics.  It should be easy for people who
actually prefer that behavior (if any, I admit) to revert.  And some
of us support Emacsen that won't have the change, often simultaneously
with the latest code.  XEmacs does so as project policy, and many
organizational environments will do so too.

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

* Re: mark-word
  2007-11-14  8:26   ` mark-word David Kastrup
  2007-11-14 11:27     ` mark-word Andreas Röhler
@ 2007-11-14 17:02     ` Stephen J. Turnbull
  1 sibling, 0 replies; 15+ messages in thread
From: Stephen J. Turnbull @ 2007-11-14 17:02 UTC (permalink / raw)
  To: David Kastrup; +Cc: Andreas Röhler, emacs-devel

David Kastrup writes:
 > "Stephen J. Turnbull" <stephen@xemacs.org> writes:

 > > I think it would be a good idea to have a `mark-entire-word'
 > > command and bind it to M-@, especially since C-@ doesn't mark a
 > > character.  Ditto `mark-entire-sexp' and C-M-@.
 > 
 > Since "mark whole ..." for both directions is useful for more than
 > words, I think it would be more useful to have a prefix for that.

But we already have a plethora of ways to accomplish this in 2 or 3
keystrokes.  Andreas's point is to get this (very natural) behavior by
default with M-@.  And as you noticed, C-u M-@ already has semantics
("mark the rest of this word and the three following").

Keep it simple, and backward compatible.  It only costs one element in
the objarray, and an xref to `mark-entire-word' in the documentation
of `mark-word'.  There's really not a lot of future developer cost due
to extra complexity here, since nobody except UI programmers should be
using these commands in programs.

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

* Re: mark-word
  2007-11-14 11:27     ` mark-word Andreas Röhler
@ 2007-11-14 17:24       ` Stephen J. Turnbull
  2007-11-14 19:07         ` mark-word Lennart Borgman (gmail)
  0 siblings, 1 reply; 15+ messages in thread
From: Stephen J. Turnbull @ 2007-11-14 17:24 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: emacs-devel

Andreas Röhler writes:

 > What about this?
 > 
 > (defun mark-word-at-point ()
 >   " "
 >   (interactive)
 >   (beginning-of-thing 'word)
 >   (push-mark nil nil t)
 >   (end-of-thing 'word))

The name is not descriptive of how it differs from `mark-word';
`mark-word' already has "at point" semantics.  Point and mark should
end up in the opposite order, for compatibility with `mark-paragraph'.
Also, I suspect that you'd be surprised by the result in this context:

    foo bar baz?  -!-quux.

With point at -!- I would expect "quux" to be highlighted, but your
function gives "baz".

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

* Re: mark-word
  2007-11-14 17:24       ` mark-word Stephen J. Turnbull
@ 2007-11-14 19:07         ` Lennart Borgman (gmail)
  2007-11-15  0:33           ` mark-word Miles Bader
  0 siblings, 1 reply; 15+ messages in thread
From: Lennart Borgman (gmail) @ 2007-11-14 19:07 UTC (permalink / raw)
  To: Stephen J. Turnbull; +Cc: Andreas Röhler, emacs-devel

Stephen J. Turnbull wrote:
> Andreas Röhler writes:
> 
>  > What about this?
>  > 
>  > (defun mark-word-at-point ()
>  >   " "
>  >   (interactive)
>  >   (beginning-of-thing 'word)
>  >   (push-mark nil nil t)
>  >   (end-of-thing 'word))
> 
> The name is not descriptive of how it differs from `mark-word';
> `mark-word' already has "at point" semantics.

Is there a mark-thing-at-point? If there were then mark-word-at-point 
could be implemented using that.

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

* Re: mark-word
  2007-11-14 19:07         ` mark-word Lennart Borgman (gmail)
@ 2007-11-15  0:33           ` Miles Bader
  2007-11-15  8:40             ` mark-word Lennart Borgman (gmail)
  0 siblings, 1 reply; 15+ messages in thread
From: Miles Bader @ 2007-11-15  0:33 UTC (permalink / raw)
  To: Lennart Borgman (gmail)
  Cc: Stephen J. Turnbull, Andreas Röhler, emacs-devel

"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
> Is there a mark-thing-at-point?

No

> If there were then mark-word-at-point could be implemented using that.

It could also be implemented rather simply using primitive functions.
The thing-at-point code is hairy and ugly, so it seems backwards to base
other simpler functions on it...

-Miles

-- 
I'm beginning to think that life is just one long Yoko Ono album; no rhyme
or reason, just a lot of incoherent shrieks and then it's over.  --Ian Wolff

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

* Re: mark-word
  2007-11-14  8:37   ` mark-word Leo
  2007-11-14 16:35     ` mark-word Stephen J. Turnbull
@ 2007-11-15  3:07     ` Richard Stallman
  1 sibling, 0 replies; 15+ messages in thread
From: Richard Stallman @ 2007-11-15  3:07 UTC (permalink / raw)
  To: Leo; +Cc: emacs-devel

    > `mark-word' itself should remain compatible with `kill-word' and
    > `mark-sexp'.

    Why?

For compatibility and simplicity.

Please consider this a final decision.
Please do not ask me to spend more time on this.

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

* Re: mark-word
  2007-11-15  0:33           ` mark-word Miles Bader
@ 2007-11-15  8:40             ` Lennart Borgman (gmail)
  2007-11-15  9:18               ` mark-word Miles Bader
  2007-11-15 10:04               ` mark-word Andreas Röhler
  0 siblings, 2 replies; 15+ messages in thread
From: Lennart Borgman (gmail) @ 2007-11-15  8:40 UTC (permalink / raw)
  To: Miles Bader; +Cc: Stephen J. Turnbull, Röhler, emacs-devel

>> Is there a mark-thing-at-point?
> 
> No
> 
>> If there were then mark-word-at-point could be implemented using that.
> 
> It could also be implemented rather simply using primitive functions.
> The thing-at-point code is hairy and ugly, so it seems backwards to base
> other simpler functions on it...

Using thing-at-point to make mark-thing-at-point (and then 
mark-work-at-point etc) would mean that it is consistent and eaiser for 
the user to remember.

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

* Re: mark-word
  2007-11-15  8:40             ` mark-word Lennart Borgman (gmail)
@ 2007-11-15  9:18               ` Miles Bader
  2007-11-15 13:52                 ` mark-word Lennart Borgman (gmail)
  2007-11-15 10:04               ` mark-word Andreas Röhler
  1 sibling, 1 reply; 15+ messages in thread
From: Miles Bader @ 2007-11-15  9:18 UTC (permalink / raw)
  To: Lennart Borgman (gmail)
  Cc: Andreas, Stephen J. Turnbull, Röhler, emacs-devel

"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
>> It could also be implemented rather simply using primitive functions.
>> The thing-at-point code is hairy and ugly, so it seems backwards to base
>> other simpler functions on it...
>
> Using thing-at-point to make mark-thing-at-point (and then
> mark-work-at-point etc) would mean that it is consistent and eaiser for
> the user to remember.

Why?  The user doesn't care how mark-word-at-point (incidentally, this
is a crap name) is implemented.

-Miles

-- 
Love is a snowmobile racing across the tundra.  Suddenly it flips over,
pinning you underneath.  At night the ice weasels come.  --Nietzsche

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

* Re: mark-word
  2007-11-15  8:40             ` mark-word Lennart Borgman (gmail)
  2007-11-15  9:18               ` mark-word Miles Bader
@ 2007-11-15 10:04               ` Andreas Röhler
  1 sibling, 0 replies; 15+ messages in thread
From: Andreas Röhler @ 2007-11-15 10:04 UTC (permalink / raw)
  To: emacs-devel
  Cc: Stephen Turnbull, Lennart Borgman (gmail), Stefan Monnier,
	Miles Bader

Am Donnerstag, 15. November 2007 09:40 schrieb Lennart Borgman (gmail):
> >> Is there a mark-thing-at-point?
> >
> > No
> >
> >> If there were then mark-word-at-point could be implemented using that.
> >
> > It could also be implemented rather simply using primitive functions.
> > The thing-at-point code is hairy and ugly, so it seems backwards to base
> > other simpler functions on it...
>
> Using thing-at-point to make mark-thing-at-point (and then
> mark-work-at-point etc) would mean that it is consistent and eaiser for
> the user to remember.
>

As the original issue seems to have no chance, just one
remark to `thing-at-point' (which I should not have
introduced here beside)

As Miles pointed out the code is hairy. Indeed, it's
buggy.

However the idea behind seems valid: Given `beginning'
and `end' of THING, you may reuse a set of functions ad
infinitum, one for all.

The bugs come in, if underlying moving functions don't
stop at the end of THING but one char after.

After cutting this dependencies--see 
thingatpt-utils in gnu-emacs-source--everything 
works fine AFAIS.

Concering the example delivered by Stephen:

foo bar baz?   quux
_____________|____

M-x mark-word-at-point
=> beginning-of-thing: No word here

That's correct, so I can't reproduce the problem.

OTOH the bug described above would show up if cursor is
over question mark.

Then `baz' is marked but should not, because a question
mark is not a word. The same if cursor is beneath foo. Foo is marked, while
cursor over space.

Thanks all

Andreas Röhler

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

* Re: mark-word
  2007-11-15  9:18               ` mark-word Miles Bader
@ 2007-11-15 13:52                 ` Lennart Borgman (gmail)
  0 siblings, 0 replies; 15+ messages in thread
From: Lennart Borgman (gmail) @ 2007-11-15 13:52 UTC (permalink / raw)
  To: Miles Bader; +Cc: Andreas, Stephen J. Turnbull, Röhler, emacs-devel

>> Using thing-at-point to make mark-thing-at-point (and then
>> mark-work-at-point etc) would mean that it is consistent and eaiser for
>> the user to remember.
> 
> Why?  The user doesn't care how mark-word-at-point (incidentally, this
> is a crap name) is implemented.


If (thing-at-point 'word) returns "MYWORD" (in a different format 
though) then I would expect something like (mark-thing-at-point 'word) 
to mark MYWORD. And if there was a function mark-word-at-point I would 
expect it to mark MYWORD, etc.

Don't you?

And if thing-at-point is buggy and unnecessary hairy that is IMO not any 
excuse not to use it when it simplifies other code. Also from a user 
point it at least makes things consistent (even with bugs).

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

end of thread, other threads:[~2007-11-15 13:52 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-14  7:35 mark-word Andreas Röhler
2007-11-14  8:11 ` mark-word Stephen J. Turnbull
2007-11-14  8:26   ` mark-word David Kastrup
2007-11-14 11:27     ` mark-word Andreas Röhler
2007-11-14 17:24       ` mark-word Stephen J. Turnbull
2007-11-14 19:07         ` mark-word Lennart Borgman (gmail)
2007-11-15  0:33           ` mark-word Miles Bader
2007-11-15  8:40             ` mark-word Lennart Borgman (gmail)
2007-11-15  9:18               ` mark-word Miles Bader
2007-11-15 13:52                 ` mark-word Lennart Borgman (gmail)
2007-11-15 10:04               ` mark-word Andreas Röhler
2007-11-14 17:02     ` mark-word Stephen J. Turnbull
2007-11-14  8:37   ` mark-word Leo
2007-11-14 16:35     ` mark-word Stephen J. Turnbull
2007-11-15  3:07     ` mark-word Richard Stallman

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