From debbugs-submit-bounces@debbugs.gnu.org Wed May 15 16:10:19 2019 Received: (at submit) by debbugs.gnu.org; 15 May 2019 20:10:19 +0000 Received: from localhost ([127.0.0.1]:53443 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hR0EF-0000EK-18 for submit@debbugs.gnu.org; Wed, 15 May 2019 16:10:19 -0400 Received: from eggs.gnu.org ([209.51.188.92]:57798) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hR0EB-0000E3-Pj for submit@debbugs.gnu.org; Wed, 15 May 2019 16:10:16 -0400 Received: from lists.gnu.org ([209.51.188.17]:43456) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hR0E6-0002fz-Kn for submit@debbugs.gnu.org; Wed, 15 May 2019 16:10:10 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43946) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hR0E5-0004JX-85 for bug-gnu-emacs@gnu.org; Wed, 15 May 2019 16:10:10 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hR0E4-0002Zo-4b for bug-gnu-emacs@gnu.org; Wed, 15 May 2019 16:10:09 -0400 Received: from mail1427c50.megamailservers.eu ([91.136.14.27]:47956 helo=mail118c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hR0E3-0002WM-JL for bug-gnu-emacs@gnu.org; Wed, 15 May 2019 16:10:08 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1557950572; bh=fO7I8TCf8Sq7cVhyWTyazgF5n9bmJOWFCNqIMfQ6R48=; h=From:Subject:Date:To:From; b=sy5NGn55sIP9/ig7psk0el5Gs89//gEtnJBjIeflWJ5z8c89Bm81WmwfheaeB0GU8 aIUXXD9vLzC7R7Ks30W8wXEbFeFPow/tTKAkfYEd8GZXlX5rLwO0RjQ/scX0QroDbZ Mv2almq+l9KhTHCY9AFVmjDl6h/nA0AFNyW6l1xQ= Feedback-ID: mattiase@acm.or Received: from [192.168.1.65] (c-e636e253.032-75-73746f71.bbcust.telenor.se [83.226.54.230]) (authenticated bits=0) by mail118c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id x4FK2ofP023761 for ; Wed, 15 May 2019 20:02:52 +0000 From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Content-Type: multipart/mixed; boundary="Apple-Mail=_2BFCA44F-6612-4B8A-8A1E-098E52547D0D" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.8\)) Subject: [PATCH] file-size-human-readable: fix glitches and add optional space Message-Id: <28D42987-D855-4213-9111-DB01E0753D9A@acm.org> Date: Wed, 15 May 2019 22:02:50 +0200 To: bug-gnu-emacs@gnu.org X-Mailer: Apple Mail (2.3445.104.8) X-CTCH-RefID: str=0001.0A0B0205.5CDC706C.002A, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=PfPReBpd c=1 sm=1 tr=0 a=M+GU/qJco4WXjv8D6jB2IA==:117 a=M+GU/qJco4WXjv8D6jB2IA==:17 a=wpN-pL5C-qlI0s3A4lgA:9 a=Zx97rEhAQJ8ZJL_i:21 a=yPZoQU8bwY9aWpWD:21 a=CjuIK1q_8ugA:10 a=FL5RwxRrSzOq-IwuSK4A:9 a=B2y7HmGcmWMA:10 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 91.136.14.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --Apple-Mail=_2BFCA44F-6612-4B8A-8A1E-098E52547D0D Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii The `file-size-human-readable' function is very useful but could do with = some better formatting: normally, a space goes between the number and = unit; you don't write '3kg' or '25m/s' but '3 kg' and '25 m/s' (sloppy = British newspapers notwithstanding). We could add an optional argument = so that the caller can use the spacing of preference; the default should = probably be no space, for compatibility. For some reason, only the `iec' mode adds an actual unit (B) to the = result; the default and `si' modes just append a scale prefix. Of course = a user can append the unit of choice, as in: (concat (file-size-human-readable size 'si) "B") which permits the function to be used for other units than bytes, such = as "bit/s" (although the name makes it clear that it is intended for = file sizes only). However, spacing complicates things, since we want (file-size-human-readable 14 'si " ") to return "14", not "14 ", but the latter is what we need when appending = the unit. I'm not sure how to fix this. We could add another optional argument, = UNIT say, which is the string to use as unit, defaulting to "B" in `iec' = mode and the empty string otherwise. The attached patch does not address = this. There is also a small glitch to be fixed: (file-size-human-readable 3 'iec) =3D> "3iB" which of course should be "3B". --Apple-Mail=_2BFCA44F-6612-4B8A-8A1E-098E52547D0D Content-Disposition: attachment; filename=0001-Optional-space-in-file-size-human-readable.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Optional-space-in-file-size-human-readable.patch" Content-Transfer-Encoding: quoted-printable =46rom=209b4cce48e39ecf6261c2a2104425c0f276935a13=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Mon,=2013=20May=202019=2017:05:24=20+0200=0A= Subject:=20[PATCH]=20Optional=20space=20in=20`file-size-human-readable'=0A= =0ATo=20improve=20readability=20of=20strings=20produced=20by=0A= `file-size-human-readable',=20add=20an=20optional=20argument=20to=20= provide=20a=0Astring=20(typically=20a=20space=20or=20non-breaking=20= space)=20to=20put=20between=20the=0Anumber=20and=20unit.=20=20For=20= compatibility,=20the=20default=20is=20an=20empty=20string.=0A=0AAlso=20= fix=20a=20glitch=20with=20small=20numbers=20in=20`iec'=20mode=20which=20= caused=20a=0Astray=20"i"=20in=20the=20result.=0A=0A*=20lisp/files.el=20= (file-size-human-readable):=0AAdd=20optional=20SPACE=20argument=20and=20= handle=20small=20numbers=20correctly.=0A= (files--ask-user-about-large-file,=20warn-maybe-out-of-memory):=0AUse=20= the=20new=20argument.=0A*=20lisp/url/url-http.el=20= (url-http-simple-after-change-function)=0A= (url-http-content-length-after-change-function):=0AUse=20the=20new=20= argument.=0A*=20etc/NEWS=20(Lisp=20Changes):=20Mention=20the=20change.=0A= ---=0A=20etc/NEWS=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20|=20=20= 6=20+++++=0A=20lisp/files.el=20=20=20=20=20=20=20=20=20=20=20=20|=2047=20= +++++++++++++++++++++++++---------------=0A=20lisp/url/url-http.el=20=20=20= =20=20|=2011=20+++++-----=0A=20test/lisp/files-tests.el=20|=2020=20= +++++++++++++++++=0A=204=20files=20changed,=2061=20insertions(+),=2023=20= deletions(-)=0A=0Adiff=20--git=20a/etc/NEWS=20b/etc/NEWS=0Aindex=20= 699a04b524..66c1d7883d=20100644=0A---=20a/etc/NEWS=0A+++=20b/etc/NEWS=0A= @@=20-1994,6=20+1994,12=20@@=20case.=0A=20It=20is=20a=20convenient=20and=20= readable=20way=20to=20specify=20a=20regexp=20that=20should=0A=20not=20= match=20anything,=20and=20is=20as=20fast=20as=20any=20such=20regexp=20= can=20be.=0A=20=0A++++=0A+**=20The=20function=20= 'file-size-human-readable'=20accepts=20another=20optional=20argument.=0A= +The=20new=20third=20argument=20is=20a=20string=20put=20between=20the=20= number=20and=20unit;=0A+if=20nil=20or=20omitted,=20the=20empty=20string=20= is=20used.=20=20It=20is=20recommended=20to=20use=0A+a=20single=20space=20= or=20non-breaking=20space=20for=20readability.=0A+=0A=20=0C=0A=20*=20= Changes=20in=20Emacs=2027.1=20on=20Non-Free=20Operating=20Systems=0A=20=0A= diff=20--git=20a/lisp/files.el=20b/lisp/files.el=0Aindex=20= 8fa7f16de0..7a1bb9fcae=20100644=0A---=20a/lisp/files.el=0A+++=20= b/lisp/files.el=0A@@=20-1358,7=20+1358,7=20@@=20it=20means=20chase=20no=20= more=20than=20that=20many=20links=20and=20then=20stop."=0A=20=0A=20;;=20= A=20handy=20function=20to=20display=20file=20sizes=20in=20human-readable=20= form.=0A=20;;=20See=20http://en.wikipedia.org/wiki/Kibibyte=20for=20the=20= reference.=0A-(defun=20file-size-human-readable=20(file-size=20&optional=20= flavor)=0A+(defun=20file-size-human-readable=20(file-size=20&optional=20= flavor=20space)=0A=20=20=20"Produce=20a=20string=20showing=20FILE-SIZE=20= in=20human-readable=20form.=0A=20=0A=20Optional=20second=20argument=20= FLAVOR=20controls=20the=20units=20and=20the=20display=20format:=0A@@=20= -1368,24=20+1368,34=20@@=20Optional=20second=20argument=20FLAVOR=20= controls=20the=20units=20and=20the=20display=20format:=0A=20=20If=20= FLAVOR=20is=20`si',=20each=20kilobyte=20is=201000=20bytes=20and=20the=20= produced=20suffixes=0A=20=20=20=20=20are=20\"k\",=20\"M\",=20\"G\",=20= \"T\",=20etc.=0A=20=20If=20FLAVOR=20is=20`iec',=20each=20kilobyte=20is=20= 1024=20bytes=20and=20the=20produced=20suffixes=0A-=20=20=20=20are=20= \"KiB\",=20\"MiB\",=20\"GiB\",=20\"TiB\",=20etc."=0A+=20=20=20=20are=20= \"KiB\",=20\"MiB\",=20\"GiB\",=20\"TiB\",=20etc.=0A+=0A+Optional=20third=20= argument=20SPACE=20is=20a=20string=20put=20between=20the=20number=20and=20= unit.=0A+If=20nil=20or=20omitted,=20the=20empty=20string=20is=20used.=0A= +Recommended=20value=20is=20a=20single=20space=20or=20non-breaking=20= space,=20unless=20other=0A+constraints=20prohibit=20a=20space=20in=20= that=20position."=0A=20=20=20(let=20((power=20(if=20(or=20(null=20= flavor)=20(eq=20flavor=20'iec))=0A=20=09=09=20=20=201024.0=0A=20=09=09=20= 1000.0))=0A-=09(post-fixes=0A-=09=20;;=20none,=20kilo,=20mega,=20giga,=20= tera,=20peta,=20exa,=20zetta,=20yotta=0A-=09=20(list=20""=20"k"=20"M"=20= "G"=20"T"=20"P"=20"E"=20"Z"=20"Y")))=0A-=20=20=20=20(while=20(and=20(>=3D=20= file-size=20power)=20(cdr=20post-fixes))=0A+=09(prefixes=20'(""=20"k"=20= "M"=20"G"=20"T"=20"P"=20"E"=20"Z"=20"Y")))=0A+=20=20=20=20(while=20(and=20= (>=3D=20file-size=20power)=20(cdr=20prefixes))=0A=20=20=20=20=20=20=20= (setq=20file-size=20(/=20file-size=20power)=0A-=09=20=20=20=20post-fixes=20= (cdr=20post-fixes)))=0A-=20=20=20=20(format=20(if=20(>=20(mod=20= file-size=201.0)=200.05)=0A-=09=09"%.1f%s%s"=0A-=09=20=20=20=20=20=20= "%.0f%s%s")=0A-=09=20=20=20=20file-size=0A-=09=20=20=20=20(if=20(and=20= (eq=20flavor=20'iec)=20(string=3D=20(car=20post-fixes)=20"k"))=0A-=09=09= "K"=0A-=09=20=20=20=20=20=20(car=20post-fixes))=0A-=09=20=20=20=20(if=20= (eq=20flavor=20'iec)=20"iB"=20""))))=0A+=09=20=20=20=20prefixes=20(cdr=20= prefixes)))=0A+=20=20=20=20;;=20It's=20a=20bit=20inconsistent=20that=20= only=20`iec'=20includes=20an=20actual=20unit,=0A+=20=20=20=20;;=20while=20= the=20two=20other=20flavours=20just=20generate=20a=20prefix.=0A+=20=20=20= =20(let*=20((prefix=20(car=20prefixes))=0A+=20=20=20=20=20=20=20=20=20=20= =20(unit=20(if=20(eq=20flavor=20'iec)=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20(concat=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20(if=20(string=3D=20prefix=20"k")=20"K"=20= prefix)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20(if=20(string-empty-p=20prefix)=20""=20"i")=0A+=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20"B")=0A+=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20prefix)))=0A+=20=20=20=20=20=20(format=20= (if=20(>=20(mod=20file-size=201.0)=200.05)=0A+=09=09=20=20"%.1f%s%s"=0A+=09= =20=20=20=20=20=20=20=20"%.0f%s%s")=0A+=09=20=20=20=20=20=20file-size=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20(if=20(string-empty-p=20unit)=20= ""=20(or=20space=20""))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= unit))))=0A=20=0A=20(defcustom=20mounted-file-systems=0A=20=20=20(if=20= (memq=20system-type=20'(windows-nt=20cygwin))=0A@@=20-2054,7=20+2064,7=20= @@=20think=20it=20does,=20because=20\"free\"=20is=20pretty=20hard=20to=20= define=20in=20practice."=0A=20(defun=20files--ask-user-about-large-file=20= (size=20op-type=20filename=20offer-raw)=0A=20=20=20(let=20((prompt=20= (format=20"File=20%s=20is=20large=20(%s),=20really=20%s?"=0A=20=09=09=20=20= =20=20=20=20=20=20(file-name-nondirectory=20filename)=0A-=09=09=20=20=20=20= =20=20=20=20(file-size-human-readable=20size)=20op-type)))=0A+=09=09=20=20= =20=20=20=20=20=20(file-size-human-readable=20size=20'iec=20"=20")=20= op-type)))=0A=20=20=20=20=20(if=20(not=20offer-raw)=0A=20=20=20=20=20=20=20= =20=20(if=20(y-or-n-p=20prompt)=20nil=20'abort)=0A=20=20=20=20=20=20=20= (let*=20((use-dialog=20(and=20(display-popup-menus-p)=0A@@=20-2106,9=20= +2116,10=20@@=20returns=20nil=20or=20exits=20non-locally."=0A=20exceeds=20= the=20%S%%=20of=20currently=20available=20free=20memory=20(%s).=0A=20If=20= that=20fails,=20try=20to=20open=20it=20with=20`find-file-literally'=0A=20= \(but=20note=20that=20some=20characters=20might=20be=20displayed=20= incorrectly)."=0A-=09=20=20=20=20=20(file-size-human-readable=20size)=0A= +=09=20=20=20=20=20(file-size-human-readable=20size=20'iec=20"=20")=0A=20= =09=20=20=20=20=20out-of-memory-warning-percentage=0A-=09=20=20=20=20=20= (file-size-human-readable=20(*=20total-free-memory=201024)))))))))=0A+=09= =20=20=20=20=20(file-size-human-readable=20(*=20total-free-memory=20= 1024)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20'iec=20"=20"))))))))=0A= =20=0A=20(defun=20files--message=20(format=20&rest=20args)=0A=20=20=20= "Like=20`message',=20except=20sometimes=20don't=20print=20to=20= minibuffer.=0Adiff=20--git=20a/lisp/url/url-http.el=20= b/lisp/url/url-http.el=0Aindex=2048e29987a5..d5d44190e1=20100644=0A---=20= a/lisp/url/url-http.el=0A+++=20b/lisp/url/url-http.el=0A@@=20-999,7=20= +999,8=20@@=20should=20be=20shown=20to=20the=20user."=0A=20(defun=20= url-http-simple-after-change-function=20(_st=20_nd=20_length)=0A=20=20=20= ;;=20Function=20used=20when=20we=20do=20NOT=20know=20how=20long=20the=20= document=20is=20going=20to=20be=0A=20=20=20;;=20Just=20_very_=20simple=20= 'downloaded=20%d'=20type=20of=20info.=0A-=20=20(url-lazy-message=20= "Reading=20%s..."=20(file-size-human-readable=20(buffer-size))))=0A+=20=20= (url-lazy-message=20"Reading=20%s..."=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20(file-size-human-readable=20(buffer-size)=20= 'iec=20"=20")))=0A=20=0A=20(defun=20= url-http-content-length-after-change-function=20(_st=20nd=20_length)=0A=20= =20=20"Function=20used=20when=20we=20DO=20know=20how=20long=20the=20= document=20is=20going=20to=20be.=0A@@=20-1012,16=20+1013,16=20@@=20the=20= callback=20to=20be=20triggered."=0A=20=20=20=20=20=20=20=20= (url-percentage=20(-=20nd=20url-http-end-of-headers)=0A=20=09=09=20=20=20= =20=20=20=20url-http-content-length)=0A=20=20=20=20=20=20=20=20= url-http-content-type=0A-=20=20=20=20=20=20=20(file-size-human-readable=20= (-=20nd=20url-http-end-of-headers))=0A-=20=20=20=20=20=20=20= (file-size-human-readable=20url-http-content-length)=0A+=20=20=20=20=20=20= =20(file-size-human-readable=20(-=20nd=20url-http-end-of-headers)=20'iec=20= "=20")=0A+=20=20=20=20=20=20=20(file-size-human-readable=20= url-http-content-length=20'iec=20"=20")=0A=20=20=20=20=20=20=20=20= (url-percentage=20(-=20nd=20url-http-end-of-headers)=0A=20=09=09=20=20=20= =20=20=20=20url-http-content-length))=0A=20=20=20=20=20= (url-display-percentage=0A=20=20=20=20=20=20"Reading...=20%s=20of=20%s=20= (%d%%)"=0A=20=20=20=20=20=20(url-percentage=20(-=20nd=20= url-http-end-of-headers)=0A=20=09=09=20=20=20=20=20= url-http-content-length)=0A-=20=20=20=20=20(file-size-human-readable=20= (-=20nd=20url-http-end-of-headers))=0A-=20=20=20=20=20= (file-size-human-readable=20url-http-content-length)=0A+=20=20=20=20=20= (file-size-human-readable=20(-=20nd=20url-http-end-of-headers)=20'iec=20= "=20")=0A+=20=20=20=20=20(file-size-human-readable=20= url-http-content-length=20'iec=20"=20")=0A=20=20=20=20=20=20= (url-percentage=20(-=20nd=20url-http-end-of-headers)=0A=20=09=09=20=20=20= =20=20url-http-content-length)))=0A=20=0Adiff=20--git=20= a/test/lisp/files-tests.el=20b/test/lisp/files-tests.el=0Aindex=20= fe2e958f1c..b000c3070d=20100644=0A---=20a/test/lisp/files-tests.el=0A+++=20= b/test/lisp/files-tests.el=0A@@=20-1259,5=20+1259,25=20@@=20renaming=20= only,=20rather=20than=20modified=20in-place."=0A=20=20=20=20=20=20=20= (ignore-errors=20(advice-remove=20#'write-region=20advice))=0A=20=20=20=20= =20=20=20(ignore-errors=20(delete-file=20temp-file-name)))))=0A=20=0A= +(ert-deftest=20files-test-file-size-human-readable=20()=0A+=20=20= (should=20(equal=20(file-size-human-readable=2013)=20"13"))=0A+=20=20= (should=20(equal=20(file-size-human-readable=2013=20'si)=20"13"))=0A+=20=20= (should=20(equal=20(file-size-human-readable=2013=20'iec)=20"13B"))=0A+=20= =20(should=20(equal=20(file-size-human-readable=2010000)=20"9.8k"))=0A+=20= =20(should=20(equal=20(file-size-human-readable=2010000=20'si)=20"10k"))=0A= +=20=20(should=20(equal=20(file-size-human-readable=2010000=20'iec)=20= "9.8KiB"))=0A+=20=20(should=20(equal=20(file-size-human-readable=20= 4294967296=20nil)=20"4G"))=0A+=20=20(should=20(equal=20= (file-size-human-readable=204294967296=20'si)=20"4.3G"))=0A+=20=20= (should=20(equal=20(file-size-human-readable=204294967296=20'iec)=20= "4GiB"))=0A+=20=20(should=20(equal=20(file-size-human-readable=2013=20= nil=20"=20")=20"13"))=0A+=20=20(should=20(equal=20= (file-size-human-readable=2013=20'si=20"=20")=20"13"))=0A+=20=20(should=20= (equal=20(file-size-human-readable=2013=20'iec=20"=20")=20"13=20B"))=0A+=20= =20(should=20(equal=20(file-size-human-readable=2010000=20nil=20"=20")=20= "9.8=20k"))=0A+=20=20(should=20(equal=20(file-size-human-readable=20= 10000=20'si=20"=20")=20"10=20k"))=0A+=20=20(should=20(equal=20= (file-size-human-readable=2010000=20'iec=20"=20")=20"9.8=20KiB"))=0A+=20=20= (should=20(equal=20(file-size-human-readable=204294967296=20nil=20"=20")=20= "4=20G"))=0A+=20=20(should=20(equal=20(file-size-human-readable=20= 4294967296=20'si=20"=20")=20"4.3=20G"))=0A+=20=20(should=20(equal=20= (file-size-human-readable=204294967296=20'iec=20"=20")=20"4=20GiB")))=0A= +=0A=20(provide=20'files-tests)=0A=20;;;=20files-tests.el=20ends=20here=0A= --=20=0A2.20.1=20(Apple=20Git-117)=0A=0A= --Apple-Mail=_2BFCA44F-6612-4B8A-8A1E-098E52547D0D-- From debbugs-submit-bounces@debbugs.gnu.org Thu May 16 07:59:42 2019 Received: (at control) by debbugs.gnu.org; 16 May 2019 11:59:42 +0000 Received: from localhost ([127.0.0.1]:54499 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hRF30-0006XH-Kp for submit@debbugs.gnu.org; Thu, 16 May 2019 07:59:42 -0400 Received: from mail-it1-f178.google.com ([209.85.166.178]:52119) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hRF2y-0006X4-3q for control@debbugs.gnu.org; Thu, 16 May 2019 07:59:40 -0400 Received: by mail-it1-f178.google.com with SMTP id m3so1843114itl.1 for ; Thu, 16 May 2019 04:59:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=iIQTvoQALqYcrFunz8Wl8ZJQukT5bCajWGqJAOQg4W0=; b=eAX9TZOBti17CCupFX0qqVmYJWU20RPF7bSKCB1u7BzaFNytRO/H7TpkLbqDrp17eS 5uadIyaSeWoYAkIC4eihC9Q3CdKX+/xPhfNBhZBVeueHBhsyPnDeBCFpoGp7Be+QWU/V nGYAPQXvIJ53YWgsBgo7MKyD5Ma2xPNc0m/kSZkcSmsHe4xeauDlTk4O4mb1IFtL+dTc /Myf9NLKyU6g4FprRLxTAtiOX88LsW2kRM+fT7uGksWQu+K8cU3Oa4Qq2sH6RA4x4+e2 056zBzMyja/wnJ6HZxX0O/M7qw3anYiN1dRkf1Vxrk4h87+E6nspl3BOnotvtFTNOeBK 3jNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=iIQTvoQALqYcrFunz8Wl8ZJQukT5bCajWGqJAOQg4W0=; b=jyxzZpT+VLTY4Dn+/vk0Ym+aA8mnQjblX8tWdTaUuIist0v3gStqcSXmE6TelSKtWG SY+lMBjwDildqJrL8jzCzGSOCJ/nFwLClaazoizP8AJD437T4TAYvXcmtC5GcI11xSNJ kq8Sal1srckinCRbRIHQQnQARN7HPEY3pOco1Ah3wwy7pkq35L44kVdsYUR/WXt+Z6SK zseZe4IOWX/P/g++JmtGLl58TDVdDuT2HDFoP62NabBmK1+5v7RM/Vn67ZrEvbDBVkAt mawVrsZ99sv+dzcJoNGHEgvuOmA41YJn2PDV+ruHWiAjjh/7dQ7gWhT4tewwhF5W3xqL /7zQ== X-Gm-Message-State: APjAAAWKIRHriwn90Xzpt1wdoen49n/DrubQh0mXpfhwRd2F4B3/IcUu ksr7walIKZB7zh1cbCPofGzgTp3q X-Google-Smtp-Source: APXvYqyGgOKtQ2QG6OsF4zNmPVz+6NdTG4xzx9hYzofApqq3tNMSGC/paq3HnmerpHozkqfVCX9F0Q== X-Received: by 2002:a02:b89:: with SMTP id 131mr32958141jad.58.1558007973126; Thu, 16 May 2019 04:59:33 -0700 (PDT) Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.gmail.com with ESMTPSA id s69sm1779070ios.30.2019.05.16.04.59.30 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 16 May 2019 04:59:31 -0700 (PDT) From: Noam Postavsky To: control@debbugs.gnu.org Subject: control message, adjust some bug severities Date: Thu, 16 May 2019 07:59:29 -0400 Message-ID: <87tvduehjy.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) severity 35756 minor severity 35724 minor severity 35689 wishlist quit From debbugs-submit-bounces@debbugs.gnu.org Fri May 17 01:56:48 2019 Received: (at 35756) by debbugs.gnu.org; 17 May 2019 05:56:48 +0000 Received: from localhost ([127.0.0.1]:57015 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hRVrM-00062C-36 for submit@debbugs.gnu.org; Fri, 17 May 2019 01:56:48 -0400 Received: from eggs.gnu.org ([209.51.188.92]:52843) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hRVrJ-00061x-Pr for 35756@debbugs.gnu.org; Fri, 17 May 2019 01:56:46 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:36660) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hRVrE-00007R-Fw; Fri, 17 May 2019 01:56:40 -0400 Received: from [176.228.60.248] (port=2479 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hRVr7-0007Vw-MK; Fri, 17 May 2019 01:56:34 -0400 Date: Fri, 17 May 2019 08:56:26 +0300 Message-Id: <83zhnlbp4l.fsf@gnu.org> From: Eli Zaretskii To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= In-reply-to: <28D42987-D855-4213-9111-DB01E0753D9A@acm.org> (message from Mattias =?utf-8?Q?Engdeg=C3=A5rd?= on Wed, 15 May 2019 22:02:50 +0200) Subject: Re: bug#35756: [PATCH] file-size-human-readable: fix glitches and add optional space References: <28D42987-D855-4213-9111-DB01E0753D9A@acm.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 35756 Cc: 35756@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Mattias EngdegÄrd > Date: Wed, 15 May 2019 22:02:50 +0200 > > The `file-size-human-readable' function is very useful but could do with some better formatting: normally, a space goes between the number and unit; you don't write '3kg' or '25m/s' but '3 kg' and '25 m/s' (sloppy British newspapers notwithstanding). We could add an optional argument so that the caller can use the spacing of preference; the default should probably be no space, for compatibility. I have no opinion regarding the change, but I have a minor comment about the documentation: > +** The function 'file-size-human-readable' accepts another optional argument. > +The new third argument is a string put between the number and unit; > +if nil or omitted, the empty string is used. It is recommended to use > +a single space or non-breaking space for readability. This uses the passive tense too much. The "if nil or omitted, the empty string is used" part could be worded more clearly as "it defaults to the empty string". The "It is recommended" part is better worded as "We recommend". > +Optional third argument SPACE is a string put between the number and unit. > +If nil or omitted, the empty string is used. Same here. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Fri May 17 07:01:28 2019 Received: (at 35756) by debbugs.gnu.org; 17 May 2019 11:01:28 +0000 Received: from localhost ([127.0.0.1]:57465 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hRacC-0004t8-Cb for submit@debbugs.gnu.org; Fri, 17 May 2019 07:01:28 -0400 Received: from mail200c50.megamailservers.eu ([91.136.10.210]:43438 helo=mail193c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hRac9-0004sy-Gl for 35756@debbugs.gnu.org; Fri, 17 May 2019 07:01:26 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1558090883; bh=nIJlWjYyiXi5YP2yAQ2lX2dg/Og0hSht1ytuO/td5ys=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=gz/37APl7xwYf521iVTI1eI44sqTYoR7m14akPag2Z7eWVw9zfqZn+SsU64VBk8VN /Nryr9WO9MtSYnq8Kx9OaXjTfUs3dDJqy+mmXExPxKqz3m2Ve2WuruLdVLIzM6nuWE mJWMhLkJd8YnlCVc69h6npMA2mwc/heWeDq+DxUI= Feedback-ID: mattiase@acm.or Received: from [192.168.1.65] (c-e636e253.032-75-73746f71.bbcust.telenor.se [83.226.54.230]) (authenticated bits=0) by mail193c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id x4HB1JF6010885; Fri, 17 May 2019 11:01:22 +0000 From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Message-Id: <4C9BDFF7-BCE4-421C-84AE-20E243894495@acm.org> Content-Type: multipart/mixed; boundary="Apple-Mail=_FCE30540-E666-4D25-8B49-A3052322703A" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.8\)) Subject: Re: bug#35756: [PATCH] file-size-human-readable: fix glitches and add optional space Date: Fri, 17 May 2019 13:01:19 +0200 In-Reply-To: <83zhnlbp4l.fsf@gnu.org> To: Eli Zaretskii References: <28D42987-D855-4213-9111-DB01E0753D9A@acm.org> <83zhnlbp4l.fsf@gnu.org> X-Mailer: Apple Mail (2.3445.104.8) X-CTCH-RefID: str=0001.0A0B0204.5CDE9483.0009, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=PM8hB8iC c=1 sm=1 tr=0 a=M+GU/qJco4WXjv8D6jB2IA==:117 a=M+GU/qJco4WXjv8D6jB2IA==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=mDV3o1hIAAAA:8 a=4uyE4olDKIBf4wq5keYA:9 a=CjuIK1q_8ugA:10 a=FL5RwxRrSzOq-IwuSK4A:9 a=B2y7HmGcmWMA:10 a=_FVE-zBwftR9WsbkzFJk:22 X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 35756 Cc: 35756@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --Apple-Mail=_FCE30540-E666-4D25-8B49-A3052322703A Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii 17 maj 2019 kl. 07.56 skrev Eli Zaretskii : >=20 > This uses the passive tense too much. The "if nil or omitted, the > empty string is used" part could be worded more clearly as "it > defaults to the empty string". The "It is recommended" part is better > worded as "We recommend". Thank you, fixed. >> +Optional third argument SPACE is a string put between the number and = unit. >> +If nil or omitted, the empty string is used. >=20 > Same here. Fixed. I also added the optional argument UNIT to settle that problem. New = patch attached. --Apple-Mail=_FCE30540-E666-4D25-8B49-A3052322703A Content-Disposition: attachment; filename=0001-Optional-space-and-unit-in-file-size-human-readable-.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Optional-space-and-unit-in-file-size-human-readable-.patch" Content-Transfer-Encoding: quoted-printable =46rom=20403ce6c70dbacf3a99785b730e026fca67ce9a4e=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Mon,=2013=20May=202019=2017:05:24=20+0200=0A= Subject:=20[PATCH]=20Optional=20space=20and=20unit=20in=20= `file-size-human-readable'=0A=20(bug#35756)=0A=0ATo=20improve=20= readability=20of=20strings=20produced=20by=0A`file-size-human-readable',=20= add=20two=20optional=20arguments:=0A=0A-=20SPACE,=20to=20provide=20a=20= string=20(typically=20a=20space=20or=20non-breaking=20space)=0Ato=20put=20= between=20the=20number=20and=20unit.=20=20For=20compatibility,=20the=20= default=20is=0Aan=20empty=20string.=0A=0A-=20UNIT,=20a=20string=20to=20= use=20as=20unit.=20=20For=20compatibility,=20the=20default=20is=0A"B"=20= in=20`iec'=20mode=20and=20the=20empty=20string=20otherwise.=0A=0AAlso=20= fix=20a=20glitch=20with=20small=20numbers=20in=20`iec'=20mode=20which=20= caused=20a=0Astray=20"i"=20in=20the=20result.=0A=0A*=20lisp/files.el=20= (file-size-human-readable):=0AAdd=20optional=20SPACE=20and=20UNIT=20= arguments=20and=20handle=20small=20numbers=20correctly.=0A= (files--ask-user-about-large-file,=20warn-maybe-out-of-memory):=0AUse=20= the=20new=20argument.=0A*=20test/lisp/files-tests.el=20= (files-test-file-size-human-readable):=20New=20test.=0A*=20= lisp/url/url-http.el=20(url-http-simple-after-change-function)=0A= (url-http-content-length-after-change-function):=20Use=20the=20new=20= argument.=0A*=20etc/NEWS=20(Lisp=20Changes):=20Mention=20the=20change.=0A= ---=0A=20etc/NEWS=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20|=20=20= 9=20++++++++=0A=20lisp/files.el=20=20=20=20=20=20=20=20=20=20=20=20|=20= 49=20+++++++++++++++++++++++++---------------=0A=20lisp/url/url-http.el=20= =20=20=20=20|=2011=20+++++----=0A=20test/lisp/files-tests.el=20|=2023=20= +++++++++++++++++++=0A=204=20files=20changed,=2069=20insertions(+),=2023=20= deletions(-)=0A=0Adiff=20--git=20a/etc/NEWS=20b/etc/NEWS=0Aindex=20= 8c059157ba..215d652a64=20100644=0A---=20a/etc/NEWS=0A+++=20b/etc/NEWS=0A= @@=20-2005,6=20+2005,15=20@@=20case.=0A=20It=20is=20a=20convenient=20and=20= readable=20way=20to=20specify=20a=20regexp=20that=20should=0A=20not=20= match=20anything,=20and=20is=20as=20fast=20as=20any=20such=20regexp=20= can=20be.=0A=20=0A++++=0A+**=20The=20function=20= 'file-size-human-readable'=20accepts=20more=20optional=20arguments.=0A= +The=20new=20third=20argument=20is=20a=20string=20put=20between=20the=20= number=20and=20unit;=20it=0A+defaults=20to=20the=20empty=20string.=20=20= The=20new=20fourth=20argument=20is=20a=20string=0A+representing=20the=20= unit=20to=20use;=20it=20defaults=20to=20"B"=20when=20the=20second=0A= +argument=20is=20'iec'=20and=20the=20empty=20string=20otherwise.=20=20We=20= recomment=20a=0A+space=20or=20non-breaking=20space=20as=20third=20= argument,=20and=20"B"=20as=20fourth=0A+argument,=20circumstances=20= allowing.=0A+=0A=20=0C=0A=20*=20Changes=20in=20Emacs=2027.1=20on=20= Non-Free=20Operating=20Systems=0A=20=0Adiff=20--git=20a/lisp/files.el=20= b/lisp/files.el=0Aindex=208fa7f16de0..e84775c6ac=20100644=0A---=20= a/lisp/files.el=0A+++=20b/lisp/files.el=0A@@=20-1358,7=20+1358,7=20@@=20= it=20means=20chase=20no=20more=20than=20that=20many=20links=20and=20then=20= stop."=0A=20=0A=20;;=20A=20handy=20function=20to=20display=20file=20= sizes=20in=20human-readable=20form.=0A=20;;=20See=20= http://en.wikipedia.org/wiki/Kibibyte=20for=20the=20reference.=0A-(defun=20= file-size-human-readable=20(file-size=20&optional=20flavor)=0A+(defun=20= file-size-human-readable=20(file-size=20&optional=20flavor=20space=20= unit)=0A=20=20=20"Produce=20a=20string=20showing=20FILE-SIZE=20in=20= human-readable=20form.=0A=20=0A=20Optional=20second=20argument=20FLAVOR=20= controls=20the=20units=20and=20the=20display=20format:=0A@@=20-1368,24=20= +1368,36=20@@=20Optional=20second=20argument=20FLAVOR=20controls=20the=20= units=20and=20the=20display=20format:=0A=20=20If=20FLAVOR=20is=20`si',=20= each=20kilobyte=20is=201000=20bytes=20and=20the=20produced=20suffixes=0A=20= =20=20=20=20are=20\"k\",=20\"M\",=20\"G\",=20\"T\",=20etc.=0A=20=20If=20= FLAVOR=20is=20`iec',=20each=20kilobyte=20is=201024=20bytes=20and=20the=20= produced=20suffixes=0A-=20=20=20=20are=20\"KiB\",=20\"MiB\",=20\"GiB\",=20= \"TiB\",=20etc."=0A+=20=20=20=20are=20\"KiB\",=20\"MiB\",=20\"GiB\",=20= \"TiB\",=20etc.=0A+=0A+Optional=20third=20argument=20SPACE=20is=20a=20= string=20put=20between=20the=20number=20and=20unit.=0A+It=20defaults=20= to=20the=20empty=20string.=20=20We=20recommend=20a=20single=20space=20or=0A= +non-breaking=20space,=20unless=20other=20constraints=20prohibit=20a=20= space=20in=20that=0A+position.=0A+=0A+Optional=20fourth=20argument=20= UNIT=20is=20the=20unit=20to=20use.=20=20It=20defaults=20to=20\"B\"=0A= +when=20FLAVOR=20is=20`iec'=20and=20the=20empty=20string=20otherwise.=20=20= We=20recommend=20\"B\"=0A+in=20all=20cases,=20since=20that=20is=20the=20= standard=20symbol=20for=20byte."=0A=20=20=20(let=20((power=20(if=20(or=20= (null=20flavor)=20(eq=20flavor=20'iec))=0A=20=09=09=20=20=201024.0=0A=20=09= =09=201000.0))=0A-=09(post-fixes=0A-=09=20;;=20none,=20kilo,=20mega,=20= giga,=20tera,=20peta,=20exa,=20zetta,=20yotta=0A-=09=20(list=20""=20"k"=20= "M"=20"G"=20"T"=20"P"=20"E"=20"Z"=20"Y")))=0A-=20=20=20=20(while=20(and=20= (>=3D=20file-size=20power)=20(cdr=20post-fixes))=0A+=09(prefixes=20'(""=20= "k"=20"M"=20"G"=20"T"=20"P"=20"E"=20"Z"=20"Y")))=0A+=20=20=20=20(while=20= (and=20(>=3D=20file-size=20power)=20(cdr=20prefixes))=0A=20=20=20=20=20=20= =20(setq=20file-size=20(/=20file-size=20power)=0A-=09=20=20=20=20= post-fixes=20(cdr=20post-fixes)))=0A-=20=20=20=20(format=20(if=20(>=20= (mod=20file-size=201.0)=200.05)=0A-=09=09"%.1f%s%s"=0A-=09=20=20=20=20=20= =20"%.0f%s%s")=0A-=09=20=20=20=20file-size=0A-=09=20=20=20=20(if=20(and=20= (eq=20flavor=20'iec)=20(string=3D=20(car=20post-fixes)=20"k"))=0A-=09=09= "K"=0A-=09=20=20=20=20=20=20(car=20post-fixes))=0A-=09=20=20=20=20(if=20= (eq=20flavor=20'iec)=20"iB"=20""))))=0A+=09=20=20=20=20prefixes=20(cdr=20= prefixes)))=0A+=20=20=20=20(let*=20((prefix=20(car=20prefixes))=0A+=20=20= =20=20=20=20=20=20=20=20=20(prefixed-unit=20(if=20(eq=20flavor=20'iec)=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20(concat=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(if=20(string=3D=20= prefix=20"k")=20"K"=20prefix)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(if=20(string-empty-p=20= prefix)=20""=20"i")=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20(or=20unit=20"B"))=0A+=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (concat=20prefix=20unit))))=0A+=20=20=20=20=20=20(format=20(if=20(>=20= (mod=20file-size=201.0)=200.05)=0A+=09=09=20=20"%.1f%s%s"=0A+=09=20=20=20= =20=20=20=20=20"%.0f%s%s")=0A+=09=20=20=20=20=20=20file-size=0A+=20=20=20= =20=20=20=20=20=20=20=20=20=20=20(if=20(string-empty-p=20prefixed-unit)=20= ""=20(or=20space=20""))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= prefixed-unit))))=0A=20=0A=20(defcustom=20mounted-file-systems=0A=20=20=20= (if=20(memq=20system-type=20'(windows-nt=20cygwin))=0A@@=20-2054,7=20= +2066,7=20@@=20think=20it=20does,=20because=20\"free\"=20is=20pretty=20= hard=20to=20define=20in=20practice."=0A=20(defun=20= files--ask-user-about-large-file=20(size=20op-type=20filename=20= offer-raw)=0A=20=20=20(let=20((prompt=20(format=20"File=20%s=20is=20= large=20(%s),=20really=20%s?"=0A=20=09=09=20=20=20=20=20=20=20=20= (file-name-nondirectory=20filename)=0A-=09=09=20=20=20=20=20=20=20=20= (file-size-human-readable=20size)=20op-type)))=0A+=09=09=20=20=20=20=20=20= =20=20(file-size-human-readable=20size=20'iec=20"=20")=20op-type)))=0A=20= =20=20=20=20(if=20(not=20offer-raw)=0A=20=20=20=20=20=20=20=20=20(if=20= (y-or-n-p=20prompt)=20nil=20'abort)=0A=20=20=20=20=20=20=20(let*=20= ((use-dialog=20(and=20(display-popup-menus-p)=0A@@=20-2106,9=20+2118,10=20= @@=20returns=20nil=20or=20exits=20non-locally."=0A=20exceeds=20the=20= %S%%=20of=20currently=20available=20free=20memory=20(%s).=0A=20If=20that=20= fails,=20try=20to=20open=20it=20with=20`find-file-literally'=0A=20\(but=20= note=20that=20some=20characters=20might=20be=20displayed=20= incorrectly)."=0A-=09=20=20=20=20=20(file-size-human-readable=20size)=0A= +=09=20=20=20=20=20(file-size-human-readable=20size=20'iec=20"=20")=0A=20= =09=20=20=20=20=20out-of-memory-warning-percentage=0A-=09=20=20=20=20=20= (file-size-human-readable=20(*=20total-free-memory=201024)))))))))=0A+=09= =20=20=20=20=20(file-size-human-readable=20(*=20total-free-memory=20= 1024)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20'iec=20"=20"))))))))=0A= =20=0A=20(defun=20files--message=20(format=20&rest=20args)=0A=20=20=20= "Like=20`message',=20except=20sometimes=20don't=20print=20to=20= minibuffer.=0Adiff=20--git=20a/lisp/url/url-http.el=20= b/lisp/url/url-http.el=0Aindex=2048e29987a5..d5d44190e1=20100644=0A---=20= a/lisp/url/url-http.el=0A+++=20b/lisp/url/url-http.el=0A@@=20-999,7=20= +999,8=20@@=20should=20be=20shown=20to=20the=20user."=0A=20(defun=20= url-http-simple-after-change-function=20(_st=20_nd=20_length)=0A=20=20=20= ;;=20Function=20used=20when=20we=20do=20NOT=20know=20how=20long=20the=20= document=20is=20going=20to=20be=0A=20=20=20;;=20Just=20_very_=20simple=20= 'downloaded=20%d'=20type=20of=20info.=0A-=20=20(url-lazy-message=20= "Reading=20%s..."=20(file-size-human-readable=20(buffer-size))))=0A+=20=20= (url-lazy-message=20"Reading=20%s..."=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20(file-size-human-readable=20(buffer-size)=20= 'iec=20"=20")))=0A=20=0A=20(defun=20= url-http-content-length-after-change-function=20(_st=20nd=20_length)=0A=20= =20=20"Function=20used=20when=20we=20DO=20know=20how=20long=20the=20= document=20is=20going=20to=20be.=0A@@=20-1012,16=20+1013,16=20@@=20the=20= callback=20to=20be=20triggered."=0A=20=20=20=20=20=20=20=20= (url-percentage=20(-=20nd=20url-http-end-of-headers)=0A=20=09=09=20=20=20= =20=20=20=20url-http-content-length)=0A=20=20=20=20=20=20=20=20= url-http-content-type=0A-=20=20=20=20=20=20=20(file-size-human-readable=20= (-=20nd=20url-http-end-of-headers))=0A-=20=20=20=20=20=20=20= (file-size-human-readable=20url-http-content-length)=0A+=20=20=20=20=20=20= =20(file-size-human-readable=20(-=20nd=20url-http-end-of-headers)=20'iec=20= "=20")=0A+=20=20=20=20=20=20=20(file-size-human-readable=20= url-http-content-length=20'iec=20"=20")=0A=20=20=20=20=20=20=20=20= (url-percentage=20(-=20nd=20url-http-end-of-headers)=0A=20=09=09=20=20=20= =20=20=20=20url-http-content-length))=0A=20=20=20=20=20= (url-display-percentage=0A=20=20=20=20=20=20"Reading...=20%s=20of=20%s=20= (%d%%)"=0A=20=20=20=20=20=20(url-percentage=20(-=20nd=20= url-http-end-of-headers)=0A=20=09=09=20=20=20=20=20= url-http-content-length)=0A-=20=20=20=20=20(file-size-human-readable=20= (-=20nd=20url-http-end-of-headers))=0A-=20=20=20=20=20= (file-size-human-readable=20url-http-content-length)=0A+=20=20=20=20=20= (file-size-human-readable=20(-=20nd=20url-http-end-of-headers)=20'iec=20= "=20")=0A+=20=20=20=20=20(file-size-human-readable=20= url-http-content-length=20'iec=20"=20")=0A=20=20=20=20=20=20= (url-percentage=20(-=20nd=20url-http-end-of-headers)=0A=20=09=09=20=20=20= =20=20url-http-content-length)))=0A=20=0Adiff=20--git=20= a/test/lisp/files-tests.el=20b/test/lisp/files-tests.el=0Aindex=20= fe2e958f1c..ebdfc12d5d=20100644=0A---=20a/test/lisp/files-tests.el=0A+++=20= b/test/lisp/files-tests.el=0A@@=20-1259,5=20+1259,28=20@@=20renaming=20= only,=20rather=20than=20modified=20in-place."=0A=20=20=20=20=20=20=20= (ignore-errors=20(advice-remove=20#'write-region=20advice))=0A=20=20=20=20= =20=20=20(ignore-errors=20(delete-file=20temp-file-name)))))=0A=20=0A= +(ert-deftest=20files-test-file-size-human-readable=20()=0A+=20=20= (should=20(equal=20(file-size-human-readable=2013)=20"13"))=0A+=20=20= (should=20(equal=20(file-size-human-readable=2013=20'si)=20"13"))=0A+=20=20= (should=20(equal=20(file-size-human-readable=2013=20'iec)=20"13B"))=0A+=20= =20(should=20(equal=20(file-size-human-readable=2010000)=20"9.8k"))=0A+=20= =20(should=20(equal=20(file-size-human-readable=2010000=20'si)=20"10k"))=0A= +=20=20(should=20(equal=20(file-size-human-readable=2010000=20'iec)=20= "9.8KiB"))=0A+=20=20(should=20(equal=20(file-size-human-readable=20= 4294967296=20nil)=20"4G"))=0A+=20=20(should=20(equal=20= (file-size-human-readable=204294967296=20'si)=20"4.3G"))=0A+=20=20= (should=20(equal=20(file-size-human-readable=204294967296=20'iec)=20= "4GiB"))=0A+=20=20(should=20(equal=20(file-size-human-readable=2013=20= nil=20"=20")=20"13"))=0A+=20=20(should=20(equal=20= (file-size-human-readable=2013=20'si=20"=20")=20"13"))=0A+=20=20(should=20= (equal=20(file-size-human-readable=2013=20'iec=20"=20")=20"13=20B"))=0A+=20= =20(should=20(equal=20(file-size-human-readable=2010000=20nil=20"=20")=20= "9.8=20k"))=0A+=20=20(should=20(equal=20(file-size-human-readable=20= 10000=20'si=20"=20")=20"10=20k"))=0A+=20=20(should=20(equal=20= (file-size-human-readable=2010000=20'iec=20"=20")=20"9.8=20KiB"))=0A+=20=20= (should=20(equal=20(file-size-human-readable=204294967296=20nil=20"=20")=20= "4=20G"))=0A+=20=20(should=20(equal=20(file-size-human-readable=20= 4294967296=20'si=20"=20")=20"4.3=20G"))=0A+=20=20(should=20(equal=20= (file-size-human-readable=204294967296=20'iec=20"=20")=20"4=20GiB"))=0A+=20= =20(should=20(equal=20(file-size-human-readable=2010000=20nil=20"=20"=20= "B")=20"9.8=20kB"))=0A+=20=20(should=20(equal=20= (file-size-human-readable=2010000=20'si=20"=20"=20"B")=20"10=20kB"))=0A+=20= =20(should=20(equal=20(file-size-human-readable=2010000=20'iec=20"=20"=20= "bit")=20"9.8=20Kibit")))=0A+=0A=20(provide=20'files-tests)=0A=20;;;=20= files-tests.el=20ends=20here=0A--=20=0A2.20.1=20(Apple=20Git-117)=0A=0A= --Apple-Mail=_FCE30540-E666-4D25-8B49-A3052322703A-- From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 23 12:56:22 2019 Received: (at 35756) by debbugs.gnu.org; 23 Jun 2019 16:56:22 +0000 Received: from localhost ([127.0.0.1]:54373 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hf5mw-0003Mo-5i for submit@debbugs.gnu.org; Sun, 23 Jun 2019 12:56:22 -0400 Received: from quimby.gnus.org ([80.91.231.51]:43622) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hf5mu-0003Mf-H7 for 35756@debbugs.gnu.org; Sun, 23 Jun 2019 12:56:20 -0400 Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=stories) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hf5mq-00088j-Kg; Sun, 23 Jun 2019 18:56:18 +0200 From: Lars Ingebrigtsen To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= Subject: Re: bug#35756: [PATCH] file-size-human-readable: fix glitches and add optional space References: <28D42987-D855-4213-9111-DB01E0753D9A@acm.org> <83zhnlbp4l.fsf@gnu.org> <4C9BDFF7-BCE4-421C-84AE-20E243894495@acm.org> Date: Sun, 23 Jun 2019 18:56:16 +0200 In-Reply-To: <4C9BDFF7-BCE4-421C-84AE-20E243894495@acm.org> ("Mattias \=\?utf-8\?Q\?Engdeg\=C3\=A5rd\=22's\?\= message of "Fri, 17 May 2019 13:01:19 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Mattias EngdegÄrd writes: > I also added the optional argument UNIT to settle that problem. New > patch attached. Looks good to me. The only thing is: Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 35756 Cc: Eli Zaretskii , 35756@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Mattias Engdeg=C3=A5rd writes: > I also added the optional argument UNIT to settle that problem. New > patch attached. Looks good to me. The only thing is: In end of data: files.el:7717:1:Warning: the function `string-empty-p' is not known to be defined. That function is from subr-x, and I if I remember correctly, files.el isn't supposed to load that file... --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 23 14:29:57 2019 Received: (at 35756-done) by debbugs.gnu.org; 23 Jun 2019 18:29:57 +0000 Received: from localhost ([127.0.0.1]:54574 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hf7FV-0000ww-8I for submit@debbugs.gnu.org; Sun, 23 Jun 2019 14:29:57 -0400 Received: from mail171c50.megamailservers.eu ([91.136.10.181]:55508 helo=mail92c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hf7FQ-0000wg-BX for 35756-done@debbugs.gnu.org; Sun, 23 Jun 2019 14:29:56 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1561314590; bh=vAU89+u2yS4fCCJgjn2N+x0ycAcg7DcbR2U6kD8iSBg=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=MLisbt+w1NCVJa26Issle1Kz+XLyHJ5759NEpd9yrw95CVUqX7paMOAOQ6OkxPhT+ NTdrHXDo2+4sbMGzj0+CncTO+gO+Gem04YGQas3MovbLndXNnScqq3ojR8H8POJvsI F1FdcsPgooki7y2CB8dCvNlT38hGkVUzxi6t7b3s= Feedback-ID: mattiase@acm.or Received: from [192.168.0.4] ([188.150.171.71]) (authenticated bits=0) by mail92c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id x5NITmYf003046; Sun, 23 Jun 2019 18:29:50 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: bug#35756: [PATCH] file-size-human-readable: fix glitches and add optional space From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= In-Reply-To: Date: Sun, 23 Jun 2019 20:29:47 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <2CF96B6A-10CD-43EA-8879-623F4EDAC963@acm.org> References: <28D42987-D855-4213-9111-DB01E0753D9A@acm.org> <83zhnlbp4l.fsf@gnu.org> <4C9BDFF7-BCE4-421C-84AE-20E243894495@acm.org> To: Lars Ingebrigtsen X-Mailer: Apple Mail (2.3445.104.11) X-CTCH-RefID: str=0001.0A0B0201.5D0FC51E.001C, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=RPid4bq+ c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=OocQHUDgAAAA:8 a=swI6iuvR9PsZMYofggIA:9 a=CjuIK1q_8ugA:10 a=xUZTl98r3Qw_uB5NK3jt:22 X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 35756-done Cc: Eli Zaretskii , 35756-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) 23 juni 2019 kl. 18.56 skrev Lars Ingebrigtsen : >=20 > Looks good to me. The only thing is: >=20 > In end of data: > files.el:7717:1:Warning: the function `string-empty-p' is not known to = be > defined. >=20 > That function is from subr-x, and I if I remember correctly, files.el > isn't supposed to load that file... Thanks, pushed with that function call eliminated in favour of (string=3D = x ""). From unknown Sat Jun 14 19:30:12 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 22 Jul 2019 11:24:09 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator