clojure-emacs / clojure-mode

Emacs support for the Clojure(Script) programming language
916 stars 246 forks source link

mark-sexp in a string should mark the entire string #298

Open bbatsov opened 9 years ago

bbatsov commented 9 years ago

The title says it all.

Malabarba commented 9 years ago

Isn't this an Emacs thing, though?

bbatsov commented 9 years ago

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.

Malabarba commented 9 years ago

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.

bbatsov commented 9 years ago

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

Malabarba commented 9 years ago

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.

bbatsov commented 9 years ago

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

Malabarba commented 9 years ago

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

bbatsov commented 9 years ago

Indeed.

andreas-roehler commented 9 years ago

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.

bbatsov commented 9 years ago

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

MalloZup commented 5 years ago

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