From 9a8462771f2e140c63e0acdf498bd0c36e70488a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 22 Aug 2018 20:45:47 -0700 Subject: [PATCH] Backport commit a4a3c92e9 from Emacs * lisp/org-agenda.el (org-cmp-ts): Avoid arbitrary limit to most-positive-fixnum or to most-negative-fixnum. * lisp/org-footnote.el (org-footnote-new): Simplify. * lisp/org-element.el (org-element--cache-generate-key): Document fixnum limitation. Prune most-positive-fixnum from Lisp source a4a3c92e9de59bd0251f36326375cce898919edc Paul Eggert Wed Aug 22 20:46:08 2018 -0700 --- lisp/org-agenda.el | 6 +++--- lisp/org-element.el | 2 +- lisp/org-footnote.el | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 584742a7d..489ecec95 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -7018,15 +7018,15 @@ When TYPE is \"scheduled\", \"deadline\", \"timestamp\" or \"timestamp_ia\", compare within each of these type. When TYPE is the empty string, compare all timestamps without respect of their type." - (let* ((def (if org-sort-agenda-notime-is-late most-positive-fixnum -1)) + (let* ((def (and (not org-sort-agenda-notime-is-late) -1)) (ta (or (and (string-match type (or (get-text-property 1 'type a) "")) (get-text-property 1 'ts-date a)) def)) (tb (or (and (string-match type (or (get-text-property 1 'type b) "")) (get-text-property 1 'ts-date b)) def))) - (cond ((< ta tb) -1) - ((< tb ta) +1)))) + (cond ((if ta (and tb (< ta tb)) tb) -1) + ((if tb (and ta (< tb ta)) ta) +1)))) (defsubst org-cmp-habit-p (a b) "Compare the todo states of strings A and B." diff --git a/lisp/org-element.el b/lisp/org-element.el index c17bee411..8d16aa5e8 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -4906,7 +4906,7 @@ table is cleared once the synchronization is complete." (defun org-element--cache-generate-key (lower upper) "Generate a key between LOWER and UPPER. -LOWER and UPPER are integers or lists, possibly empty. +LOWER and UPPER are fixnums or lists of same, possibly empty. If LOWER and UPPER are equals, return LOWER. Otherwise, return a unique key, as an integer or a list of integers, according to diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el index 7147a3175..4a296b139 100644 --- a/lisp/org-footnote.el +++ b/lisp/org-footnote.el @@ -654,7 +654,7 @@ or new, let the user edit the definition of the footnote." (let* ((all (org-footnote-all-labels)) (label (if (eq org-footnote-auto-label 'random) - (format "%x" (random most-positive-fixnum)) + (format "%x" (abs (random))) (org-footnote-normalize-label (let ((propose (org-footnote-unique-label all))) (if (eq org-footnote-auto-label t) propose