0

I recently needed to start using another mac for work and I wanted to duplicate my spacemacs settings onto my new computer. I simply copied all files located in .emacs onto my new computer, and it seems to be working smoothly (I probably got lucky). There's just one small problem: on my old computer, ctrl-BACKSPACE removes whitespace to the point of the next indentation. For example, in json:

{ 

  "name": "David",
     "job": "",   
}

Typing ctrl-BACKSPACE when the cursor is in front of "job" will result in the following (desired)

{ 

  "name": "David",
  "job": "",   
}

But on my new computer (same OS), it results in the following:

{ 

    "name": ""job": "",   
}

So it looks like a whole line is being deleted.

Is there an easy fix to make sure the indentation is respected?

I believe the indentation settings are determined by flycheck. I can give my .init file if it will be helpful.

On the working computer, ctrl-backspace is bound to the following:

<C-backspace> runs the command clean-aindent--bsunindent (found in
clean-aindent-mode--keymap), which is an interactive compiled Lisp function in
‘clean-aindent-mode.el’.

It is bound to <C-backspace>, M-DEL.

(clean-aindent--bsunindent ARG)

Unindents.
Bound to ‘M-backspace’ key. Searches lines backward, finds the one that
is indented less than the current one. Unindents current line to
align with that smaller indentation

[back]

On the new computer, ctr-backspace is bound to the following:

<C-backspace> runs the command backward-kill-word (found in global-map), which
is an interactive compiled Lisp function in ‘simple.el’.

It is bound to <C-backspace>, M-DEL.

(backward-kill-word ARG)

  Probably introduced at or before Emacs version 22.1.

Kill characters backward until encountering the beginning of a word.
With argument ARG, do this that many times.

[back]

1 Answer 1

3
+100

Use C-h k to find out what function <C-Backspace> is bound to on the two computers.

After troubleshooting, the solution turns out to be that clean-aindent-mode is not installed on the non-working machine.

6
  • I updated my question with the results of running those commands on the respective computers.
    – David J.
    Commented Nov 27, 2020 at 10:51
  • Looks like you typed backspace instead of control-backspace, so that doesn't really tell us much. Also, the second one was in the help buffer at the time, where the key bindings are different. Make sure that you run C-h k from the file you were editing where the problem occurs.
    – db48x
    Commented Nov 27, 2020 at 11:27
  • Oops! Just updated my question with the correct key.
    – David J.
    Commented Nov 27, 2020 at 11:41
  • Good, now we can see the difference. On the working computer it says "<C-backspace> runs the command clean-aindent--bsunindent (found in clean-aindent-mode--keymap)", while on the non-working one it says "<C-backspace> runs the command backward-kill-word (found in global-map)". So on the non-working computer you probably haven't installed (or enabled) clean-aindent-mode. Run M-x list-packages and see if it's listed as installed or available.
    – db48x
    Commented Nov 27, 2020 at 11:44
  • thanks, that did it. I'll give you the bounty when it's available.
    – David J.
    Commented Nov 27, 2020 at 12:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.