emacs-devel
[Top][All Lists]
Advanced

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

Re: sqlite3


From: Eli Zaretskii
Subject: Re: sqlite3
Date: Sun, 19 Dec 2021 16:07:25 +0200

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: emacs-devel@gnu.org
> Date: Sun, 19 Dec 2021 12:47:18 +0100
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > We could invent a new symbol for EACCES (like 'file-missing' for
> > ENOENT we already have), and return that instead in this case, instead
> > of the general 'file-error'.
> 
> Yes, I think that would be a good idea.

Is the below good enough?  If so, I will install it.

diff --git a/doc/lispref/errors.texi b/doc/lispref/errors.texi
index f848218..9dd052c 100644
--- a/doc/lispref/errors.texi
+++ b/doc/lispref/errors.texi
@@ -98,6 +98,10 @@ Standard Errors
 @item file-already-exists
 This is a subcategory of @code{file-error}.  @xref{Writing to Files}.
 
+@item permission-denied
+This is a subcategory of @code{file-error}, which occurs when the OS
+doesn't allow Emacs to access a file or a directory for some reason.
+
 @item file-date-error
 This is a subcategory of @code{file-error}.  It occurs when
 @code{copy-file} tries and fails to set the last-modification time of
diff --git a/etc/NEWS b/etc/NEWS
index 862621a..24f3da8 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1186,6 +1186,12 @@ The events 'touchscreen-begin, 'touchscreen-update', and
 'touchscreen-end' have been added to take better advantage of
 touch-capable display panels.
 
++++
+** New error symbol 'permission-denied'.
+This is a subcategory of 'file-error', and is signaled when some file
+operation fails because the OS doesn't allow Emacs to access a file or
+a directory.
+
 
 * Changes in Emacs 29.1 on Non-Free Operating Systems
 
diff --git a/src/fileio.c b/src/fileio.c
index a0563cc..03977ae 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -195,7 +195,11 @@ get_file_errno_data (char const *string, Lisp_Object name, 
int errorno)
   if (errorno == EEXIST)
     return Fcons (Qfile_already_exists, errdata);
   else
-    return Fcons (errorno == ENOENT ? Qfile_missing : Qfile_error,
+    return Fcons (errorno == ENOENT
+                 ? Qfile_missing
+                 : (errorno == EACCES
+                    ? Qpermission_denied
+                    : Qfile_error),
                  Fcons (build_string (string), errdata));
 }
 
@@ -6380,6 +6384,7 @@ syms_of_fileio (void)
   DEFSYM (Qfile_already_exists, "file-already-exists");
   DEFSYM (Qfile_date_error, "file-date-error");
   DEFSYM (Qfile_missing, "file-missing");
+  DEFSYM (Qpermission_denied, "permission-denied");
   DEFSYM (Qfile_notify_error, "file-notify-error");
   DEFSYM (Qremote_file_error, "remote-file-error");
   DEFSYM (Qexcl, "excl");



reply via email to

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