* thing-at-point's meaning of current sexp vs. up-list's: which is correct?
@ 2013-06-12 13:23 Kelly Dean
2013-06-12 14:35 ` Kelly Dean
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Kelly Dean @ 2013-06-12 13:23 UTC (permalink / raw)
To: emacs-devel
If point is on a closing delimiter, then thing-at-point says the delimiter is part of the current sexp, but up-list says the delimiter is part of the sexp that contains the current sexp.
The result is that kill-backward-up-list, which assumes that thing-at-point and up-list have the same meaning for current sexp, fails when point is on a closing delimiter: type "((a))" and put point on the first closing parenthesis, then do kill-backward-up-list, and it reinserts the same sexp that it kills, leaving the text unchanged.
I'll file a bug report, but should I file it for thing-at-point, or for up-list? Surely not for kill-backward-up-list.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: thing-at-point's meaning of current sexp vs. up-list's: which is correct?
2013-06-12 13:23 thing-at-point's meaning of current sexp vs. up-list's: which is correct? Kelly Dean
@ 2013-06-12 14:35 ` Kelly Dean
2013-06-12 15:47 ` Davis Herring
2013-06-12 19:31 ` Stefan Monnier
2 siblings, 0 replies; 8+ messages in thread
From: Kelly Dean @ 2013-06-12 14:35 UTC (permalink / raw)
To: emacs-devel
Forgot to say, I meant in 24.3. In trunk, (thing-at-point 'sexp) returns nil, so kill-backward-up-list still doesn't work, but reports "Not at a sexp". I guess that answers the question: the bug is in thing-at-point.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: thing-at-point's meaning of current sexp vs. up-list's: which is correct?
2013-06-12 13:23 thing-at-point's meaning of current sexp vs. up-list's: which is correct? Kelly Dean
2013-06-12 14:35 ` Kelly Dean
@ 2013-06-12 15:47 ` Davis Herring
2013-06-13 1:40 ` Kelly Dean
2013-06-12 19:31 ` Stefan Monnier
2 siblings, 1 reply; 8+ messages in thread
From: Davis Herring @ 2013-06-12 15:47 UTC (permalink / raw)
To: Kelly Dean; +Cc: emacs-devel
> If point is on a closing delimiter, then thing-at-point says the delimiter is part of the current sexp, but up-list says the delimiter is part of the sexp that contains the current sexp.
Point isn't on a character, but between them; the box cursor is drawn on
the character following point. Therefore when the cursor is on a ),
point is definitely inside the parentheses.
Davis
--
This product is sold by volume, not by mass. If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: thing-at-point's meaning of current sexp vs. up-list's: which is correct?
2013-06-12 15:47 ` Davis Herring
@ 2013-06-13 1:40 ` Kelly Dean
2013-06-13 7:49 ` Stephen Berman
0 siblings, 1 reply; 8+ messages in thread
From: Kelly Dean @ 2013-06-13 1:40 UTC (permalink / raw)
To: Davis Herring; +Cc: emacs-devel
Davis Herring wrote:
>Point isn't on a character, but between them; the box cursor is drawn on
>the character following point. Therefore when the cursor is on a ),
>point is definitely inside the parentheses.
I switched to Emacs almost six months ago; I'm surprised I missed something this basic until now.
The docstring for (point) says "Beginning of buffer is position (point-min)", so point is at, not between, "positions".
If there's one character in a buffer, then point can be at position 1 or 2. Which position is the character at? Or are characters not at positions, but _between_ positions? That seems weird. I always thought both point and characters were at positions.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: thing-at-point's meaning of current sexp vs. up-list's: which is correct?
2013-06-13 1:40 ` Kelly Dean
@ 2013-06-13 7:49 ` Stephen Berman
0 siblings, 0 replies; 8+ messages in thread
From: Stephen Berman @ 2013-06-13 7:49 UTC (permalink / raw)
To: Kelly Dean; +Cc: emacs-devel
On Wed, 12 Jun 2013 18:40:58 -0700 (PDT) Kelly Dean <kellydeanch@yahoo.com> wrote:
> Davis Herring wrote:
>>Point isn't on a character, but between them; the box cursor is drawn on
>>the character following point. Therefore when the cursor is on a ),
>>point is definitely inside the parentheses.
>
> I switched to Emacs almost six months ago; I'm surprised I missed something
> this basic until now.
> The docstring for (point) says "Beginning of buffer is position (point-min)",
> so point is at, not between, "positions".
> If there's one character in a buffer, then point can be at position 1 or
> 2. Which position is the character at? Or are characters not at positions, but
> _between_ positions? That seems weird. I always thought both point and
> characters were at positions.
See (elisp)Positions:
A "position" is the index of a character in the text of a buffer. More
precisely, a position identifies the place between two characters (or
before the first character, or after the last character), so we can
speak of the character before or after a given position. However, we
often speak of the character "at" a position, meaning the character
after that position.
Steve Berman
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: thing-at-point's meaning of current sexp vs. up-list's: which is correct?
2013-06-12 13:23 thing-at-point's meaning of current sexp vs. up-list's: which is correct? Kelly Dean
2013-06-12 14:35 ` Kelly Dean
2013-06-12 15:47 ` Davis Herring
@ 2013-06-12 19:31 ` Stefan Monnier
2013-06-13 1:36 ` Kelly Dean
2 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2013-06-12 19:31 UTC (permalink / raw)
To: Kelly Dean; +Cc: emacs-devel
> I'll file a bug report, but should I file it for thing-at-point, or for
> up-list? Surely not for kill-backward-up-list.
I think the bug is in kill-backward-up-list. `up-list' is definitely
behaving correctly here, and thing-at-point is basically free to return
anything it feels like (it's a very ad-hoc function which tries to
DWIM).
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: thing-at-point's meaning of current sexp vs. up-list's: which is correct?
2013-06-12 19:31 ` Stefan Monnier
@ 2013-06-13 1:36 ` Kelly Dean
2013-06-13 14:13 ` Stefan Monnier
0 siblings, 1 reply; 8+ messages in thread
From: Kelly Dean @ 2013-06-13 1:36 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier wrote:
>I think the bug is in kill-backward-up-list. `up-list' is definitely
>behaving correctly here, and thing-at-point is basically free to return
>anything it feels like (it's a very ad-hoc function which tries to
>DWIM).
forward-sexp and er/expand-region agree with up-list's meaning, and it does look like the right meaning. If thing-at-point is ad-hoc DWIM anyway, then I don't see the advantage of it using a different meaning than the standard for other functions. Wouldn't it be better to change thing-at-point? Besides this, in trunk, thing-at-point returns nil in the case I described, even though there certainly is a sexp at point, so that bug might as well be fixed in a way that makes thing-at-point compatible with the other functions.
And kill-backward-up-list's implementation is short and elegant; dealing with thing-at-point's different meaning would make it longer and ugly.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: thing-at-point's meaning of current sexp vs. up-list's: which is correct?
2013-06-13 1:36 ` Kelly Dean
@ 2013-06-13 14:13 ` Stefan Monnier
0 siblings, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2013-06-13 14:13 UTC (permalink / raw)
To: Kelly Dean; +Cc: emacs-devel
> forward-sexp and er/expand-region agree with up-list's meaning, and it does
> look like the right meaning. If thing-at-point is ad-hoc DWIM anyway, then
> I don't see the advantage of it using a different meaning than the standard
> for other functions.
Because thing-at-point is dwimish: if you're right before a closing
paren (and hence you block cursor is drawn on top of the closing paren),
it's pretty clear that by "the sexp at point" you want to mean "the sexp
that ends with the paren after point".
> And kill-backward-up-list's implementation is short and elegant; dealing
> with thing-at-point's different meaning would make it longer and ugly.
DWIM basically means that it only makes sense for the user to call it,
but not for Elisp code, because the dwimness tries to guess what a user
would want, but what a piece of code would want is generally
very different.
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-06-13 14:13 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-12 13:23 thing-at-point's meaning of current sexp vs. up-list's: which is correct? Kelly Dean
2013-06-12 14:35 ` Kelly Dean
2013-06-12 15:47 ` Davis Herring
2013-06-13 1:40 ` Kelly Dean
2013-06-13 7:49 ` Stephen Berman
2013-06-12 19:31 ` Stefan Monnier
2013-06-13 1:36 ` Kelly Dean
2013-06-13 14:13 ` Stefan Monnier
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.