I find the default prefix for smerge-mode C-c^ and I have following setup:

(setq smerge-command-prefix "\C-cv")
(setq smerge-command-prefix "\C-c\C-v")

Also C-c ^ runs the command icicle-search-keywords (found in icicle-mode-map), so its prefix is overwritten by icicle.

But when I try them, still they are undefined:

C-c C-v is undefined
C-c v is undefined

Is there any way to force to set operation ?


First: a variable can not have two different values at the same time.

(setq smerge-command-prefix "\C-cv")
(setq smerge-command-prefix "\C-c\C-v")

Second: to use this prefix the above variable has to be set before smerge-mode is loaded. So either ensure that (setq smerge-command-prefix "\C-cv") is eval'd before you use (or require) smerge-mode the first time. Or set and save this variable through customize and restart emacs.

Or you could simply use

(eval-after-load 'smerge-mode
  (lambda ()
    (define-key smerge-mode-map (kbd "C-c v") smerge-basic-map)
    (define-key smerge-mode-map (kbd "C-c C-v") smerge-basic-map)))

note: I got most of that information by looking at smerge-mode's source code.

  • Now it says C-c C-v runs the command elpy-check in a python file :-( – alper Oct 20 '20 at 20:50
  • I have no idea why it should say elpy-check. Nevertheless, try the eval-after-load it is better than the original global keybinding. – jue Oct 20 '20 at 21:08
  • I was able to make it work using this approach (stackoverflow.com/a/683575/2402577) ; I have no idea why some keys were overwritten by elpy – alper Oct 20 '20 at 23:50

Your Answer

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

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