From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Bug: Org agenda category max length raise error [9.2.5 (9.2.5-1-gff6508-elpaplus @ /home/edo/.emacs.d/elpa/org-plus-contrib-20190805/)] Date: Mon, 12 Aug 2019 12:36:47 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="000000000000d87c32058fe91a71" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:54353) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hx7hK-0007Na-Sm for emacs-orgmode@gnu.org; Mon, 12 Aug 2019 06:37:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hx7hJ-0007KE-NO for emacs-orgmode@gnu.org; Mon, 12 Aug 2019 06:37:06 -0400 Received: from mail-ed1-f45.google.com ([209.85.208.45]:41331) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hx7hJ-0007Ji-Dz for emacs-orgmode@gnu.org; Mon, 12 Aug 2019 06:37:05 -0400 Received: by mail-ed1-f45.google.com with SMTP id w5so406000edl.8 for ; Mon, 12 Aug 2019 03:37:05 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: =?UTF-8?B?SMOpY3RvciBFbnLDrXF1ZXogUmFtw7Nu?= Cc: org-mode list --000000000000d87c32058fe91a71 Content-Type: multipart/alternative; boundary="000000000000d87c2c058fe91a6f" --000000000000d87c2c058fe91a6f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Hector, you fix does not work, because it changes the match data, which is still needed further down. Could you please try the attached patch and report back? Thank you Carsten On Sun, Aug 11, 2019 at 4:50 PM H=C3=A9ctor Enr=C3=ADquez Ram=C3=B3n wrote: > --text follows this line-- > > Hi. > > > * Issue: > > 1. Use max length format %., example > > (setq org-agenda-prefix-format > '((agenda . " %i %-4.4 c%?-12t% s") ;; (agenda . " %i %-12:c%?-12t= % > s") > (timeline . " % s") > (todo . " %i %-4.4 c%?-12t% s") ;; (todo . " %i %-12:c") > (tags . " %i %-4.4 c") ;; (tags . " %i %-12:c") > (search . " %i %-4.4 c")) ;; (search . " %i %-12:c")) > > 2. Open an org file. > > 3. Typing C-c a a (for example) raise: > > org-compile-prefix-format: Args out of range: "-4.4", 4, 11 > > > * How to fix it: > > org-agenda.el: (see comments ;; + line added, ;; - line removed) > > (when (eq var 'category) > (setq org-prefix-category-length > (floor (abs (string-to-number (match-string 2 s))))) > (setq org-prefix-category-max-length > (let ((x (match-string 2 s))) > (save-match-data > ;; + > (when (string-match "\\.[0-9]+" x) > (string-to-number (substring (match-string 0 x) > 1))))))) ;; + > ;; (when (string-match-p "\\.[0-9]+" x) > ;; - > ;; (string-to-number (substring (match-string 0 x) > 1)))))) ;; - > (if (eq var 'eval) > (setq varform `(format ,f (org-eval ,(read (match-string 4 > s))))) > > > > Best regards. Hector > > Emacs : GNU Emacs 26.2 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw > scroll bars) > of 2019-04-13 > Package: Org mode version 9.2.5 (9.2.5-1-gff6508-elpaplus @ > /home/edo/.emacs.d/elpa/org-plus-contrib-20190805/) > --000000000000d87c2c058fe91a6f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Hector,

you fix does not work, becau= se it changes the match data, which is still needed further down.=C2=A0 Cou= ld you please try the attached patch and report back?

<= div>Thank you

Carsten


On Sun, Aug 11, 2019 at 4:50 PM H=C3=A9ctor Enr=C3=ADquez Ram=C3=B3n= <hector.e.r@g= mail.com> wrote:
--text follows this line--

Hi.


*= Issue:

1. Use max length format %<number>.<max>, exampl= e

(setq org-agenda-prefix-format
=C2=A0 = =C2=A0 =C2=A0 '((agenda . " %i %-4.4 c%?-12t% s") =C2=A0;; (a= genda . " %i %-12:c%?-12t% s")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (ti= meline . " =C2=A0% s")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (todo . &qu= ot; %i %-4.4 c%?-12t% s") =C2=A0 =C2=A0;; (todo . " %i %-12:c&quo= t;)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (tags . " %i %-4.4 c") =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; (tags . " %i %-12:c")
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 (search . " %i %-4.4 c")) =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0;; (search . " %i %-12:c"))

2. Open an org file.

3. Typing C-c a a (for example) raise:

= =C2=A0 =C2=A0org-compile-prefix-format: Args out of range: "-4.4"= , 4, 11


* How to fix it:

org-agenda.el: (see comments ;; = + line added, ;; - line removed)

=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 (when (eq var 'category)
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 (setq org-prefix-category-length
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (floor (abs (string-to-num= ber (match-string 2 s)))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (se= tq org-prefix-category-max-length
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 (let ((x (match-string 2 s)))
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (save-match-data =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0;; +
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 (when (string-match "\\.[0-9]+" x)
=C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 (string-to-number (substring (match-string 0 x) 1))))))) =C2=A0;; +
= ;; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (w= hen (string-match-p "\\.[0-9]+" x) =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; -
;; =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (string-to-n= umber (substring (match-string 0 x) 1)))))) =C2=A0;; -
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 (if (eq var 'eval)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 (setq varform `(format ,f (org-eval ,(read (match-string = 4 s)))))



Best regards. Hector

Emacs =C2=A0: GN= U Emacs 26.2 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw scroll bars)
= =C2=A0of 2019-04-13
Package: Org mode version 9.2.5 (9.2.5-1-gff6508-elp= aplus @ /home/edo/.emacs.d/elpa/org-plus-contrib-20190805/)
--000000000000d87c2c058fe91a6f-- --000000000000d87c32058fe91a71 Content-Type: application/octet-stream; name=patch Content-Disposition: attachment; filename=patch Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_jz89hk650 ZGlmZiAtLWdpdCBhL2xpc3Avb3JnLWFnZW5kYS5lbCBiL2xpc3Avb3JnLWFnZW5kYS5lbAppbmRl eCBmMWE5OWJjMGQuLmRiZTUwNDJiNiAxMDA2NDQKLS0tIGEvbGlzcC9vcmctYWdlbmRhLmVsCisr KyBiL2xpc3Avb3JnLWFnZW5kYS5lbApAQCAtNjczOSw4ICs2NzM5LDkgQEAgYW5kIHN0b3JlZCBp biB0aGUgdmFyaWFibGUgYG9yZy1wcmVmaXgtZm9ybWF0LWNvbXBpbGVkJy4iCiAJICAgICAgKGZs b29yIChhYnMgKHN0cmluZy10by1udW1iZXIgKG1hdGNoLXN0cmluZyAyIHMpKSkpKQogCShzZXRx IG9yZy1wcmVmaXgtY2F0ZWdvcnktbWF4LWxlbmd0aAogCSAgICAgIChsZXQgKCh4IChtYXRjaC1z dHJpbmcgMiBzKSkpCi0JCSh3aGVuIChzdHJpbmctbWF0Y2gtcCAiXFwuWzAtOV0rIiB4KQotCQkg IChzdHJpbmctdG8tbnVtYmVyIChzdWJzdHJpbmcgKG1hdGNoLXN0cmluZyAwIHgpIDEpKSkpKSkK KwkJKHNhdmUtbWF0Y2gtZGF0YQorCQkgIChhbmQgKHN0cmluZy1tYXRjaCAiXFwuWzAtOV0rIiB4 KQorCQkgICAgICAgKHN0cmluZy10by1udW1iZXIgKHN1YnN0cmluZyAobWF0Y2gtc3RyaW5nIDAg eCkgMSkpKSkpKSkKICAgICAgIChpZiAoZXEgdmFyICdldmFsKQogCSAgKHNldHEgdmFyZm9ybSBg KGZvcm1hdCAsZiAob3JnLWV2YWwgLChyZWFkIChtYXRjaC1zdHJpbmcgNCBzKSkpKSkKIAkoaWYg b3B0Cg== --000000000000d87c32058fe91a71--