4

For several years, I've been happily using multiple-cursors with phi-search to run interactive searches with several cursors at once with Emacs 23. I would create my multiple cursors, then run phi-search as needed to navigate, and edit when I arrived at the point I wanted.

My configuration looked like this:

(require 'multiple-cursors)
(require 'phi-search)
(define-key mc/keymap (kbd "C-s") 'phi-search)
(define-key mc/keymap (kbd "C-r") 'phi-search-backward)

But in Emacs 24, phi-search with multiple-cursors active will only search for a single cursor, and leave the others unchanged. Is there any way to get isearch like navigation when there are multiple cursors on the screen, assuming I'm using a recent Emacs?

  • 1
    Check your .mc-lists.el file and make sure that phi-search is listed under mc/cmds-to-run-for-all and not under mc/cmds-to-run-once. – nispio Dec 13 '16 at 17:37
  • Yes, I have done this. It worked fine in Emacs 23, but it appears to be broken after upgrading to Emacs 24. I have also updated to the latest multiple-cursors. Can any confirm that this is working correctly for them with Emacs 24+? – emk Dec 13 '16 at 20:43
  • 1
    It works for me in both emacs 24 and 25 with deleting .mc-lists.el and running emacs -q. Can you reproduce in this scenario? – nispio Dec 14 '16 at 0:10
  • 1
    Also, make sure you are not using packages in emacs 24 that you byte-compiled with emacs 23. This could cause unexpected behavior. – nispio Dec 14 '16 at 0:22
  • I've checked emacs -q, but I'm still seeing failures. Next, I want to try this on a completely clean user account to make sure Emacs package-install isn't picking up stale byte codes from anywhere. – emk Dec 14 '16 at 12:15
2

I also have the same problem, finally I decided to add this package:

https://github.com/knu/phi-search-mc.el

So the complet setup is multiple-cursors, phi-search adn phi-search-mc, and having this file configuration for multiple cursors and phi-search it works well:

;;; file --- my-multiple-cursors.el
;;; Commentary:
;;; my configuration for multiple cursors
;;; Code:
(require 'multiple-cursors)
(require 'phi-search)

(define-prefix-command 'toni/mc-map)
(define-key ctl-x-map "c" 'toni/mc-map)

(define-key toni/mc-map "c" 'multiple-cursors-mode)

(define-key toni/mc-map "l" 'mc/edit-lines)
(define-key toni/mc-map "n" 'mc/mark-next-like-this)
(define-key toni/mc-map "p" 'mc/mark-previous-like-this)
(define-key toni/mc-map "a" 'mc/mark-all-like-this)
(define-key toni/mc-map "un" 'mc/unmark-next-like-this)
(define-key toni/mc-map "up" 'mc/unmark-previous-like-this)
(define-key toni/mc-map "i" 'mc/insert-numbers)
(define-key toni/mc-map "h" 'mc-hide-unmatched-lines-mode)

(define-key toni/mc-map "d" 'mc/mark-all-symbols-like-this-in-defun)
(define-key toni/mc-map "r" 'mc/reverse-regions)
(define-key toni/mc-map "s" 'mc/sort-regions)
(define-key toni/mc-map "\C-a" 'mc/edit-beginnings-of-lines)
(define-key toni/mc-map "\C-e" 'mc/edit-ends-of-lines)

(define-key toni/mc-map (kbd "C-s") 'phi-search)
(define-key toni/mc-map (kbd "C-r") 'phi-search-backward)

(phi-search-mc/setup-keys)

(add-hook 'isearch-mode-hook 'phi-search-from-isearch-mc/setup-keys)

(provide 'my-multiple-cursors)
;;; my-multiple-cursors.el ends here

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.