]> git.eshelyaron.com Git - emacs.git/commitdiff
Add new SI prefixes R, Q in other places
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 6 Jan 2023 18:48:29 +0000 (10:48 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 6 Jan 2023 18:49:02 +0000 (10:49 -0800)
* lisp/dired-x.el (dired-x--string-to-number, dired-mark-sexp):
* lisp/dired.el (dired-re-inode-size):
* lisp/files.el (directory-listing-before-filename-regexp):
* src/xdisp.c (power_letter):
* src/xdisp.c: Include stdint.h.
Check that the prefixes suffice for ptrdiff_t.

lisp/dired-x.el
lisp/dired.el
lisp/files.el
src/xdisp.c

index 560eefae024cbae7f3edee861a8f0a7255f447bd..5780f1353adc6f332d9c489b828355fda0e5a6d5 100644 (file)
@@ -816,7 +816,7 @@ otherwise."
 (defun dired-x--string-to-number (str)
   "Like `string-to-number' but recognize a trailing unit prefix.
 For example, 2K is expanded to 2048.0.  The caller should make
-sure that a trailing letter in STR is one of BKkMGTPEZY."
+sure that a trailing letter in STR is one of BKkMGTPEZYRQ."
   (let* ((val (string-to-number str))
          (u (unless (zerop val)
               (aref str (1- (length str))))))
@@ -831,7 +831,7 @@ sure that a trailing letter in STR is one of BKkMGTPEZY."
       (when (and u (> u ?9))
         (when (= u ?k)
           (setq u ?K))
-        (let ((units '(?B ?K ?M ?G ?T ?P ?E ?Z ?Y)))
+        (let ((units '(?B ?K ?M ?G ?T ?P ?E ?Z ?Y ?R ?Q)))
           (while (and units (/= (pop units) u))
             (setq val (* 1024.0 val)))))
       val)))
@@ -904,7 +904,7 @@ only in the active region if `dired-mark-region' is non-nil."
              ;; GNU ls -hs suffixes the block count with a unit and
              ;; prints it as a float, FreeBSD does neither.
              (dired-re-inode-size "\\=\\s *\\([0-9]+\\s +\\)?\
-\\(?:\\([0-9]+\\(?:\\.[0-9]*\\)?[BkKMGTPEZY]?\\)? ?\\)"))
+\\(?:\\([0-9]+\\(?:\\.[0-9]*\\)?[BkKMGTPEZYRQ]?\\)? ?\\)"))
          (beginning-of-line)
          (forward-char 2)
          (search-forward-regexp dired-re-inode-size nil t)
index 42d15f27a543f8a573f5652d9d61aa51fdeb255b..1f7dca802fd1f478c4780316838b272c7c8dd2e5 100644 (file)
@@ -530,7 +530,7 @@ The directory name must be absolute, but need not be fully expanded.")
 
 (put 'dired-actual-switches 'safe-local-variable 'dired-safe-switches-p)
 
-(defvar dired-re-inode-size "[0-9 \t]*[.,0-9]*[BkKMGTPEZY]?[ \t]*"
+(defvar dired-re-inode-size "[0-9 \t]*[.,0-9]*[BkKMGTPEZYRQ]?[ \t]*"
   "Regexp for optional initial inode and file size as made by `ls -i -s'.")
 
 ;; These regexps must be tested at beginning-of-line, but are also
index 446c761064878ed01a6fe26dd44e862c46f47554..e1b7a990b150d6b0d554916f9cad1dc4b8213494 100644 (file)
@@ -7645,7 +7645,7 @@ If DIR's free space cannot be obtained, this function returns nil."
         ;; This avoids recognizing `1 may 1997' as a date in the line:
         ;; -r--r--r--   1 may      1997        1168 Oct 19 16:49 README
 
-        ;; The "[BkKMGTPEZY]?" below supports "ls -alh" output.
+        ;; The "[BkKMGTPEZYRQ]?" below supports "ls -alh" output.
 
         ;; For non-iso date formats, we add the ".*" in order to find
         ;; the last possible match.  This avoids recognizing
@@ -7657,8 +7657,8 @@ If DIR's free space cannot be obtained, this function returns nil."
          ;; parentheses:
          ;; -rw-r--r-- (modified) 2005-10-22 21:25 files.el
          ;; This is not supported yet.
-    (purecopy (concat "\\([0-9][BkKMGTPEZY]? " iso
-                     "\\|.*[0-9][BkKMGTPEZY]? "
+    (purecopy (concat "\\([0-9][BkKMGTPEZYRQ]? " iso
+                     "\\|.*[0-9][BkKMGTPEZYRQ]? "
                      "\\(" western "\\|" western-comma
                       "\\|" DD-MMM-YYYY "\\|" east-asian "\\)"
                      "\\) +")))
index 2e962b011a6dea66706e18badeb08b0aa9002dcc..72d3bfa63986e418b61ee2c61e27995714029e88 100644 (file)
@@ -27621,7 +27621,9 @@ static const char power_letter[] =
     'P', /* peta */
     'E', /* exa */
     'Z', /* zetta */
-    'Y'         /* yotta */
+    'Y', /* yotta */
+    'R', /* ronna */
+    'Q'  /* quetta */
   };
 
 static void