Closed cireu closed 5 years ago
Perfect! Please few minutes to test.
I got this error when running helm-swoop
.
Debugger entered--Lisp error: (error "ad-enable-advice: ‘helm-next-line’ has no around advice matching ‘helm-swoop-next-line’")
signal(error ("ad-enable-advice: ‘helm-next-line’ has no around advice matching ‘helm-swoop-next-line’"))
error("ad-enable-advice: `%s' has no %s advice matching `%s'" helm-next-line around helm-swoop-next-line)
ad-enable-advice(helm-next-line around helm-swoop-next-line)
(progn (ad-enable-advice 'helm-next-line 'around 'helm-swoop-next-line) (ad-activate 'helm-next-line) (ad-enable-advice 'helm-previous-line 'around 'helm-swoop-previous-line) (ad-activate 'helm-previous-line) (ad-enable-advice 'helm-toggle-visible-mark 'around 'helm-swoop-toggle-visible-mark) (ad-activate 'helm-toggle-visible-mark) (ad-enable-advice 'helm-move--next-line-fn 'around 'helm-multi-swoop-next-line-cycle) (ad-activate 'helm-move--next-line-fn) (ad-enable-advice 'helm-move--previous-line-fn 'around 'helm-multi-swoop-previous-line-cycle) (ad-activate 'helm-move--previous-line-fn) (add-hook 'helm-update-hook 'helm-swoop--pattern-match) (add-hook 'helm-after-update-hook 'helm-swoop--keep-nearest-position t) (cond ($query (if (string-match "\\(\\^\\[0\\-9\\]\\+\\.\\)\\(.*\\)" $query) $query $query)) (mark-active (let (($st (buffer-substring-no-properties (region-beginning) (region-end)))) (if (string-match "\n" $st) (message "Multi line region is not allowed") (setq $query (helm-swoop-pre-input-optimize $st))))) ((setq $query (helm-swoop-pre-input-optimize (funcall helm-swoop-pre-input-function)))) (t (setq $query ""))) (helm-swoop--recenter) (move-beginning-of-line 1) (helm-swoop--target-line-overlay-move) (let ((helm-display-function helm-swoop-split-window-function) (helm-display-source-at-screen-top nil) (helm-completion-window-scroll-margin 5)) (helm :sources (or $source (helm-c-source-swoop)) :buffer helm-swoop-buffer :input $query :prompt helm-swoop-prompt :preselect (if (string-match "^[\011\n ]*$" (helm-swoop--get-string-at-line)) (save-excursion (if (re-search-forward "[^\011\n ]" nil t) (format "^%s " (line-number-at-pos)) (re-search-backward "[^\011\n ]" nil t) (format "^%s " (line-number-at-pos)))) (format "^%s " (line-number-at-pos))) :candidate-number-limit helm-swoop-candidate-number-limit)))
(unwind-protect (progn (ad-enable-advice 'helm-next-line 'around 'helm-swoop-next-line) (ad-activate 'helm-next-line) (ad-enable-advice 'helm-previous-line 'around 'helm-swoop-previous-line) (ad-activate 'helm-previous-line) (ad-enable-advice 'helm-toggle-visible-mark 'around 'helm-swoop-toggle-visible-mark) (ad-activate 'helm-toggle-visible-mark) (ad-enable-advice 'helm-move--next-line-fn 'around 'helm-multi-swoop-next-line-cycle) (ad-activate 'helm-move--next-line-fn) (ad-enable-advice 'helm-move--previous-line-fn 'around 'helm-multi-swoop-previous-line-cycle) (ad-activate 'helm-move--previous-line-fn) (add-hook 'helm-update-hook 'helm-swoop--pattern-match) (add-hook 'helm-after-update-hook 'helm-swoop--keep-nearest-position t) (cond ($query (if (string-match "\\(\\^\\[0\\-9\\]\\+\\.\\)\\(.*\\)" $query) $query $query)) (mark-active (let (($st (buffer-substring-no-properties (region-beginning) (region-end)))) (if (string-match "\n" $st) (message "Multi line region is not allowed") (setq $query (helm-swoop-pre-input-optimize $st))))) ((setq $query (helm-swoop-pre-input-optimize (funcall helm-swoop-pre-input-function)))) (t (setq $query ""))) (helm-swoop--recenter) (move-beginning-of-line 1) (helm-swoop--target-line-overlay-move) (let ((helm-display-function helm-swoop-split-window-function) (helm-display-source-at-screen-top nil) (helm-completion-window-scroll-margin 5)) (helm :sources (or $source (helm-c-source-swoop)) :buffer helm-swoop-buffer :input $query :prompt helm-swoop-prompt :preselect (if (string-match "^[\011\n ]*$" (helm-swoop--get-string-at-line)) (save-excursion (if (re-search-forward "[^\011\n ]" nil t) (format "^%s " (line-number-at-pos)) (re-search-backward "[^\011\n ]" nil t) (format "^%s " (line-number-at-pos)))) (format "^%s " (line-number-at-pos))) :candidate-number-limit helm-swoop-candidate-number-limit))) (helm-swoop--restore))
(progn (setq helm-swoop-synchronizing-window (selected-window)) (setq helm-swoop-last-point (cons (point) (buffer-name (current-buffer)))) (setq helm-swoop-last-line-info (cons (current-buffer) (line-number-at-pos))) (if (boundp 'helm-swoop-last-query) nil (set (make-local-variable 'helm-swoop-last-query) "")) (setq helm-swoop-target-buffer (current-buffer)) (helm-swoop--set-prefix (prefix-numeric-value $multiline)) (setq helm-swoop-line-overlay (make-overlay (point) (point))) (overlay-put helm-swoop-line-overlay 'face (if (< 1 helm-swoop-last-prefix-number) 'helm-swoop-target-line-block-face 'helm-swoop-target-line-face)) (cond ((not (boundp 'helm-swoop-list-cache)) (set (make-local-variable 'helm-swoop-list-cache) nil)) ((buffer-modified-p) (setq helm-swoop-list-cache nil))) (unwind-protect (progn (ad-enable-advice 'helm-next-line 'around 'helm-swoop-next-line) (ad-activate 'helm-next-line) (ad-enable-advice 'helm-previous-line 'around 'helm-swoop-previous-line) (ad-activate 'helm-previous-line) (ad-enable-advice 'helm-toggle-visible-mark 'around 'helm-swoop-toggle-visible-mark) (ad-activate 'helm-toggle-visible-mark) (ad-enable-advice 'helm-move--next-line-fn 'around 'helm-multi-swoop-next-line-cycle) (ad-activate 'helm-move--next-line-fn) (ad-enable-advice 'helm-move--previous-line-fn 'around 'helm-multi-swoop-previous-line-cycle) (ad-activate 'helm-move--previous-line-fn) (add-hook 'helm-update-hook 'helm-swoop--pattern-match) (add-hook 'helm-after-update-hook 'helm-swoop--keep-nearest-position t) (cond ($query (if (string-match "\\(\\^\\[0\\-9\\]\\+\\.\\)\\(.*\\)" $query) $query $query)) (mark-active (let (($st (buffer-substring-no-properties (region-beginning) (region-end)))) (if (string-match "\n" $st) (message "Multi line region is not allowed") (setq $query (helm-swoop-pre-input-optimize $st))))) ((setq $query (helm-swoop-pre-input-optimize (funcall helm-swoop-pre-input-function)))) (t (setq $query ""))) (helm-swoop--recenter) (move-beginning-of-line 1) (helm-swoop--target-line-overlay-move) (let ((helm-display-function helm-swoop-split-window-function) (helm-display-source-at-screen-top nil) (helm-completion-window-scroll-margin 5)) (helm :sources (or $source (helm-c-source-swoop)) :buffer helm-swoop-buffer :input $query :prompt helm-swoop-prompt :preselect (if (string-match "^[\011\n ]*$" (helm-swoop--get-string-at-line)) (save-excursion (if (re-search-forward "[^\011\n ]" nil t) (format "^%s " (line-number-at-pos)) (re-search-backward "[^\011\n ]" nil t) (format "^%s " (line-number-at-pos)))) (format "^%s " (line-number-at-pos))) :candidate-number-limit helm-swoop-candidate-number-limit))) (helm-swoop--restore)))
(progn (let ((--cl-keys-- --cl-rest--)) (while --cl-keys-- (cond ((memq (car --cl-keys--) '(:$query :$source :$multiline :allow-other-keys)) (setq --cl-keys-- (cdr (cdr --cl-keys--)))) ((car (cdr (memq ':allow-other-keys --cl-rest--))) (setq --cl-keys-- nil)) (t (error "Keyword argument %s not one of (:$query :$source :$multiline)" (car --cl-keys--)))))) (progn (setq helm-swoop-synchronizing-window (selected-window)) (setq helm-swoop-last-point (cons (point) (buffer-name (current-buffer)))) (setq helm-swoop-last-line-info (cons (current-buffer) (line-number-at-pos))) (if (boundp 'helm-swoop-last-query) nil (set (make-local-variable 'helm-swoop-last-query) "")) (setq helm-swoop-target-buffer (current-buffer)) (helm-swoop--set-prefix (prefix-numeric-value $multiline)) (setq helm-swoop-line-overlay (make-overlay (point) (point))) (overlay-put helm-swoop-line-overlay 'face (if (< 1 helm-swoop-last-prefix-number) 'helm-swoop-target-line-block-face 'helm-swoop-target-line-face)) (cond ((not (boundp 'helm-swoop-list-cache)) (set (make-local-variable 'helm-swoop-list-cache) nil)) ((buffer-modified-p) (setq helm-swoop-list-cache nil))) (unwind-protect (progn (ad-enable-advice 'helm-next-line 'around 'helm-swoop-next-line) (ad-activate 'helm-next-line) (ad-enable-advice 'helm-previous-line 'around 'helm-swoop-previous-line) (ad-activate 'helm-previous-line) (ad-enable-advice 'helm-toggle-visible-mark 'around 'helm-swoop-toggle-visible-mark) (ad-activate 'helm-toggle-visible-mark) (ad-enable-advice 'helm-move--next-line-fn 'around 'helm-multi-swoop-next-line-cycle) (ad-activate 'helm-move--next-line-fn) (ad-enable-advice 'helm-move--previous-line-fn 'around 'helm-multi-swoop-previous-line-cycle) (ad-activate 'helm-move--previous-line-fn) (add-hook 'helm-update-hook 'helm-swoop--pattern-match) (add-hook 'helm-after-update-hook 'helm-swoop--keep-nearest-position t) (cond ($query (if (string-match "\\(\\^\\[0\\-9\\]\\+\\.\\)\\(.*\\)" $query) $query $query)) (mark-active (let (($st (buffer-substring-no-properties (region-beginning) (region-end)))) (if (string-match "\n" $st) (message "Multi line region is not allowed") (setq $query (helm-swoop-pre-input-optimize $st))))) ((setq $query (helm-swoop-pre-input-optimize (funcall helm-swoop-pre-input-function)))) (t (setq $query ""))) (helm-swoop--recenter) (move-beginning-of-line 1) (helm-swoop--target-line-overlay-move) (let ((helm-display-function helm-swoop-split-window-function) (helm-display-source-at-screen-top nil) (helm-completion-window-scroll-margin 5)) (helm :sources (or $source (helm-c-source-swoop)) :buffer helm-swoop-buffer :input $query :prompt helm-swoop-prompt :preselect (if (string-match "^[\011\n ]*$" (helm-swoop--get-string-at-line)) (save-excursion (if (re-search-forward "[^\011\n ]" nil t) (format "^%s " (line-number-at-pos)) (re-search-backward "[^\011\n ]" nil t) (format "^%s " (line-number-at-pos)))) (format "^%s " (line-number-at-pos))) :candidate-number-limit helm-swoop-candidate-number-limit))) (helm-swoop--restore))))
(let* (($query (car (cdr (plist-member --cl-rest-- ':$query)))) ($source (car (cdr (plist-member --cl-rest-- ':$source)))) ($multiline (car (cdr (or (plist-member --cl-rest-- ':$multiline) (list nil current-prefix-arg)))))) (progn (let ((--cl-keys-- --cl-rest--)) (while --cl-keys-- (cond ((memq (car --cl-keys--) '(:$query :$source :$multiline :allow-other-keys)) (setq --cl-keys-- (cdr (cdr --cl-keys--)))) ((car (cdr (memq ':allow-other-keys --cl-rest--))) (setq --cl-keys-- nil)) (t (error "Keyword argument %s not one of (:$query :$source :$multiline)" (car --cl-keys--)))))) (progn (setq helm-swoop-synchronizing-window (selected-window)) (setq helm-swoop-last-point (cons (point) (buffer-name (current-buffer)))) (setq helm-swoop-last-line-info (cons (current-buffer) (line-number-at-pos))) (if (boundp 'helm-swoop-last-query) nil (set (make-local-variable 'helm-swoop-last-query) "")) (setq helm-swoop-target-buffer (current-buffer)) (helm-swoop--set-prefix (prefix-numeric-value $multiline)) (setq helm-swoop-line-overlay (make-overlay (point) (point))) (overlay-put helm-swoop-line-overlay 'face (if (< 1 helm-swoop-last-prefix-number) 'helm-swoop-target-line-block-face 'helm-swoop-target-line-face)) (cond ((not (boundp 'helm-swoop-list-cache)) (set (make-local-variable 'helm-swoop-list-cache) nil)) ((buffer-modified-p) (setq helm-swoop-list-cache nil))) (unwind-protect (progn (ad-enable-advice 'helm-next-line 'around 'helm-swoop-next-line) (ad-activate 'helm-next-line) (ad-enable-advice 'helm-previous-line 'around 'helm-swoop-previous-line) (ad-activate 'helm-previous-line) (ad-enable-advice 'helm-toggle-visible-mark 'around 'helm-swoop-toggle-visible-mark) (ad-activate 'helm-toggle-visible-mark) (ad-enable-advice 'helm-move--next-line-fn 'around 'helm-multi-swoop-next-line-cycle) (ad-activate 'helm-move--next-line-fn) (ad-enable-advice 'helm-move--previous-line-fn 'around 'helm-multi-swoop-previous-line-cycle) (ad-activate 'helm-move--previous-line-fn) (add-hook 'helm-update-hook 'helm-swoop--pattern-match) (add-hook 'helm-after-update-hook 'helm-swoop--keep-nearest-position t) (cond ($query (if (string-match "\\(\\^\\[0\\-9\\]\\+\\.\\)\\(.*\\)" $query) $query $query)) (mark-active (let (($st (buffer-substring-no-properties (region-beginning) (region-end)))) (if (string-match "\n" $st) (message "Multi line region is not allowed") (setq $query (helm-swoop-pre-input-optimize $st))))) ((setq $query (helm-swoop-pre-input-optimize (funcall helm-swoop-pre-input-function)))) (t (setq $query ""))) (helm-swoop--recenter) (move-beginning-of-line 1) (helm-swoop--target-line-overlay-move) (let ((helm-display-function helm-swoop-split-window-function) (helm-display-source-at-screen-top nil) (helm-completion-window-scroll-margin 5)) (helm :sources (or $source (helm-c-source-swoop)) :buffer helm-swoop-buffer :input $query :prompt helm-swoop-prompt :preselect (if (string-match "^[\011\n ]*$" (helm-swoop--get-string-at-line)) (save-excursion (if (re-search-forward "[^\011\n ]" nil t) (format "^%s " (line-number-at-pos)) (re-search-backward "[^\011\n ]" nil t) (format "^%s " (line-number-at-pos)))) (format "^%s " (line-number-at-pos))) :candidate-number-limit helm-swoop-candidate-number-limit))) (helm-swoop--restore)))))
helm-swoop()
funcall-interactively(helm-swoop)
call-interactively(helm-swoop nil nil)
command-execute(helm-swoop)
This error doesn't occur in your environment?
My test init.el
;; omit leaf activation
(leaf helm
:ensure t
:require helm-config
:leaf-defer nil
:bind (("M-x" . helm-M-x)
("C-x r b" . helm-filtered-bookmarks)
("C-x C-f" . helm-find-files))
:custom ((helm-mode . t))
:config
(leaf helm-swoop
:load-path `,(locate-user-emacs-file "site-lisp/helm-swoop")
:require t
;; :ensure t
:bind (("M-i" . helm-swoop)
;; ("C-S" . helm-swoop-back-to-last-point)
("C-c M-i" . helm-multi-swoop)
("C-x M-i" . helm-multi-swoop-all)
(:isearch-mode-map ("M-i" . helm-swoop-from-isearch))
(:helm-swoop-map ("M-i" . helm-multi-swoop-all-from-helm-swoop)))))
Forget to clean advice, it's OK now. tested with emacs -Q
Perfect, thanks!
Get rid of ad-hoc advice in moving commands.