今天更新 ivy 又报错了,counsel-rg 无法使用了,总是 wrong number of arguments。先占个坑,等下贴详细情况。
PS:最近 ivy 的坑有点多啊,不知道为什么
Edit:spacemacs 也许用的不是 counsel-rg?上游一变,spacemacs 自定义函数就崩溃啊
今天更新 ivy 又报错了,counsel-rg 无法使用了,总是 wrong number of arguments。先占个坑,等下贴详细情况。
PS:最近 ivy 的坑有点多啊,不知道为什么
Edit:spacemacs 也许用的不是 counsel-rg?上游一变,spacemacs 自定义函数就崩溃啊
counsel-many-chars 的argument去掉了
哪报错了,不贴信息出来没法围观啊
等下打开emacs再贴详细情况
这一阵踩坑都踩烦了
Debugger entered--Lisp error: (wrong-number-of-arguments (0 . 0) 1)
counsel-more-chars(3)
(if (< (length string) 3) (counsel-more-chars 3) (let* ((default-directory (ivy-state-directory ivy-last)) (args (if (string-match-p " -- " string) (let ((split (split-string string " -- "))) (prog1 (car-safe (prog1 split (setq split (cdr split)))) (setq string (mapconcat (function identity) split " -- ")))) "")) (regex (counsel-unquote-regex-parens (setq ivy--old-re (ivy--regex string))))) (setq spacemacs--counsel-search-cmd (format (symbol-value G0) args regex)) (spacemacs//counsel-async-command spacemacs--counsel-search-cmd) nil))
(lambda (G0 string &optional _pred &rest _unused) (if (< (length string) 3) (counsel-more-chars 3) (let* ((default-directory (ivy-state-directory ivy-last)) (args (if (string-match-p " -- " string) (let ((split (split-string string " -- "))) (prog1 (car-safe (prog1 split (setq split (cdr split)))) (setq string (mapconcat (function identity) split " -- ")))) "")) (regex (counsel-unquote-regex-parens (setq ivy--old-re (ivy--regex string))))) (setq spacemacs--counsel-search-cmd (format (symbol-value G0) args regex)) (spacemacs//counsel-async-command spacemacs--counsel-search-cmd) nil)))(--base-cmd-- "")
apply((lambda (G0 string &optional _pred &rest _unused) (if (< (length string) 3) (counsel-more-chars 3) (let* ((default-directory (ivy-state-directory ivy-last)) (args (if (string-match-p " -- " string) (let ((split (split-string string " -- "))) (prog1 (car-safe (prog1 split (setq split (cdr split)))) (setq string (mapconcat (function identity) split " -- ")))) "")) (regex (counsel-unquote-regex-parens (setq ivy--old-re (ivy--regex string))))) (setq spacemacs--counsel-search-cmd (format (symbol-value G0) args regex)) (spacemacs//counsel-async-command spacemacs--counsel-search-cmd) nil))) --base-cmd-- "")
(lambda (&rest --cl-rest--) "Grep in the current directory for STRING." (apply (function (lambda (G0 string &optional _pred &rest _unused) (if (< (length string) 3) (counsel-more-chars 3) (let* ((default-directory (ivy-state-directory ivy-last)) (args (if (string-match-p " -- " string) (let ((split (split-string string " -- "))) (prog1 (car-safe (prog1 split (setq split (cdr split)))) (setq string (mapconcat (function identity) split " -- ")))) "")) (regex (counsel-unquote-regex-parens (setq ivy--old-re (ivy--regex string))))) (setq spacemacs--counsel-search-cmd (format (symbol-value G0) args regex)) (spacemacs//counsel-async-command spacemacs--counsel-search-cmd) nil)))) '--base-cmd-- --cl-rest--))("")
ivy--reset-state(#s(ivy-state :prompt "%-4d rg from [d:/James/.emacs.d/]: " :collection (lambda (&rest --cl-rest--) "Grep in the current directory for STRING." (apply (function (lambda (G0 string &optional _pred &rest _unused) (if (< (length string) 3) (counsel-more-chars 3) (let* ((default-directory (ivy-state-directory ivy-last)) (args (if (string-match-p " -- " string) (let ((split (split-string string " -- "))) (prog1 (car-safe (prog1 split (setq split (cdr split)))) (setq string (mapconcat (function identity) split " -- ")))) "")) (regex (counsel-unquote-regex-parens (setq ivy--old-re (ivy--regex string))))) (setq spacemacs--counsel-search-cmd (format (symbol-value G0) args regex)) (spacemacs//counsel-async-command spacemacs--counsel-search-cmd) nil)))) '--base-cmd-- --cl-rest--)) :predicate nil :require-match nil :initial-input "" :history counsel-git-grep-history :preselect nil :keymap (keymap (3 keymap (5 . spacemacs//counsel-edit)) (f3 . spacemacs//counsel-save-in-buffer)) :update-fn nil :sort nil :frame #<frame [email protected] 00000000073a26a0> :window #<window 3 on init.el> :buffer #<buffer init.el> :text nil :action (1 ("o" counsel-git-grep-action "default") ("i" #f(compiled-function (x) #<bytecode 0xf32685>) "insert") ("w" #f(compiled-function (x) #<bytecode 0xf32649>) "copy")) :unwind (lambda nil (counsel-delete-process) (swiper--cleanup)) :re-builder nil :matcher nil :dynamic-collection t :display-transformer-fn counsel-git-grep-transformer :directory "d:/James/.emacs.d/" :caller spacemacs/counsel-search :current nil :def nil))
ivy-read("%-4d rg from [d:/James/.emacs.d/]: " (lambda (&rest --cl-rest--) "Grep in the current directory for STRING." (apply (function (lambda (G0 string &optional _pred &rest _unused) (if (< (length string) 3) (counsel-more-chars 3) (let* ((default-directory (ivy-state-directory ivy-last)) (args (if (string-match-p " -- " string) (let ((split (split-string string " -- "))) (prog1 (car-safe (prog1 split (setq split (cdr split)))) (setq string (mapconcat (function identity) split " -- ")))) "")) (regex (counsel-unquote-regex-parens (setq ivy--old-re (ivy--regex string))))) (setq spacemacs--counsel-search-cmd (format (symbol-value G0) args regex)) (spacemacs//counsel-async-command spacemacs--counsel-search-cmd) nil)))) '--base-cmd-- --cl-rest--)) :initial-input "" :dynamic-collection t :history counsel-git-grep-history :action counsel-git-grep-action :caller spacemacs/counsel-search :keymap (keymap (3 keymap (5 . spacemacs//counsel-edit)) (f3 . spacemacs//counsel-save-in-buffer)) :unwind (lambda nil (counsel-delete-process) (swiper--cleanup)))
(let ((default-directory (or initial-directory (read-directory-name "Start from directory: ")))) (ivy-read (concat ivy-count-format (format "%s from [%s]: " tool (if (< (length default-directory) spacemacs--counsel-search-max-path-length) default-directory (concat "..." (substring default-directory (- (length default-directory) spacemacs--counsel-search-max-path-length) (length default-directory)))))) (spacemacs//make-counsel-search-function tool) :initial-input (if initial-input (progn (rxt-quote-pcre initial-input))) :dynamic-collection t :history 'counsel-git-grep-history :action (function counsel-git-grep-action) :caller 'spacemacs/counsel-search :keymap spacemacs--counsel-map :unwind (function (lambda nil (counsel-delete-process) (swiper--cleanup)))))
(let ((tool (catch 'tool (let ((--dolist-tail-- tools) tool) (while --dolist-tail-- (setq tool (car --dolist-tail--)) (if (and (assoc-string tool spacemacs--counsel-commands) (executable-find tool)) (progn (throw 'tool tool))) (setq --dolist-tail-- (cdr --dolist-tail--)))) (throw 'tool "grep")))) (let ((default-directory (or initial-directory (read-directory-name "Start from directory: ")))) (ivy-read (concat ivy-count-format (format "%s from [%s]: " tool (if (< (length default-directory) spacemacs--counsel-search-max-path-length) default-directory (concat "..." (substring default-directory (- (length default-directory) spacemacs--counsel-search-max-path-length) (length default-directory)))))) (spacemacs//make-counsel-search-function tool) :initial-input (if initial-input (progn (rxt-quote-pcre initial-input))) :dynamic-collection t :history 'counsel-git-grep-history :action (function counsel-git-grep-action) :caller 'spacemacs/counsel-search :keymap spacemacs--counsel-map :unwind (function (lambda nil (counsel-delete-process) (swiper--cleanup))))))
(let ((initial-input (if use-initial-input (if (region-active-p) (buffer-substring-no-properties (region-beginning) (region-end)) (thing-at-point 'symbol t)) ""))) (let ((tool (catch 'tool (let ((--dolist-tail-- tools) tool) (while --dolist-tail-- (setq tool (car --dolist-tail--)) (if (and (assoc-string tool spacemacs--counsel-commands) (executable-find tool)) (progn (throw 'tool tool))) (setq --dolist-tail-- (cdr --dolist-tail--)))) (throw 'tool "grep")))) (let ((default-directory (or initial-directory (read-directory-name "Start from directory: ")))) (ivy-read (concat ivy-count-format (format "%s from [%s]: " tool (if (< (length default-directory) spacemacs--counsel-search-max-path-length) default-directory (concat "..." (substring default-directory (- (length default-directory) spacemacs--counsel-search-max-path-length) (length default-directory)))))) (spacemacs//make-counsel-search-function tool) :initial-input (if initial-input (progn (rxt-quote-pcre initial-input))) :dynamic-collection t :history 'counsel-git-grep-history :action (function counsel-git-grep-action) :caller 'spacemacs/counsel-search :keymap spacemacs--counsel-map :unwind (function (lambda nil (counsel-delete-process) (swiper--cleanup)))))))
spacemacs/counsel-search(("rg" "ag" "pt" "ack" "grep") nil "d:/James/.emacs.d/")
spacemacs/search-project-auto()
funcall-interactively(spacemacs/search-project-auto)
call-interactively(spacemacs/search-project-auto nil nil)
command-execute(spacemacs/search-project-auto)
@fuxialexander 除了回滚之外有没有什么 workaround?
master 中把 counsel-more-chars
的参数去掉了,改为从一个可配置的 alist 中读,你这怎么还有传入 3
呢?
嗯,看到了,我已经提交了一个 PR 给 spacemacs,谢谢
原来是直接用了,看了下 PR ,我觉得把 if 条件中的硬编码也去掉比较一致一些。