最近はまた helm.el の開発が活発に行われているようです。
少し前から helm の仕様変更のためか、helm-multi-swoop コマンドを実行したときに、検索語句は背後で開いているバッファも含めた全体のものが表示されるものの、語句の位置に移動できるのは現在開いているバッファのみに限られてしまうようになりました。
helm-swoop.el のマルチバッファ横断検索が便利過ぎて、他のパッケージに移行できないため、こちらも ChatGPT に解決策を教えてもらいました。
問題点は、「選択移動だけでは persistent-action が走らない」ことで、helm-multi-swoop の「選択を上下に動かすだけで対象バッファへプレビュー移動する」機能が働かなくなっているようでした。
対処法は、候補移動時に必ず persistent-action を実行させることで各候補の場所へプレビュー/ジャンプを可能にすること、および multi-swoop の source に follow を有効化することだそうです。以下を init.el に追記します。
;;; --- 1) 候補移動+persistent-action を実行する関数を追加
(defun helm-swoop--next-line-follow ()
"Move to next line and execute persistent action (preview/jump)."
(interactive)
(helm-next-line)
(helm-execute-persistent-action))
(defun helm-swoop--previous-line-follow ()
"Move to previous line and execute persistent action (preview/jump)."
(interactive)
(helm-previous-line)
(helm-execute-persistent-action))
;;; --- 2) マルチバッファ用のキーマップを『follow つき移動』へ差し替え
(with-eval-after-load 'helm
;; 通常の C-n/C-p もフォロー
(define-key helm-multi-swoop-map (kbd "C-n") #'helm-swoop--next-line-follow)
(define-key helm-multi-swoop-map (kbd "C-p") #'helm-swoop--previous-line-follow)
;; README の通り isearch ライクに使う C-s/C-r もフォロー
(define-key helm-multi-swoop-map (kbd "C-s") #'helm-swoop--next-line-follow)
(define-key helm-multi-swoop-map (kbd "C-r") #'helm-swoop--previous-line-follow))
;;; --- 3) multi-swoop の source に follow を有効化
;; 既存の multi-swoop ソース変数があれば明示的に follow を立てる。
;; ない場合でも、helm 起動前に multi-swoop 系ソースへ一括で follow を付与する。
(defun helm-multi-swoop--enable-follow ()
(dolist (src helm-sources)
(let ((name (assoc-default 'name src)))
(when (and (stringp name)
(string-match-p "multi-?swoop" name))
(helm-attrset 'follow 1 src))))) ;; ← follow を有効化(候補移動で persistent-action が自動実行)
(add-hook 'helm-before-initialize-hook #'helm-multi-swoop--enable-follow)
これで helm-multi-swoop が上手く機能するようになりました。