* bug#19642: Don't downcase system diagnostics' first letters
@ 2015-01-20 22:24 Paul Eggert
2015-01-21 15:09 ` Stefan Monnier
0 siblings, 1 reply; 3+ messages in thread
From: Paul Eggert @ 2015-01-20 22:24 UTC (permalink / raw)
To: 19642
[-- Attachment #1: Type: text/plain, Size: 156 bytes --]
Tags: patch
The attached patch follows up on a bug report sent to emacs-devel, here:
http://lists.gnu.org/archive/html/emacs-devel/2015-01/msg00553.html
[-- Attachment #2: 0001-Don-t-downcase-system-diagnostics-first-letters.patch --]
[-- Type: text/x-patch, Size: 11732 bytes --]
From 9f509aaf80430fd3281134199faec8c4c989707d Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Tue, 20 Jan 2015 14:21:40 -0800
Subject: [PATCH] Don't downcase system diagnostics' first letters
* etc/NEWS: Document this.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file):
* lisp/ffap.el (find-file-at-point):
* lisp/files.el (insert-file-1):
* lisp/net/ange-ftp.el (ange-ftp-barf-if-not-directory)
(ange-ftp-copy-file-internal):
* lisp/progmodes/etags.el (visit-tags-table):
* lisp/url/url-dav.el (url-dav-delete-directory, url-dav-delete-file)
(url-dav-directory-files):
Keep diagnostics consistent with system's.
* lisp/erc/erc-dcc.el (erc-dcc-server):
* lisp/ffap.el (ffap-machine-p):
Ignore case while comparing diagnostics.
* src/fileio.c (report_file_errno): Don't downcase, and simplify.
---
etc/ChangeLog | 5 +++++
etc/NEWS | 5 +++++
lisp/ChangeLog | 13 +++++++++++++
lisp/emacs-lisp/bytecomp.el | 4 ++--
lisp/erc/ChangeLog | 5 +++++
lisp/erc/erc-dcc.el | 3 +--
lisp/ffap.el | 4 ++--
lisp/files.el | 2 +-
lisp/net/ange-ftp.el | 6 +++---
lisp/progmodes/etags.el | 2 +-
lisp/url/ChangeLog | 6 ++++++
lisp/url/url-dav.el | 6 +++---
src/ChangeLog | 3 +++
src/fileio.c | 40 ++++++++++------------------------------
14 files changed, 60 insertions(+), 44 deletions(-)
diff --git a/etc/ChangeLog b/etc/ChangeLog
index 7b64dfb..3b2a421 100644
--- a/etc/ChangeLog
+++ b/etc/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-20 Paul Eggert <eggert@cs.ucla.edu>
+
+ Don't downcase system diagnostics' first letters
+ * NEWS: Document this.
+
2015-01-16 Artur Malabarba <bruce.connor.am@gmail.com>
* NEWS: Document installing packages from directories.
diff --git a/etc/NEWS b/etc/NEWS
index 548b54d..c732e3d 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -531,6 +531,11 @@ position list returned for such events is now nil.
These slots used to hold key-shortcut data, but have been obsolete since
Emacs-21.
+** Emacs no longer downcases the first letter of a system diagnostic
+when signaling a file error. For example, it now reports "Permission
+denied" instead of "permission denied". The old behavior was problematic
+in languages like German where downcasing rules depend on grammar.
+
\f
* Lisp Changes in Emacs 25.1
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b5824ab..46864e8 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,16 @@
+2015-01-20 Paul Eggert <eggert@cs.ucla.edu>
+
+ Don't downcase system diagnostics' first letters
+ * emacs-lisp/bytecomp.el (byte-compile-file):
+ * ffap.el (find-file-at-point):
+ * files.el (insert-file-1):
+ * net/ange-ftp.el (ange-ftp-barf-if-not-directory)
+ (ange-ftp-copy-file-internal):
+ * progmodes/etags.el (visit-tags-table):
+ Keep diagnostics consistent with system's.
+ * ffap.el (ffap-machine-p):
+ Ignore case while comparing diagnostics.
+
2015-01-20 Stefan Monnier <monnier@iro.umontreal.ca>
* emacs-lisp/eieio-generic.el: Remove.
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 8440570..2bd8d07 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1863,8 +1863,8 @@ The value is non-nil if there were no errors, nil if errors."
(signal 'file-error
(list "Opening output file"
(if (file-exists-p target-file)
- "cannot overwrite file"
- "directory not writable or nonexistent")
+ "Cannot overwrite file"
+ "Directory not writable or nonexistent")
target-file)))
(kill-buffer (current-buffer)))
(if (and byte-compile-generate-call-tree
diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog
index 1b54fb6..26c31b7 100644
--- a/lisp/erc/ChangeLog
+++ b/lisp/erc/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-20 Paul Eggert <eggert@cs.ucla.edu>
+
+ Don't downcase system diagnostics' first letters
+ * erc-dcc.el (erc-dcc-server): Ignore case while comparing diagnostics.
+
2014-11-23 Michael Albinus <michael.albinus@gmx.de>
* erc-desktop-notifications.el (erc-notifications-bus):
diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el
index 9d52c3b..182f1e0 100644
--- a/lisp/erc/erc-dcc.el
+++ b/lisp/erc/erc-dcc.el
@@ -379,7 +379,7 @@ created subprocess, or nil."
(set-process-filter-multibyte process nil)))))
(file-error
(unless (and (string= "Cannot bind server socket" (nth 1 err))
- (string= "address already in use" (nth 2 err)))
+ (string= "address already in use" (downcase (nth 2 err))))
(signal (car err) (cdr err)))
(setq port (1+ port))
(unless (< port upper)
@@ -1264,4 +1264,3 @@ other client."
;; Local Variables:
;; indent-tabs-mode: nil
;; End:
-
diff --git a/lisp/ffap.el b/lisp/ffap.el
index 1b8ea60..350a6bd 100644
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -476,7 +476,7 @@ Returned values:
;; (file-error "connection failed" "address already in use"
;; "ftp.uu.net" "ffap-machine-p")
((equal mesg "connection failed")
- (if (equal (nth 2 error) "permission denied")
+ (if (string= (downcase (nth 2 error)) "permission denied")
nil ; host does not exist
;; Other errors mean the host exists:
(nth 2 error)))
@@ -1439,7 +1439,7 @@ and the functions `ffap-file-at-point' and `ffap-url-at-point'."
(expand-file-name filename)))
;; User does not want to find a non-existent file:
((signal 'file-error (list "Opening file buffer"
- "no such file or directory"
+ "No such file or directory"
filename)))))))
;; Shortcut: allow {M-x ffap} rather than {M-x find-file-at-point}.
diff --git a/lisp/files.el b/lisp/files.el
index e9632ed..ed1943d 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2128,7 +2128,7 @@ This function ensures that none of these modifications will take place."
(defun insert-file-1 (filename insert-func)
(if (file-directory-p filename)
- (signal 'file-error (list "Opening input file" "file is a directory"
+ (signal 'file-error (list "Opening input file" "Is a directory"
filename)))
;; Check whether the file is uncommonly large
(abort-if-file-too-large (nth 7 (file-attributes filename)) "insert" filename)
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index 17db6e7..52153ad 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -1536,8 +1536,8 @@ then kill the related FTP process."
(signal 'file-error
(list "Opening directory"
(if (file-exists-p directory)
- "not a directory"
- "no such file or directory")
+ "Not a directory"
+ "No such file or directory")
directory))))
\f
;;;; ------------------------------------------------------------
@@ -3664,7 +3664,7 @@ so return the size on the remote host exactly. See RFC 3659."
(or (file-exists-p filename)
(signal 'file-error
- (list "Copy file" "no such file or directory" filename)))
+ (list "Copy file" "No such file or directory" filename)))
;; canonicalize newname if a directory.
(if (file-directory-p newname)
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index dc3380d..3797627 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -308,7 +308,7 @@ file the tag was in."
(save-excursion
(or (visit-tags-table-buffer file)
(signal 'file-error (list "Visiting tags table"
- "file does not exist"
+ "No such file or directory"
file)))
;; Set FILE to the expanded name.
(setq file tags-file-name)))
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog
index 1f5ece0..bb40bee 100644
--- a/lisp/url/ChangeLog
+++ b/lisp/url/ChangeLog
@@ -1,3 +1,9 @@
+2015-01-20 Paul Eggert <eggert@cs.ucla.edu>
+
+ Don't downcase system diagnostics' first letters
+ * url-dav.el (url-dav-delete-directory, url-dav-delete-file)
+ (url-dav-directory-files): Keep diagnostics consistent with system's.
+
2014-12-12 Lars Magne Ingebrigtsen <larsi@gnus.org>
* url-http.el (url-http-parse-headers): `gnutls-available-p' is
diff --git a/lisp/url/url-dav.el b/lisp/url/url-dav.el
index 65747e9..61ca088 100644
--- a/lisp/url/url-dav.el
+++ b/lisp/url/url-dav.el
@@ -741,7 +741,7 @@ files in the collection as well."
(if (and (not recursive)
(/= (length props) 1))
(signal 'file-error (list "Removing directory"
- "directory not empty" url)))))
+ "Directory not empty" url)))))
(mapc (lambda (result)
(setq status (plist-get (cdr result) 'DAV:status))
@@ -760,7 +760,7 @@ files in the collection as well."
url lock-token
(setq props (url-dav-get-properties url))
(if (eq (plist-get (cdar props) 'DAV:resourcetype) 'DAV:collection)
- (signal 'file-error (list "Removing old name" "is a collection" url)))))
+ (signal 'file-error (list "Removing old name" "Is a collection" url)))))
(mapc (lambda (result)
(setq status (plist-get (cdr result) 'DAV:status))
@@ -787,7 +787,7 @@ If NOSORT is non-nil, the list is not sorted--its order is unpredictable.
(when (and (= (length properties) 1)
(not (url-dav-file-directory-p url)))
- (signal 'file-error (list "Opening directory" "not a directory" url)))
+ (signal 'file-error (list "Opening directory" "Not a directory" url)))
(while properties
(setq child-props (pop properties)
diff --git a/src/ChangeLog b/src/ChangeLog
index e5e4fe9..e8b1b96 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,8 @@
2015-01-20 Paul Eggert <eggert@cs.ucla.edu>
+ Don't downcase system diagnostics' first letters
+ * fileio.c (report_file_errno): Don't downcase, and simplify.
+
Undo port to hypothetical nonzero Qnil case
This mostly undoes the previous change in this area. See:
http://lists.gnu.org/archive/html/emacs-devel/2015-01/msg00570.html
diff --git a/src/fileio.c b/src/fileio.c
index ff6720d..d0fd08a 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -186,37 +186,17 @@ void
report_file_errno (char const *string, Lisp_Object name, int errorno)
{
Lisp_Object data = CONSP (name) || NILP (name) ? name : list1 (name);
- Lisp_Object errstring;
- char *str;
-
synchronize_system_messages_locale ();
- str = strerror (errorno);
- errstring = code_convert_string_norecord (build_unibyte_string (str),
- Vlocale_coding_system, 0);
-
- while (1)
- switch (errorno)
- {
- case EEXIST:
- xsignal (Qfile_already_exists, Fcons (errstring, data));
- break;
- default:
- /* System error messages are capitalized. Downcase the initial
- unless it is followed by a slash. (The slash case caters to
- error messages that begin with "I/O" or, in German, "E/A".) */
- if (STRING_MULTIBYTE (errstring)
- && ! EQ (Faref (errstring, make_number (1)), make_number ('/')))
- {
- int c;
-
- str = SSDATA (errstring);
- c = STRING_CHAR ((unsigned char *) str);
- Faset (errstring, make_number (0), make_number (downcase (c)));
- }
-
- xsignal (Qfile_error,
- Fcons (build_string (string), Fcons (errstring, data)));
- }
+ char *str = strerror (errorno);
+ Lisp_Object errstring
+ = code_convert_string_norecord (build_unibyte_string (str),
+ Vlocale_coding_system, 0);
+ Lisp_Object errdata = Fcons (errstring, data);
+
+ if (errorno == EEXIST)
+ xsignal (Qfile_already_exists, errdata);
+ else
+ xsignal (Qfile_error, Fcons (build_string (string), errdata));
}
/* Signal a file-access failure that set errno. STRING describes the
--
2.1.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* bug#19642: Don't downcase system diagnostics' first letters
2015-01-20 22:24 bug#19642: Don't downcase system diagnostics' first letters Paul Eggert
@ 2015-01-21 15:09 ` Stefan Monnier
2015-01-22 4:33 ` Paul Eggert
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2015-01-21 15:09 UTC (permalink / raw)
To: Paul Eggert; +Cc: 19642
I think we should bite this bullet, indeed. Thanks,
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#19642: Don't downcase system diagnostics' first letters
2015-01-21 15:09 ` Stefan Monnier
@ 2015-01-22 4:33 ` Paul Eggert
0 siblings, 0 replies; 3+ messages in thread
From: Paul Eggert @ 2015-01-22 4:33 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Mario Lang, 19642-done
Stefan Monnier wrote:
> I think we should bite this bullet, indeed. Thanks,
Thanks, I installed it as commit 8dd58a2d1fedaa16573bc67e986dc2014620c681 and am
marking this bug as done.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-22 4:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-20 22:24 bug#19642: Don't downcase system diagnostics' first letters Paul Eggert
2015-01-21 15:09 ` Stefan Monnier
2015-01-22 4:33 ` Paul Eggert
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).