emacs-devel
[Top][All Lists]
Advanced

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

Re: project-find-file: switch to include non-tracked files


From: Manuel Uberti
Subject: Re: project-find-file: switch to include non-tracked files
Date: Fri, 15 Oct 2021 07:24:52 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

On 14/10/21 23:55, Dmitry Gutov wrote:
If we end up adding a new user option for this, what would you call it?

Not sure actually. I see a project-ignores and a project-vc-ignores already, maybe these can be leveraged instead of adding a new option?

We should probably try to handle this is a more transparent way, showing the exact error message to the user (when the buffer contains lots of output as well, the message becomes next to useless).

Could you try applying the patch below, removing your recent customization and seeing whether the error message is better now?

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 79d2e050d9..7c3bb9229d 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -322,7 +322,15 @@ project--files-in-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"))
+              (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)))

I did as you described and I got this message when I did C-u C-x p f:

File listing failed: find: ‘./tmp/db’: Permission denied

Two advantages of your approach:
- the message came up quickly
- it hinted directly to the problem

--
Manuel Uberti
www.manueluberti.eu



reply via email to

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