]> code.delx.au - gnu-emacs/commitdiff
Don't downcase system diagnostics' first letters
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 22 Jan 2015 04:21:45 +0000 (20:21 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 22 Jan 2015 04:29:42 +0000 (20:29 -0800)
* 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.
Fixes: bug#19642
14 files changed:
etc/ChangeLog
etc/NEWS
lisp/ChangeLog
lisp/emacs-lisp/bytecomp.el
lisp/erc/ChangeLog
lisp/erc/erc-dcc.el
lisp/ffap.el
lisp/files.el
lisp/net/ange-ftp.el
lisp/progmodes/etags.el
lisp/url/ChangeLog
lisp/url/url-dav.el
src/ChangeLog
src/fileio.c

index 7b64dfb9153d82a9975924329f230d9e8d97086c..47f61f4d7fd39c23fc628cc04e7fe6f057a08b10 100644 (file)
@@ -1,3 +1,8 @@
+2015-01-22  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.
index 120d8b920c6cac4c6bda7d11d3c9e9349f334b9b..db47033fb3538ae84228d69bb62d16b3ef4d623f 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -538,6 +538,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
 
index c000d6bb9a61cb5d27d100588a275812f0675b30..5cceb19ff1a92c5c795fffc6dfb23c3f5dbdd189 100644 (file)
@@ -1,3 +1,16 @@
+2015-01-22  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-22  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * help.el (help-make-usage): Don't turn a "_" arg into an empty-string
index 8440570d755b297cd55a6e4bc9146e2a6b490569..2bd8d07851b35d2aca1ad9bee26d9b5af443aa15 100644 (file)
@@ -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
index 1b54fb6a48d3585ddb59218d0f17ee7bc9e209e9..28ac7d38b96a8c1ea878125442094a3a8c5ed47c 100644 (file)
@@ -1,3 +1,8 @@
+2015-01-22  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):
index 9d52c3b7c09800897c10936f5038ace82a30c4b6..182f1e0592148ceae3fadcd87f8f0f6bbcba84b7 100644 (file)
@@ -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:
-
index 1b8ea60e03be01def6b144c40635c143f22ed2b4..350a6bdac2021843d40a1fecd0fc66fc6a173a34 100644 (file)
@@ -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}.
index e9632edacef4c08f4e59ce4b3bb03eaa43de0db4..ed1943dfc28a39d027937cf642b9d373accfec95 100644 (file)
@@ -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)
index 17db6e76ec9371f2f8aee305e8f64716763369c0..52153ad8322765d8a6a582b0609f966b40f2e637 100644 (file)
@@ -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)
index 626855ecdd42cbf8749e5becc243fde23e45048e..b470352f8dc808d44ed809f4c759f224bb9d8f1e 100644 (file)
@@ -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)))
index 1f5ece021138c19c0b69190f1563ca68378fb057..920d692d319980902110dc745f1c2c5eac072c0f 100644 (file)
@@ -1,3 +1,9 @@
+2015-01-22  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
index 65747e93000e448577418766068b49ad53e5c470..61ca0885ec51eda75ed1f9687478f7e04717a09a 100644 (file)
@@ -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)
index 4c5b2a1397adc5adf9d55e9b78c74fc4d8d9ce60..8f23dd3833eb3a163060fa132fb1eddfd85225e4 100644 (file)
@@ -1,5 +1,9 @@
 2015-01-22  Paul Eggert  <eggert@cs.ucla.edu>
 
+       Don't downcase system diagnostics' first letters
+       * fileio.c (report_file_errno): Don't downcase, and simplify.
+       Fixes: bug#19642
+
        Isolate NIL_IS_ZERO-assuming code better
        Suggested by Stefan Monnier in:
        http://lists.gnu.org/archive/html/emacs-devel/2015-01/msg00588.html
index ff6720d4ae276eeda8aa3dc131aaaab566fc3b93..d0fd08a742e4dc10a36b4c1fc2b3101c71a481ff 100644 (file)
@@ -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