* mark-sexp again
@ 2015-06-03 13:57 Andreas Röhler
2015-06-03 15:24 ` Stefan Monnier
0 siblings, 1 reply; 10+ messages in thread
From: Andreas Röhler @ 2015-06-03 13:57 UTC (permalink / raw)
To: emacs-devel
Hi,
coming across an implemention `clojure-mark-string' - useful for all
people not having an appropriate extension.
Given what the hell is all implemented in Emacs, why can't commands
around sexp take the string if within?
Cheers,
Andreas
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: mark-sexp again
2015-06-03 13:57 mark-sexp again Andreas Röhler
@ 2015-06-03 15:24 ` Stefan Monnier
2015-06-07 8:32 ` Andreas Röhler
0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2015-06-03 15:24 UTC (permalink / raw)
To: Andreas Röhler; +Cc: emacs-devel
> Given what the hell is all implemented in Emacs, why can't commands around
> sexp take the string if within?
I think you're looking for expand-region.el
Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: mark-sexp again
2015-06-03 15:24 ` Stefan Monnier
@ 2015-06-07 8:32 ` Andreas Röhler
2015-06-08 13:09 ` Stefan Monnier
0 siblings, 1 reply; 10+ messages in thread
From: Andreas Röhler @ 2015-06-07 8:32 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Am 03.06.2015 um 17:24 schrieb Stefan Monnier:
>> Given what the hell is all implemented in Emacs, why can't commands around
>> sexp take the string if within?
> I think you're looking for expand-region.el
>
>
> Stefan
>
AFAIU a string inside a list is a sexp-expression and thus M-x
mark-sexp RET should work accordingly.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: mark-sexp again
2015-06-07 8:32 ` Andreas Röhler
@ 2015-06-08 13:09 ` Stefan Monnier
2015-06-08 14:24 ` Andreas Röhler
0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2015-06-08 13:09 UTC (permalink / raw)
To: Andreas Röhler; +Cc: emacs-devel
> AFAIU a string inside a list is a sexp-expression and thus M-x
> mark-sexp RET should work accordingly.
It does, AFAICT.
Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: mark-sexp again
2015-06-08 13:09 ` Stefan Monnier
@ 2015-06-08 14:24 ` Andreas Röhler
2015-06-08 16:09 ` Artur Malabarba
2015-06-08 21:02 ` Stefan Monnier
0 siblings, 2 replies; 10+ messages in thread
From: Andreas Röhler @ 2015-06-08 14:24 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Am 08.06.2015 um 15:09 schrieb Stefan Monnier:
>> AFAIU a string inside a list is a sexp-expression and thus M-x
>> mark-sexp RET should work accordingly.
> It does, AFAICT.
>
>
When inside a string, mark-sexp should mark the string. IMO doesn't make
sense to consider the contents then.
Example, cursor at beginning of docstring at "Just"
(defun foo1 ()
"Just foo")
M-x mark-sexp RET marks word "Just", not the string.
Respectivly forward-sexp should reach the end of string, if called inside.
Thanks,
Andreas
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: mark-sexp again
2015-06-08 14:24 ` Andreas Röhler
@ 2015-06-08 16:09 ` Artur Malabarba
2015-06-08 18:55 ` Andreas Röhler
2015-06-08 21:02 ` Stefan Monnier
1 sibling, 1 reply; 10+ messages in thread
From: Artur Malabarba @ 2015-06-08 16:09 UTC (permalink / raw)
To: Andreas Röhler; +Cc: emacs-devel
2015-06-08 15:24 GMT+01:00 Andreas Röhler <andreas.roehler@online.de>:
> When inside a string, mark-sexp should mark the string. IMO doesn't make sense to consider the contents then.
>
> Example, cursor at beginning of docstring at "Just"
>
> (defun foo1 ()
> "Just foo")
>
> M-x mark-sexp RET marks word "Just", not the string.
>
> Respectivly forward-sexp should reach the end of string, if called inside.
That would make it redundant with `up-list'.
As for the general suggestion, I personally like the current behavior.
For instance, in the following docstring, it's nice that forward-sexp
and kill-sexp work on `foo-bar' inside the string.
(defun ok ()
"something `foo-bar' something")
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: mark-sexp again
2015-06-08 16:09 ` Artur Malabarba
@ 2015-06-08 18:55 ` Andreas Röhler
2015-06-08 19:37 ` Artur Malabarba
0 siblings, 1 reply; 10+ messages in thread
From: Andreas Röhler @ 2015-06-08 18:55 UTC (permalink / raw)
To: bruce.connor.am; +Cc: emacs-devel
Am 08.06.2015 um 18:09 schrieb Artur Malabarba:
> 2015-06-08 15:24 GMT+01:00 Andreas Röhler <andreas.roehler@online.de>:
>> When inside a string, mark-sexp should mark the string. IMO doesn't make sense to consider the contents then.
>>
>> Example, cursor at beginning of docstring at "Just"
>>
>> (defun foo1 ()
>> "Just foo")
>>
>> M-x mark-sexp RET marks word "Just", not the string.
>>
>> Respectivly forward-sexp should reach the end of string, if called inside.
> That would make it redundant with `up-list'.
Don't think so:
(list "asdfsdf adfsadf " "asdfsd asd asdf " "asdfasf asdfsad ")
When started a "list", forward-sexp travels string by string, which is
ok and also means, it recognises a string as sexp already.
Accordingly from inside a string, it should go to the end first.
>
> As for the general suggestion, I personally like the current behavior.
> For instance, in the following docstring, it's nice that forward-sexp
> and kill-sexp work on `foo-bar' inside the string.
>
> (defun ok ()
> "something `foo-bar' something")
>
Because a kill-symbol-at-point seems missing.
No reason to maintain a quirk :)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: mark-sexp again
2015-06-08 18:55 ` Andreas Röhler
@ 2015-06-08 19:37 ` Artur Malabarba
2015-06-09 6:24 ` Andreas Röhler
0 siblings, 1 reply; 10+ messages in thread
From: Artur Malabarba @ 2015-06-08 19:37 UTC (permalink / raw)
To: Andreas Röhler; +Cc: emacs-devel
2015-06-08 19:55 GMT+01:00 Andreas Röhler <andreas.roehler@online.de>:
>
> Am 08.06.2015 um 18:09 schrieb Artur Malabarba:
>>
>> 2015-06-08 15:24 GMT+01:00 Andreas Röhler <andreas.roehler@online.de>:
>>>
>>> When inside a string, mark-sexp should mark the string. IMO doesn't make
>>> sense to consider the contents then.
>>>
>>> Example, cursor at beginning of docstring at "Just"
>>>
>>> (defun foo1 ()
>>> "Just foo")
>>>
>>> M-x mark-sexp RET marks word "Just", not the string.
>>>
>>> Respectivly forward-sexp should reach the end of string, if called
>>> inside.
>>
>> That would make it redundant with `up-list'.
>
>
> Don't think so:
I didn't mean the two commands are completely identical. I meant that
the action of moving out of a string while inside a string is already
achieved by the `up-list' command (which is also generally useful but
has no binding), so changing `forward-sexp' to do that as well would
be redundant. Specially since you'd be removing `forward-sexp's
ability to move inside a string, which is useful.
> (list "asdfsdf adfsadf " "asdfsd asd asdf " "asdfasf asdfsad ")
>
> When started a "list", forward-sexp travels string by string, which is ok
> and also means, it recognises a string as sexp already.
>
> Accordingly from inside a string, it should go to the end first.
You seem to think this would make forward-sexp more consistent, but it
would make it less consistent. Currently, a pair of parentheses
delineates a sexp in the same way that a pair of double quotes does.
If you place point at the "a" on the following two examples,
`forward-sexp' will do the exact same thing in both cases. That's
consistent.
(abc def)
"abc def"
If you want to move out of a string, just use the same command you
would use on parentheses (`up-list').
If you want to mark a whole string while inside it, just use the same
procedure you would use on parentheses (`backward-up-list' with
`mark-sexp').
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: mark-sexp again
2015-06-08 19:37 ` Artur Malabarba
@ 2015-06-09 6:24 ` Andreas Röhler
0 siblings, 0 replies; 10+ messages in thread
From: Andreas Röhler @ 2015-06-09 6:24 UTC (permalink / raw)
To: emacs-devel
Cc: monnier@IRO.UMontreal.CA >> Stefan Monnier, bruce.connor.am
Am 08.06.2015 um 21:37 schrieb Artur Malabarba:
> 2015-06-08 19:55 GMT+01:00 Andreas Röhler <andreas.roehler@online.de>:
>> Am 08.06.2015 um 18:09 schrieb Artur Malabarba:
>>> 2015-06-08 15:24 GMT+01:00 Andreas Röhler <andreas.roehler@online.de>:
>>>> When inside a string, mark-sexp should mark the string. IMO doesn't make
>>>> sense to consider the contents then.
>>>>
>>>> Example, cursor at beginning of docstring at "Just"
>>>>
>>>> (defun foo1 ()
>>>> "Just foo")
>>>>
>>>> M-x mark-sexp RET marks word "Just", not the string.
>>>>
>>>> Respectivly forward-sexp should reach the end of string, if called
>>>> inside.
>>> That would make it redundant with `up-list'.
>>
>> Don't think so:
> I didn't mean the two commands are completely identical. I meant that
> the action of moving out of a string while inside a string is already
> achieved by the `up-list' command (which is also generally useful but
> has no binding), so changing `forward-sexp' to do that as well would
> be redundant. Specially since you'd be removing `forward-sexp's
> ability to move inside a string, which is useful.
>
>> (list "asdfsdf adfsadf " "asdfsd asd asdf " "asdfasf asdfsad ")
>>
>> When started a "list", forward-sexp travels string by string, which is ok
>> and also means, it recognises a string as sexp already.
>>
>> Accordingly from inside a string, it should go to the end first.
> You seem to think this would make forward-sexp more consistent, but it
> would make it less consistent. Currently, a pair of parentheses
> delineates a sexp in the same way that a pair of double quotes does.
> If you place point at the "a" on the following two examples,
> `forward-sexp' will do the exact same thing in both cases. That's
> consistent.
>
> (abc def)
> "abc def"
Expect forward-sexp to behave according to syntax of the language.
AFAIU in Emacs Lisp an sexp is either a list --empty or not-- or an
element of a list.
Thus
(abc def)
has at least three sexp.
While a string seen from Emas Lisp is just a single one.
[ ... ]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: mark-sexp again
2015-06-08 14:24 ` Andreas Röhler
2015-06-08 16:09 ` Artur Malabarba
@ 2015-06-08 21:02 ` Stefan Monnier
1 sibling, 0 replies; 10+ messages in thread
From: Stefan Monnier @ 2015-06-08 21:02 UTC (permalink / raw)
To: Andreas Röhler; +Cc: emacs-devel
> When inside a string, mark-sexp should mark the string.
Makes no sense. C-h f mark-sexp RET:
"Set mark ARG sexps from point.
The place mark goes is the same place \\[forward-sexp] would
move to with the same argument.
Again, you want expand-region.el (which should ideally make it into
Emacs at some point. If someone could help Magnar with it, I'm sure
he'd appreciate).
Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2015-06-09 6:24 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-03 13:57 mark-sexp again Andreas Röhler
2015-06-03 15:24 ` Stefan Monnier
2015-06-07 8:32 ` Andreas Röhler
2015-06-08 13:09 ` Stefan Monnier
2015-06-08 14:24 ` Andreas Röhler
2015-06-08 16:09 ` Artur Malabarba
2015-06-08 18:55 ` Andreas Röhler
2015-06-08 19:37 ` Artur Malabarba
2015-06-09 6:24 ` Andreas Röhler
2015-06-08 21:02 ` 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.