all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#44979: project-search fails with file-missing error
@ 2020-12-01  3:15 Dmitry Gutov
  2020-12-01 15:34 ` Eli Zaretskii
  2021-07-30 13:00 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 5+ messages in thread
From: Dmitry Gutov @ 2020-12-01  3:15 UTC (permalink / raw)
  To: 44979

I have a few broken symlinks in the current project, and when doing a 
search, it stops at the first one it sees, with a backtrace like

(file-missing "Opening input file" "No such file or directory" 
"etc/etc/etc")
   insert-file-contents("etc/etc/etc" nil)
   (if (not (and new novisit)) (set-buffer (find-file-noselect next)) 
(set-buffer (get-buffer-create " *next-file*")) 
(kill-all-local-variables) (erase-buffer) (setq new next) 
(insert-file-contents new nil))
   (let* ((buffer (get-file-buffer next)) (new (not buffer))) (and 
buffer fileloop-revert-buffers (not (verify-visited-file-modtime 
buffer)) (if (eq fileloop-revert-buffers 'silent) (and (not 
(buffer-modified-p buffer)) (let ((revertible nil)) (let 
((--dolist-tail-- revert-without-query)) (while --dolist-tail-- (let ... 
... ...))) revertible)) (y-or-n-p (format (if (buffer-modified-p buffer) 
"File %s changed on disk.  Discard your edits? " "File %s changed on 
disk.  Reread from disk? ") next))) (save-current-buffer (set-buffer 
buffer) (revert-buffer t t))) (if (not (and new novisit)) (set-buffer 
(find-file-noselect next)) (set-buffer (get-buffer-create " 
*next-file*")) (kill-all-local-variables) (erase-buffer) (setq new next) 
(insert-file-contents new nil)) new)
   (let ((next (condition-case nil (iter-next fileloop--iterator) 
(iter-end-of-sequence nil)))) (if next nil (and novisit (get-buffer " 
*next-file*") (kill-buffer " *next-file*")) (user-error "All files 
processed")) (let* ((buffer (get-file-buffer next)) (new (not buffer))) 
(and buffer fileloop-revert-buffers (not (verify-visited-file-modtime 
buffer)) (if (eq fileloop-revert-buffers 'silent) (and (not 
(buffer-modified-p buffer)) (let ((revertible nil)) (let (...) (while 
--dolist-tail-- ...)) revertible)) (y-or-n-p (format (if 
(buffer-modified-p buffer) "File %s changed on disk.  Discard your 
edits? " "File %s changed on disk.  Reread from disk? ") next))) 
(save-current-buffer (set-buffer buffer) (revert-buffer t t))) (if (not 
(and new novisit)) (set-buffer (find-file-noselect next)) (set-buffer 
(get-buffer-create " *next-file*")) (kill-all-local-variables) 
(erase-buffer) (setq new next) (insert-file-contents new nil)) new))
   fileloop-next-file(t)

Not such what's the best solution, but either all commands which use 
fileloop should pre-filter the list with file-exists-p, or 
fileloop-next-file should skip over nonexistent files. This seems to work:

diff --git a/lisp/fileloop.el b/lisp/fileloop.el
index b778eca8e9..289df6d593 100644
--- a/lisp/fileloop.el
+++ b/lisp/fileloop.el
@@ -120,7 +120,10 @@ fileloop-next-file
          (kill-all-local-variables)
          (erase-buffer)
          (setq new next)
-        (insert-file-contents new nil))
+        (condition-case nil
+            (insert-file-contents new nil)
+          (file-missing
+           (fileloop-next-file novisit))))
        new)))

  (defun fileloop-continue ()





^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-07-30 13:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-01  3:15 bug#44979: project-search fails with file-missing error Dmitry Gutov
2020-12-01 15:34 ` Eli Zaretskii
2020-12-01 16:12   ` Dmitry Gutov
2020-12-01 18:25     ` Eli Zaretskii
2021-07-30 13:00 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.