]> git.eshelyaron.com Git - emacs.git/commitdiff
Special-case the "Permission denied" messages
authorDmitry Gutov <dgutov@yandex.ru>
Fri, 15 Oct 2021 12:02:23 +0000 (15:02 +0300)
committerDmitry Gutov <dgutov@yandex.ru>
Fri, 15 Oct 2021 12:12:29 +0000 (15:12 +0300)
* 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).

lisp/progmodes/project.el

index 79d2e050d9516a7e20cd9a592dcd4564ef941e29..ed076a683d169d96d6c53750a050bbc4630bf9bc 100644 (file)
@@ -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)))