Skip to content

Commit

Permalink
Fix `describe-mode' keybinding breaking helm
Browse files Browse the repository at this point in the history
  • Loading branch information
fnussbaum committed May 13, 2024
1 parent ca8b995 commit e93698c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 21 deletions.
1 change: 0 additions & 1 deletion layers/+completion/helm/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@
(spacemacs||set-helm-key "sgG" spacemacs/helm-file-do-grep-region-or-symbol)
;; various key bindings
(spacemacs||set-helm-key "fel" helm-locate-library)
(spacemacs||set-helm-key "hdm" describe-mode)
(spacemacs||set-helm-key "hdx" spacemacs/describe-ex-command)
(spacemacs||set-helm-key "swg" helm-google-suggest)
(with-eval-after-load 'helm-files
Expand Down
18 changes: 0 additions & 18 deletions layers/+completion/ivy/funcs.el
Original file line number Diff line number Diff line change
Expand Up @@ -343,24 +343,6 @@ that directory."
(ignore-errors
(call-interactively 'counsel-up-directory)))

(when (configuration-layer/package-used-p 'counsel)
(with-eval-after-load 'counsel
(defun spacemacs/describe-mode ()
"Dummy wrapper to prevent an key binding error from helm.
By default the emacs leader is M-m, turns out that Helm does this:
(cl-dolist (k (where-is-internal 'describe-mode global-map))
(define-key map k 'helm-help))
after doing this:
(define-key map (kbd \"M-m\") 'helm-toggle-all-marks)
So when Helm is loaded we get the error:
Key sequence M-m h d m starts with non-prefix key M-m
To prevent this error we just wrap `describe-mode' to defeat the
Helm hack."
(interactive)
(call-interactively 'describe-mode))))

(defun spacemacs//counsel-with-git-grep (func x)
"This function should be kept in sync with `counsel-git-grep-action'.
Expand Down
1 change: 0 additions & 1 deletion layers/+completion/ivy/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
"hda" 'counsel-apropos
"hdf" 'counsel-describe-function
"hdF" 'counsel-describe-face
"hdm" 'spacemacs/describe-mode
"hdv" 'counsel-describe-variable
"hdx" 'spacemacs/describe-ex-command
"hi" 'counsel-info-lookup-symbol
Expand Down
11 changes: 11 additions & 0 deletions layers/+spacemacs/spacemacs-defaults/funcs.el
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,17 @@ If not in such a search box, fall back on `Custom-newline'."
(defalias 'spacemacs/display-buffer-other-frame 'display-buffer-other-frame)
(defalias 'spacemacs/find-file-and-replace-buffer 'find-alternate-file)

;; By default the emacs leader is M-m, turns out that Helm does this:
;; (cl-dolist (k (where-is-internal 'describe-mode global-map))
;; (define-key map k 'helm-help))
;; after doing this:
;; (define-key map (kbd \"M-m\") 'helm-toggle-all-marks)
;; So when Helm is loaded we get the error:
;; Key sequence M-m h d m starts with non-prefix key M-m
;; To prevent this error we just alias `describe-mode' to defeat the Helm hack.
(when (configuration-layer/package-used-p 'helm)
(defalias 'spacemacs/describe-mode 'describe-mode))

(defun spacemacs/indent-region-or-buffer ()
"Indent a region if selected, otherwise the whole buffer."
(interactive)
Expand Down
4 changes: 3 additions & 1 deletion layers/+spacemacs/spacemacs-defaults/keybindings.el
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,9 @@
"hdk" 'describe-key
"hdK" 'describe-keymap
"hdl" 'spacemacs/describe-last-keys
"hdm" 'describe-mode
"hdm" (if (configuration-layer/package-used-p 'helm)
'spacemacs/describe-mode
'describe-mode)
"hdp" 'describe-package
"hdP" 'configuration-layer/describe-package
"hds" 'spacemacs/describe-system-info
Expand Down

0 comments on commit e93698c

Please sign in to comment.