clojure-mode icon indicating copy to clipboard operation
clojure-mode copied to clipboard

mark-sexp in a string should mark the entire string

Open bbatsov opened this issue 10 years ago • 11 comments

The title says it all.

bbatsov avatar Jun 10 '15 09:06 bbatsov

Isn't this an Emacs thing, though?

Malabarba avatar Jun 30 '15 21:06 Malabarba

It is, but for some reason it doesn't work in clojure-mode. I'm guessing something's wrong here https://github.com/clojure-emacs/clojure-mode/blob/master/clojure-mode.el#L161 (the syntax table). I'm thinking this is broken in Emacs Lisp and was copied from there, as mark-sexp doesn't work properly in elisp strings as well.

bbatsov avatar Jun 30 '15 21:06 bbatsov

There's probably nothing wrong with clojure-mode. As far as I know mark-sexp doesn't expand to the entire string for any language that I use. The only solution would be to write a command for that I think.

Malabarba avatar Jun 30 '15 21:06 Malabarba

In general it seems to me mark-sexp behaves pretty odd. Apart from the fact I think it should be selecting entire strings, it has similar behaviour when invoked in the middle of a symbol. Not sure what the reasoning before this was. Maybe Emacs needs a mark-string command that's different, but strings are sexps, so I really don't know what'd be best...

bbatsov avatar Jun 30 '15 21:06 bbatsov

This was brought up on debbugs a couple of months ago. Nobody seemed to care enough to weigh in.

I never use mark sexp, but consistency would dictate that a change like this would also affect sexp movement commands. And personally I like the fact that forward/backward sexp move within a string, and not past the whole string.

Though I wouldn't be against the change either.

Malabarba avatar Jun 30 '15 21:06 Malabarba

I don't know - to me it just looks like bad semantics. One would expect that a command named mark-sexp would actually mark a sexp...

bbatsov avatar Jul 01 '15 21:07 bbatsov

Yeah. Specially not marking a whole symbol. That's very plainly a bug.

Malabarba avatar Jul 01 '15 22:07 Malabarba

Indeed.

bbatsov avatar Jul 04 '15 07:07 bbatsov

A wise issue.

forward/backward sexp should cover complete strings, as elements of a list. Thus copy/mark/delete sexps should take the whole string.

andreas-roehler avatar Jul 04 '15 16:07 andreas-roehler

Guess someone should bring this up for discussion again at emacs-devel.

bbatsov avatar Jul 04 '15 16:07 bbatsov

autogenerated with https://github.com/MalloZup/doghub: issue inactive since 450 days. Please update the issue or close it

MalloZup avatar Aug 05 '19 21:08 MalloZup