0

I seem to have updated something which is causing recentf to fail, not sure.

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  file-readable-p(nil)
  (and (file-readable-p filename) (recentf-include-p filename) filename)
  (lambda (filename) (and (file-readable-p filename) (recentf-include-p filename) filename))(nil)
  mapcar((lambda (filename) (and (file-readable-p filename) (recentf-include-p filename) filename)) (nil))
  (delq nil (mapcar #'(lambda (filename) (and (file-readable-p filename) (recentf-include-p filename) filename)) recentf-list))
  (setq recentf-list (delq nil (mapcar #'(lambda (filename) (and (file-readable-p filename) (recentf-include-p filename) filename)) recentf-list)))
  (let ((count (length recentf-list))) (setq recentf-list (delq nil (mapcar #'(lambda (filename) (and (file-readable-p filename) (recentf-include-p filename) filename)) recentf-list))) (setq count (- count (length recentf-list))) (message "%s removed from the list" (cond ((= count 0) "No file") ((= count 1) "One file") (t (format "%d files" count)))))
  recentf-cleanup()
  (if (eq recentf-auto-cleanup 'enable) (recentf-cleanup))
  (cond (on-p (recentf-rebuild-virtual-pathes) (if recentf-initialized-p nil (setq recentf-initialized-p t) (if (file-readable-p recentf-save-file) (load-file recentf-save-file)) (setq recentf-update-menu-p t) (add-hook 'find-file-hooks 'recentf-add-file-hook) (add-hook 'write-file-hooks 'recentf-add-file-hook) (add-hook (if nil 'activate-menubar-hook 'menu-bar-update-hook) 'recentf-update-menu-hook) (add-hook 'kill-emacs-hook 'recentf-save-list)) (if (eq recentf-auto-cleanup 'enable) (recentf-cleanup))) (recentf-initialized-p (setq recentf-initialized-p nil) (recentf-save-list) (easy-menu-remove-item nil recentf-menu-path recentf-menu-title) (remove-hook 'find-file-hooks 'recentf-add-file-hook) (remove-hook 'write-file-hooks 'recentf-add-file-hook) (remove-hook (if nil 'activate-menubar-hook 'menu-bar-update-hook) 'recentf-update-menu-hook) (remove-hook 'kill-emacs-hook 'recentf-save-list) (recentf-cancel-cleanup-timer)))
  (let ((on-p (if arg (> (prefix-numeric-value arg) 0) (not recentf-mode)))) (cond (on-p (recentf-rebuild-virtual-pathes) (if recentf-initialized-p nil (setq recentf-initialized-p t) (if (file-readable-p recentf-save-file) (load-file recentf-save-file)) (setq recentf-update-menu-p t) (add-hook 'find-file-hooks 'recentf-add-file-hook) (add-hook 'write-file-hooks 'recentf-add-file-hook) (add-hook (if nil 'activate-menubar-hook 'menu-bar-update-hook) 'recentf-update-menu-hook) (add-hook 'kill-emacs-hook 'recentf-save-list)) (if (eq recentf-auto-cleanup 'enable) (recentf-cleanup))) (recentf-initialized-p (setq recentf-initialized-p nil) (recentf-save-list) (easy-menu-remove-item nil recentf-menu-path recentf-menu-title) (remove-hook 'find-file-hooks 'recentf-add-file-hook) (remove-hook 'write-file-hooks 'recentf-add-file-hook) (remove-hook (if nil 'activate-menubar-hook 'menu-bar-update-hook) 'recentf-update-menu-hook) (remove-hook 'kill-emacs-hook 'recentf-save-list) (recentf-cancel-cleanup-timer))) (setq recentf-mode on-p))
  recentf-mode(1)
  eval-buffer(#<buffer  *load*> nil "/home/b0ef/.emacs.d/init.el" nil t)  ; Reading at buffer position 143162
  load-with-code-conversion("/home/b0ef/.emacs.d/init.el" "/home/b0ef/.emacs.d/init.el" t t)
  load("/home/b0ef/.emacs.d/init" noerror nomessage)
  startup--load-user-init-file(#f(compiled-function () #<bytecode -0xfdba33d4b028da0>) #f(compiled-function () #<bytecode -0x1f3c686ddc0cdc35>) t)
  command-line()
  normal-top-level()

If I disable recentf-mode, I seem to get problems with ivy-switch-buffer:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  file-readable-p(nil)
  (and (file-readable-p filename) (recentf-include-p filename) filename)
  (lambda (filename) (and (file-readable-p filename) (recentf-include-p filename) filename))(nil)
  mapcar((lambda (filename) (and (file-readable-p filename) (recentf-include-p filename) filename)) ("/mnt/b53d6116-b84e-4cbb-a7d0-cc1cfb3089d9/ds/platf..." "/mnt/b53d6116-b84e-4cbb-a7d0-cc1cfb3089d9/ds/platf..." "/tmp/foo.txt" nil))
  (delq nil (mapcar #'(lambda (filename) (and (file-readable-p filename) (recentf-include-p filename) filename)) recentf-list))
  (setq recentf-list (delq nil (mapcar #'(lambda (filename) (and (file-readable-p filename) (recentf-include-p filename) filename)) recentf-list)))
  (let ((count (length recentf-list))) (setq recentf-list (delq nil (mapcar #'(lambda (filename) (and (file-readable-p filename) (recentf-include-p filename) filename)) recentf-list))) (setq count (- count (length recentf-list))) (message "%s removed from the list" (cond ((= count 0) "No file") ((= count 1) "One file") (t (format "%d files" count)))))
  recentf-cleanup()
  (if (eq recentf-auto-cleanup 'enable) (recentf-cleanup))
  (cond (on-p (recentf-rebuild-virtual-pathes) (if recentf-initialized-p nil (setq recentf-initialized-p t) (if (file-readable-p recentf-save-file) (load-file recentf-save-file)) (setq recentf-update-menu-p t) (add-hook 'find-file-hooks 'recentf-add-file-hook) (add-hook 'write-file-hooks 'recentf-add-file-hook) (add-hook (if nil 'activate-menubar-hook 'menu-bar-update-hook) 'recentf-update-menu-hook) (add-hook 'kill-emacs-hook 'recentf-save-list)) (if (eq recentf-auto-cleanup 'enable) (recentf-cleanup))) (recentf-initialized-p (setq recentf-initialized-p nil) (recentf-save-list) (easy-menu-remove-item nil recentf-menu-path recentf-menu-title) (remove-hook 'find-file-hooks 'recentf-add-file-hook) (remove-hook 'write-file-hooks 'recentf-add-file-hook) (remove-hook (if nil 'activate-menubar-hook 'menu-bar-update-hook) 'recentf-update-menu-hook) (remove-hook 'kill-emacs-hook 'recentf-save-list) (recentf-cancel-cleanup-timer)))
  (let ((on-p (if arg (> (prefix-numeric-value arg) 0) (not recentf-mode)))) (cond (on-p (recentf-rebuild-virtual-pathes) (if recentf-initialized-p nil (setq recentf-initialized-p t) (if (file-readable-p recentf-save-file) (load-file recentf-save-file)) (setq recentf-update-menu-p t) (add-hook 'find-file-hooks 'recentf-add-file-hook) (add-hook 'write-file-hooks 'recentf-add-file-hook) (add-hook (if nil 'activate-menubar-hook 'menu-bar-update-hook) 'recentf-update-menu-hook) (add-hook 'kill-emacs-hook 'recentf-save-list)) (if (eq recentf-auto-cleanup 'enable) (recentf-cleanup))) (recentf-initialized-p (setq recentf-initialized-p nil) (recentf-save-list) (easy-menu-remove-item nil recentf-menu-path recentf-menu-title) (remove-hook 'find-file-hooks 'recentf-add-file-hook) (remove-hook 'write-file-hooks 'recentf-add-file-hook) (remove-hook (if nil 'activate-menubar-hook 'menu-bar-update-hook) 'recentf-update-menu-hook) (remove-hook 'kill-emacs-hook 'recentf-save-list) (recentf-cancel-cleanup-timer))) (setq recentf-mode on-p))
  recentf-mode(1)
  ivy--virtual-buffers()
  ivy--buffer-list("" (ivy-switch-buffer ivy-switch-buffer-other-window counsel-switch-buffer) nil)
  ivy--reset-state(#s(ivy-state :prompt "Switch to buffer: " :collection internal-complete-buffer :predicate nil :require-match nil :initial-input nil :history nil :preselect "*scratch*" :keymap (keymap (11 . ivy-switch-buffer-kill)) :update-fn nil :sort nil :frame #<frame F1 0x2ad7ee8> :window #<window 1 on *GNU Emacs*> :buffer #<buffer *GNU Emacs*> :text nil :action (1 ("o" ivy--switch-buffer-action "default") ("i" ivy--action-insert "insert") ("w" ivy--action-copy "copy") ("f" ivy--find-file-action "find file") ("j" ivy--switch-buffer-other-window-action "other window") ("k" ivy--kill-buffer-action "kill") ("r" ivy--rename-buffer-action "rename") ("x" counsel-open-buffer-file-externally "open externally")) :unwind nil :re-builder ivy--regex-fuzzy :matcher ivy--switch-buffer-matcher :dynamic-collection nil :display-transformer-fn ivy-switch-buffer-transformer :directory "~/" :caller ivy-switch-buffer :current nil :def nil :ignore t :multi-action nil :extra-props nil))
  ivy-read("Switch to buffer: " internal-complete-buffer :keymap (keymap (11 . ivy-switch-buffer-kill)) :preselect "*scratch*" :action ivy--switch-buffer-action :matcher ivy--switch-buffer-matcher :caller ivy-switch-buffer)
  ivy-switch-buffer()
  funcall-interactively(ivy-switch-buffer)
  call-interactively(ivy-switch-buffer nil nil)
  command-execute(ivy-switch-buffer)

I'm not really sure what I did, cause this worked perfectly before;)

I'm using emacs-28, but to see if it was version related, I just installed emacs-30 from git and I have the same problem there.

Ok, thanks to the help, I figured it out.

I had to delete ~/.recentf, which I had already done, but I had to do it once more, for whatever reason.

BTW: Any way I can specify where this file should be, so that I can back it up?

This is a stupid problem; how can this happen?

less .recentf-wtf2
;;; Automatically generated by `recentf' on Sat Feb 25 21:51:10 2023.
(setq recentf-list
      '(
        "/mnt/b53d6116-b84e-4cbb-a7d0-cc1cfb3089d9/ds/platform/conf/home.dot.emacs.dot.d.emacsen.org"
        "/tmp/wtf.org"
        "/mnt/b53d6116-b84e-4cbb-a7d0-cc1cfb3089d9/ds/platform/conf/home.dot.emacs.dot.d.emacsen.el"
        "/tmp/foo.txt"
        nil
        ))
(setq recentf-filter-changer-state
      '(
        nil
        ))

1 Answer 1

1

Bisect your init file to find the culprit.

For some reason, your initial value of recentf-list is (nil); that is, it contains nil, which is not a file name (not a string). If there are no file names then the list should just be empty: () (aka nil).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.