emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 7dedba1: Special-case the "Permission denied" messages


From: Dmitry Gutov
Subject: master 7dedba1: Special-case the "Permission denied" messages
Date: Fri, 15 Oct 2021 08:12:44 -0400 (EDT)

branch: master
commit 7dedba1cc02055befa097f8782cda108f4af08c6
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>

    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).
---
 lisp/progmodes/project.el | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 79d2e05..ed076a6 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)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]