From: Narendra Joshi <narendraj9@gmail.com>
To: emacs-devel@gnu.org
Subject: Fix for Arithmetic Error while opening org-agenda
Date: Fri, 10 Mar 2017 22:44:47 +0530 [thread overview]
Message-ID: <87r325yry0.fsf@vicarie> (raw)
[-- Attachment #1: Type: text/plain, Size: 232 bytes --]
Hi,
While opening `org-agenda', I am getting an Arithmetic error if there
are entries in an org file with timestamps of the form <... ++0d>, I
have attached a patch for it. It would be great if someone can submit it
on my behalf.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Fix divide by zero in org timestamps with 0 duration --]
[-- Type: text/x-diff, Size: 800 bytes --]
diff --git a/lisp/org/org.el b/lisp/org/org.el
index 02a7a0c..abb2269 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -17250,11 +17250,11 @@ org-closest-date
(- cday (1+ (floor (/ missing-hours 24)))))
n2 (+ cday (floor (/ (- dn missing-hours) 24))))))
((eq dw 'day)
- (setq n1 (+ sday (* dn (floor (/ (- cday sday) dn))))
+ (setq n1 (+ sday (* dn (floor (if (= dn 0) 0 (/ (- cday sday) dn)))))
n2 (+ n1 dn)))
((eq dw 'year)
(setq d (nth 1 start) m (car start) y1 (nth 2 start) y2 (nth 2 current))
- (setq y1 (+ (* (floor (/ (- y2 y1) dn)) dn) y1))
+ (setq y1 (+ (* (floor (if (= dn 0) 0 (/ (- y2 y1) dn))) dn) y1))
(setq date1 (list m d y1)
n1 (calendar-absolute-from-gregorian date1)
date2 (list m d (+ y1 (* (if (< n1 cday) 1 -1) dn)))
[-- Attachment #3: Type: text/plain, Size: 29 bytes --]
Thanks,
--
Narendra Joshi
next reply other threads:[~2017-03-10 17:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-10 17:14 Narendra Joshi [this message]
2017-03-11 19:11 ` Fix for Arithmetic Error while opening org-agenda aaermolov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r325yry0.fsf@vicarie \
--to=narendraj9@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.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).