ements--savehist-save-hook can fail when non-symbols appear in command-history
bughelp wantedgood first issuepriority:B
### OS/platform
Debian Trixie on x86_64
### Emacs version and provenance
Distro packaged version:
dpkg --status emacs-lucid
Package: emacs-lucid
Status: install ok installed
Priority: optional
Section: editors
Installed-Size: 46943
Maintainer: Rob Browning <rlb@defaultvalue.org>
Architecture: amd64
Source: emacs
Version: 1:30.1+1-6
### Emacs command
emacsclient -a ''
### Emacs frame type
GUI
### Ement package version and provenance
0.16 via ELPA
### Actions taken
Ran ellama-code-edit
### Observed results
Error running timer ‘savehist-autosave’: (wrong-type-argument symbolp #[128 "\302\303\304!\203\0\305\202\0\306\300#\207" [#<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_15> "sWhat needs to be changed in this code: " apply called-interactively-p any funcall-interactively funcall] 5 cconv--interactive-helper]) [3 times]
### Expected results
No errors while the savehist-autosave is running
### Backtrace
```elisp
Debugger entered--Lisp error: (wrong-type-argument symbolp #[128 "\302\303\304!\203\13\0\305\202\f\0\306\300\3#\207" [#<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_15> "sWhat needs to be changed in this code: " apply called-interactively-p any funcall-interactively funcall] 5 cconv--interactive-helper])
symbol-name(#[128 "\302\303\304!\203\13\0\305\202\f\0\306\300\3#\207" [#<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_15> "sWhat needs to be changed in this code: " apply called-interactively-p any funcall-interactively funcall] 5 cconv--interactive-helper])
(string-match-p "\\`ement-" (symbol-name command))
(let ((command x784)) (string-match-p "\\`ement-" (symbol-name command)))
(let* ((x784 (car-safe arg0))) (let ((command x784)) (string-match-p "\\`ement-" (symbol-name command))))
(progn (ignore (consp arg0)) (let* ((x784 (car-safe arg0))) (let ((command x784)) (string-match-p "\\`ement-" (symbol-name command)))))
#f(lambda (arg0) [t] (progn (ignore (consp arg0)) (let* ((x784 (car-safe arg0))) (let ((command x784)) (string-match-p "\\`ement-" (symbol-name command))))))((#[128 "\302\303\304!\203\13\0\305\202\f\0\306\300\3#\207" [#<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_15> "sWhat needs to be changed in this code: " apply called-interactively-p any funcall-interactively funcall] 5 cconv--interactive-helper] "change all the fprintf calls to error_setg with the passed errp variable"))
cl-remove(nil ((list-timers) (execute-extended-command nil "list-timers" "list-tim") (ielm) (execute-extended-command nil "ielm" "ielm") (helpful-variable 'savehist-minibuffer-history-variables) (helpful-variable 'savehist-save-minibuffer-history) (helpful-function 'savehist-autosave) (execute-extended-command nil "list-timers" "list-tim") (magit-reset-hard "2f4f77ed71e") (magit-checkout "testing/next" nil) (find-file "~/lsrc/qemu.git/.gitpublish" t) (magit-rebase-subset "origin/master" nil '("--update-refs" "--autosquash" "--autostash")) (magit-branch-spinoff "arm/load-dtb-cleanup" nil) (my-counsel-git-grep) (ellama-code-edit "change all the fprintf calls to error_setg with the passed errp variable") (#[128 "\302\303\304!\203\13\0\305\202\f\0\306\300\3#\207" [#<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_15> "sWhat needs to be changed in this code: " apply called-interactively-p any funcall-interactively funcall] 5 cconv--interactive-helper] "change all the fprintf calls to error_setg with the passed errp variable") (ellama-transient-main-menu) (execute-extended-command nil "ellama-transient-main-menu" "ellam") (ellama-transient-main-menu) (execute-extended-command nil "ellama-transient-main-menu") (ellama-transient-main-menu) (execute-extended-command nil "ellama-transient-main-menu" "ell") (ellama-transient-main-menu) (execute-extended-command nil "ellama-transient-main-menu" "ellam") (ellama-transient-main-menu) (execute-extended-command nil "ellama-transient-main-menu" "ellam") (ellama-transient-main-menu) (execute-extended-command nil "ellama-transient-main-menu" "ell") (ellama-transient-main-menu) (execute-extended-command nil "ellama-transient-main-menu" "ellm") (my-counsel-git-grep) (my-counsel-git-grep) (my-counsel-git-grep) (my-counsel-git-grep) (whitespace-mode 'toggle) (execute-extended-command nil "whitespace-mode" "white") (my-counsel-git-grep) (my-counsel-git-grep) (find-file "~/lsrc/qemu.git/util/range.c" t) (my-counsel-git-grep) (my-counsel-git-grep) (query-replace #(".1080p.AMZN.WEB-DL.DDP5.1.H.264-NTb" 0 34 (dired-filename t) 34 35 (rear-nonsticky t dired-filename t)) "" nil (use-region-beginning) (use-region-end) nil (use-region-noncontiguous-p)) (query-replace #("Angie.Tribeca.S02" 0 16 (dired-filename t) 16 17 (rear-nonsticky t dired-filename t)) "s02" nil (use-region-beginning) (use-region-end) nil (use-region-noncontiguous-p)) (whitespace-mode 'toggle) (execute-extended-command nil "whitespace-mode" "white") (magit-stash-pop "stash@{0}") (my-counsel-git-grep) (find-file "~/lsrc/qemu.git/hw/virtio/vhost-user-test-device-pci.c" t) (find-file "~/lsrc/qemu.git/hw/virtio/vhost-user-rng-pci.c" t) (find-file "~/lsrc/qemu.git/hw/virtio/vhost-user-input.c" t) ...) :if #f(lambda (arg0) [t] (progn (ignore (consp arg0)) (let* ((x784 (car-safe arg0))) (let ((command x784)) (string-match-p "\\`ement-" (symbol-name command)))))))
cl-remove-if(#f(lambda (arg0) [t] (progn (ignore (consp arg0)) (let* ((x784 (car-safe arg0))) (let ((command x784)) (string-match-p "\\`ement-" (symbol-name command)))))) ((list-timers) (execute-extended-command nil "list-timers" "list-tim") (ielm) (execute-extended-command nil "ielm" "ielm") (helpful-variable 'savehist-minibuffer-history-variables) (helpful-variable 'savehist-save-minibuffer-history) (helpful-function 'savehist-autosave) (execute-extended-command nil "list-timers" "list-tim") (magit-reset-hard "2f4f77ed71e") (magit-checkout "testing/next" nil) (find-file "~/lsrc/qemu.git/.gitpublish" t) (magit-rebase-subset "origin/master" nil '("--update-refs" "--autosquash" "--autostash")) (magit-branch-spinoff "arm/load-dtb-cleanup" nil) (my-counsel-git-grep) (ellama-code-edit "change all the fprintf calls to error_setg with the passed errp variable") (#[128 "\302\303\304!\203\13\0\305\202\f\0\306\300\3#\207" [#<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_15> "sWhat needs to be changed in this code: " apply called-interactively-p any funcall-interactively funcall] 5 cconv--interactive-helper] "change all the fprintf calls to error_setg with the passed errp variable") (ellama-transient-main-menu) (execute-extended-command nil "ellama-transient-main-menu" "ellam") (ellama-transient-main-menu) (execute-extended-command nil "ellama-transient-main-menu") (ellama-transient-main-menu) (execute-extended-command nil "ellama-transient-main-menu" "ell") (ellama-transient-main-menu) (execute-extended-command nil "ellama-transient-main-menu" "ellam") (ellama-transient-main-menu) (execute-extended-command nil "ellama-transient-main-menu" "ellam") (ellama-transient-main-menu) (execute-extended-command nil "ellama-transient-main-menu" "ell") (ellama-transient-main-menu) (execute-extended-command nil "ellama-transient-main-menu" "ellm") (my-counsel-git-grep) (my-counsel-git-grep) (my-counsel-git-grep) (my-counsel-git-grep) (whitespace-mode 'toggle) (execute-extended-command nil "whitespace-mode" "white") (my-counsel-git-grep) (my-counsel-git-grep) (find-file "~/lsrc/qemu.git/util/range.c" t) (my-counsel-git-grep) (my-counsel-git-grep) (query-replace #(".1080p.AMZN.WEB-DL.DDP5.1.H.264-NTb" 0 34 (dired-filename t) 34 35 (rear-nonsticky t dired-filename t)) "" nil (use-region-beginning) (use-region-end) nil (use-region-noncontiguous-p)) (query-replace #("Angie.Tribeca.S02" 0 16 (dired-filename t) 16 17 (rear-nonsticky t dired-filename t)) "s02" nil (use-region-beginning) (use-region-end) nil (use-region-noncontiguous-p)) (whitespace-mode 'toggle) (execute-extended-command nil "whitespace-mode" "white") (magit-stash-pop "stash@{0}") (my-counsel-git-grep) (find-file "~/lsrc/qemu.git/hw/virtio/vhost-user-test-device-pci.c" t) (find-file "~/lsrc/qemu.git/hw/virtio/vhost-user-rng-pci.c" t) (find-file "~/lsrc/qemu.git/hw/virtio/vhost-user-input.c" t) ...))
(setq command-history (cl-remove-if #'(lambda (arg0) (progn (ignore (consp arg0)) (let* ((x784 ...)) (let (...) (string-match-p "\\`ement-" ...))))) command-history))
ement--savehist-save-hook()
run-hooks(savehist-save-hook)
savehist-save()
eval((savehist-save) t)
ielm-eval-input(#("(savehist-save)" 0 15 (fontified t)) nil)
ielm-send-input(nil)
ielm-return()
funcall-interactively(ielm-return)
command-execute(ielm-return)
```
### Etc.
I think the cl-remove-if logic is too naive about all things in the command history being resolvable symbols:
```
(cl-remove-if (pcase-lambda (`(,command . ,_))
(string-match-p (rx bos "ement-") (symbol-name command)))
command-history)))
```
doing some debugging in ielm:
```
(--map (type-of (car it)) command-history)
(symbol symbol symbol symbol symbol symbol symbol symbol symbol symbol
symbol symbol symbol symbol symbol symbol symbol symbol symbol
symbol symbol symbol symbol symbol symbol byte-code-function
symbol symbol symbol symbol symbol symbol symbol symbol symbol
symbol symbol symbol symbol symbol symbol symbol symbol symbol
symbol symbol symbol symbol symbol symbol symbol symbol symbol
symbol symbol symbol symbol symbol symbol symbol symbol symbol
symbol symbol symbol symbol symbol symbol symbol symbol symbol
symbol symbol symbol symbol symbol symbol symbol symbol symbol)
```
So I think it is the byte-code-function that trips things up. This could potentially be a bug in s-kostyaev/ellama but AFAICT the byte-code-function is a valid entry.
关闭于 2025-11-16 2 条评论