From: Dmitry Gutov Date: Fri, 15 Oct 2021 12:02:23 +0000 (+0300) Subject: Special-case the "Permission denied" messages X-Git-Tag: emacs-29.0.90~3671^2~557 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7dedba1cc02055befa097f8782cda108f4af08c6;p=emacs.git Special-case the "Permission denied" messages * lisp/progmodes/project.el (project--files-in-directory): Special-case the "Permission denied" messages, to make sure the user sees the unreadable directory's name (https://lists.gnu.org/archive/html/emacs-devel/2021-10/msg01015.html). --- diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 79d2e050d95..ed076a683d1 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -322,7 +322,15 @@ to find the list of ignores for each directory." (process-file-shell-command command nil t)) (pt (point-min))) (unless (zerop status) - (error "File listing failed: %s" (buffer-string))) + (goto-char (point-min)) + (if (and + (not (eql status 127)) + (search-forward "Permission denied\n" nil t)) + (let ((end (1- (point)))) + (re-search-backward "\\`\\|\0") + (error "File listing failed: %s" + (buffer-substring (1+ (point)) end))) + (error "File listing failed: %s" (buffer-string)))) (goto-char pt) (while (search-forward "\0" nil t) (push (buffer-substring-no-properties (1+ pt) (1- (point)))