emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* 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/)]
@ 2019-08-11 14:49 Héctor Enríquez Ramón
  2019-08-12 10:36 ` Carsten Dominik
  2019-08-12 11:55 ` Carsten Dominik
  0 siblings, 2 replies; 3+ messages in thread
From: Héctor Enríquez Ramón @ 2019-08-11 14:49 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1596 bytes --]

--text follows this line--

Hi.


* Issue:

1. Use max length format %<number>.<max>, 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/)

[-- Attachment #2: Type: text/html, Size: 2193 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* 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/)]
  2019-08-11 14:49 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/)] Héctor Enríquez Ramón
@ 2019-08-12 10:36 ` Carsten Dominik
  2019-08-12 11:55 ` Carsten Dominik
  1 sibling, 0 replies; 3+ messages in thread
From: Carsten Dominik @ 2019-08-12 10:36 UTC (permalink / raw)
  To: Héctor Enríquez Ramón; +Cc: org-mode list


[-- Attachment #1.1: Type: text/plain, Size: 2040 bytes --]

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éctor Enríquez Ramón <hector.e.r@gmail.com>
wrote:

> --text follows this line--
>
> Hi.
>
>
> * Issue:
>
> 1. Use max length format %<number>.<max>, 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/)
>

[-- Attachment #1.2: Type: text/html, Size: 2865 bytes --]

[-- Attachment #2: patch --]
[-- Type: application/octet-stream, Size: 688 bytes --]

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index f1a99bc0d..dbe5042b6 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -6739,8 +6739,9 @@ and stored in the variable `org-prefix-format-compiled'."
 	      (floor (abs (string-to-number (match-string 2 s)))))
 	(setq org-prefix-category-max-length
 	      (let ((x (match-string 2 s)))
-		(when (string-match-p "\\.[0-9]+" x)
-		  (string-to-number (substring (match-string 0 x) 1))))))
+		(save-match-data
+		  (and (string-match "\\.[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)))))
 	(if opt

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* 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/)]
  2019-08-11 14:49 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/)] Héctor Enríquez Ramón
  2019-08-12 10:36 ` Carsten Dominik
@ 2019-08-12 11:55 ` Carsten Dominik
  1 sibling, 0 replies; 3+ messages in thread
From: Carsten Dominik @ 2019-08-12 11:55 UTC (permalink / raw)
  To: Héctor Enríquez Ramón; +Cc: org-mode list

[-- Attachment #1: Type: text/plain, Size: 1873 bytes --]

Fixed, thank you.

Carsten

On Sun, Aug 11, 2019 at 4:50 PM Héctor Enríquez Ramón <hector.e.r@gmail.com>
wrote:

> --text follows this line--
>
> Hi.
>
>
> * Issue:
>
> 1. Use max length format %<number>.<max>, 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/)
>

[-- Attachment #2: Type: text/html, Size: 2613 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-08-12 11:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-11 14:49 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/)] Héctor Enríquez Ramón
2019-08-12 10:36 ` Carsten Dominik
2019-08-12 11:55 ` Carsten Dominik

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).