; Visit files listed in current buffer ; Last edited on 2000-08-14 17:18:35 by stolfi (defun stolfi-visit-files-in-region (start end) "Splits region into files separated by blanks or commas, and visits each file into a separate buffer." (interactive "r") (save-excursion (let ((files) (bp) (ep) (fname) (nfiles 0) (okay t)) ; Collect file name list (goto-char start) (while (and (re-search-forward "[ ,\011\012\014\015]*\\([^ ,\011\012\014\015]+\\)" end t 1 ) (or (not (= nfiles 50)) (setq okay (yes-or-no-p "more than 50 files, continue?")) ) ) (setq bp (match-beginning 1)) (setq ep (match-end 1)) (if (or (null bp) (null ep)) (error "unexpected search failure")) (setq files (cons (buffer-substring bp ep) files)) (setq nfiles (+ 1 nfiles)) ) (if okay (mapcar 'stolfi-check-and-visit-file (reverse files)) ) nil ) ) ) (defun stolfi-check-and-visit-file (fname) "Checks if file `fname' exists, if so opens it on another window." (if (file-readable-p fname) (save-excursion (find-file-other-window fname) ) (message "file %s not readable" fname) ) nil )