0

While using M-x ; by default C-s was binding to next line so I used to keep pressing C-s to toggle around. When I start using smex, C-s is now it is bound to I-search in some cases as follows:

M-x than type package and press TAB two times and press C-s two times and I-search: [No previous search string] message will show up.

Is it possible disable I-search and I-search backward: during usage of smex, where C-s and C-r would be bound to nil.

my setup:

(setq smex-save-file "~/.emacs.d/settings/smex-items")
(global-set-key (kbd "M-x") 'smex)
(global-set-key (kbd "M-X") 'smex-major-mode-commands)

(eval-after-load 'smex
  `(defun smex-prepare-ido-bindings ()
     (define-key ido-completion-map (kbd "TAB") 'minibuffer-complete)
     (define-key ido-completion-map (kbd "C-,") 'smex-describe-function)
     (define-key ido-completion-map (kbd "C-w") 'smex-where-is)
     (define-key ido-completion-map (kbd "C-.") 'smex-find-function)
     (define-key ido-completion-map (kbd "C-a") 'move-beginning-of-line)
     (define-key ido-completion-map (kbd "C-p") 'previous-history-element)
     ;;
     (define-key ido-completion-map (kbd "C-e") 'end-of-visual-line)
     (define-key ido-completion-map (kbd "C-r") 'end-of-visual-line)
     (define-key ido-completion-map (kbd "C-s") 'end-of-visual-line)
     ))
Drew
  • 75,699
  • 9
  • 109
  • 225
alper
  • 1,238
  • 11
  • 30
  • I tried `emacs -Q` then loaded `smex.el`. Here is no call to `isearch`, when pressing `C-s` as you described. Also, `C-h k C-s` during smex says: `C-s runs the command ido-next-match (found in ido-completion-map),`. I would say there is something else in your config interfering. – jue Mar 19 '21 at 00:00
  • This issue started to emerge after I added following configuration into my init.el file https://github.com/rksm/emacs-rust-config, if you try it using `emacs -q --load "/path/to/standalone.el"` I believe you may face with `C-s` causing to open `i-search` – alper Mar 19 '21 at 00:35
  • I did not run your config, I just took a look. Why do you think it is a `ido` or `smex` issue, when you enable `selectrum`? `selectrum` is some alternative for `ido`. Your standalone.el is small enough, you could just bisect to find the error. – jue Mar 19 '21 at 08:34
  • Hm I deleted `selectrum` but still having the same issue :-( I will try to bisect `standlone.el` file if I can find something I will update the question. Could it be related to enabling `lsp` ? – alper Mar 19 '21 at 08:47
  • I am having same error when I am opening a file using `emacs -q -nw file.py` – alper Mar 19 '21 at 13:17
  • If searching a word with ```C-s```, and then you need to search again the same word, usually press ```C-s``` twice, to avoid typing the same word again. If no previous search, it is normal to get the error message observed. – Ian Mar 19 '21 at 14:29
  • Why do you need three key chords for the same function ```end-of-visual-line```? Take care there are some other keys already used (```C-p```) - so in this case it is normal to disable previous binding before using for a new function. – Ian Mar 19 '21 at 14:32
  • I have tried `nil` but it didn't work, I was just testing to make ways to make `C-s` and `C-r` disable – alper Mar 19 '21 at 16:05

0 Answers0