0

emacs 26.1

I want to downcase all text between all square brackets. So I try to use multiple-cursors for this:

here text:

CREATE TABLE [CIndicators] (
[ID] INTEGER  NOT NULL PRIMARY KEY AUTOINCREMENT,
[CODE] VARCHAR(1)  UNIQUE NOT NULL,
[DESCRIPTION] VARCHAR(255)  NULL,
[DESCRIPTION_RO] VARCHAR(255)  NULL,
[DESCRIPTION_RU] VARCHAR(255) NULL
);

Mark first open square bracket and use mc/mark-all-like-this

here result:

enter image description here

Nice. Now move cursor one char forward:

enter image description here

Nice. And now use mark-sexp (C-=) to mark all text inside square brackets.

enter image description here

But as you can see it mark only text in first square brackets (CIndicators). But why multiple-cursors not mark all another text in another square brackets, like CODE, DESCRIPTION and so on?

  • 2
    When I do it (C-M-@), it asks me if I want to do it for all cursors. I say "Yes" and it does it. Using: 20190317.1211 – Beetle B. May 25 at 14:55
  • 1
    In this case the region is active so mark-sexp won't work. You should use forward-sexp instead (or sp-forward-sexp if you use smartparens). – jagrg May 27 at 14:32
  • @jagrg "forward-sexp" in normal mode it just forward to next one word. But in multiple-cursors it select next one word. Nice. But I not find help about this behavior of "forward-sexp". Where you find this second behavior? – a_subscriber May 28 at 7:31
  • Sorry, what do you mean? Which second behaviour? – jagrg May 28 at 21:23
  • 1
    In that case you're right, forward-sexp won't work, unless the point is before the opening bracket, in which case you need an extra step (start with the point here |[): 1. C-SPC to set the mark, 2. C-f 3. M-x mc/mark-all-like-this 4. C-b 5. C-M-f (forward-sexp). BTW with smartparens you can do this in fewer steps using sp-up-sexp which moves forward out of one level of parentheses. – jagrg May 30 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.