3

I would like to use the "normal" behaviour for <backspace> in markdown-mode. That is, instead of calling markdown-exdent-or-delete, I would like to call cua-delete-region. So I tried this rebinding (using bind-key):

(use-package markdown-mode
    :ensure t
  :mode ("\\.\\(m\\(ark\\)?down\\|md\\)$" . markdown-mode)
  :config (bind-key "<backspace>" 'cua-delete-region)
)

But I get no changes. (Or rather I do: but for some strange reason only in the minibuffer!)

Any ideas?

1 Answer 1

1

You need to specify the mode-map for which you want to modify the <backspace> binding:

(bind-key "<backspace>" #'cua-delete-region markdown-mode-map)

What you were doing was overriding the binding in the global map. So you would see your custom binding effective only in the places where any other minor or major mode is NOT mapping the <backspace> key.

2
  • Thanks. What's the # for? I didn't find it in the documentation.
    – NVaughan
    Mar 3, 2015 at 10:06
  • It's primarily for a good coding practice. When you are using a quoted function name, it's good to always sharp quote it: endlessparentheses.com/… Mar 3, 2015 at 12:09

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.