From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Narendra Joshi Newsgroups: gmane.emacs.devel Subject: Fix for Arithmetic Error while opening org-agenda Date: Fri, 10 Mar 2017 22:44:47 +0530 Message-ID: <87r325yry0.fsf@vicarie> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1489165802 26091 195.159.176.226 (10 Mar 2017 17:10:02 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 10 Mar 2017 17:10:02 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Mar 10 18:09:59 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cmO39-0006Da-In for ged-emacs-devel@m.gmane.org; Fri, 10 Mar 2017 18:09:55 +0100 Original-Received: from localhost ([::1]:40122 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cmO3F-00078D-It for ged-emacs-devel@m.gmane.org; Fri, 10 Mar 2017 12:10:01 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58134) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cmO37-00077J-Av for emacs-devel@gnu.org; Fri, 10 Mar 2017 12:09:54 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cmO33-0001M2-Co for emacs-devel@gnu.org; Fri, 10 Mar 2017 12:09:53 -0500 Original-Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]:36771) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cmO33-0001LI-3Z for emacs-devel@gnu.org; Fri, 10 Mar 2017 12:09:49 -0500 Original-Received: by mail-pf0-x242.google.com with SMTP id j5so11399535pfb.3 for ; Fri, 10 Mar 2017 09:09:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:user-agent:mime-version; bh=0kKWGkjgT6oPLYUg+grMReazm43vIoieVY23uNcuABA=; b=X65hj2f9Sm6T3krJU3IyDx1iVeTCIMHzcSoAvwJLFg6UDW0om8tKLAj4ROuzc3qprK wkJyF7W2flPuxa9pFvuJR6nftV9KTzdoMLpJPnxp3PkLDUcf6lyjORx8fG41h8mkQ5eN ItL7SX/DWNFzVeoU3Dabu4uBNI5IKqtrCjvHjTX2QpR8wDf7PHrxAHF8U+p5A4nQUtWy T15A4T2dTseQeUEJSqPCtXRjKoRavxHdRKC+RqIrdFgGzdTiBgLsiBPCHOipn9Oc4/m7 F+xOLTaLnF6hvzB5UR//gebZ1AR2IYTprY97Lm99YFtmN6HWWdLxR7KvueGEsT0P1dG8 Ee6w== 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:user-agent :mime-version; bh=0kKWGkjgT6oPLYUg+grMReazm43vIoieVY23uNcuABA=; b=ch+qm5NnZ1/XvxHNd0GORjwVsmRlbn3f3QKuUzlBKU4svsWI2U/rFwgrRU8cvlawsV 6bz/aSQ+JuuANlFrRz8ZDRwGYnuomk92pvOTPbyrvjW5Eau4YSWlX1qdSoLOMxarfuCg uBpQECzkNs3rUb/YMt/ErIOp4OKeHc7NVkRsoFyVpKdFWD76PHze6or+r0QKpxCRPjxU DmZVbo+wykFs7zE3lfJJ8a4tYaUJVQf7fJcJFxBmzt3JtvmGbtsy2ouZdVCtlWBmkofI TaMXHZLsdPRGWfoiGX5N43wEvZdZV6gARh+3q77hwNFjueSHFAf7gJ9mLyoP+5uI7+KY BTmA== X-Gm-Message-State: AMke39mkeZko2M8gAj4QOl0juxKOnhWMISaERA9LhsizzK/JGvM43LcfrCWYoXcCfAUuQQ== X-Received: by 10.98.129.194 with SMTP id t185mr22258611pfd.137.1489165787908; Fri, 10 Mar 2017 09:09:47 -0800 (PST) Original-Received: from vicarie ([223.229.138.220]) by smtp.gmail.com with ESMTPSA id 19sm19741747pfo.50.2017.03.10.09.09.46 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Mar 2017 09:09:47 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c00::242 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:212893 Archived-At: --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=org-agenda-arithmetic-error.patch Content-Description: Fix divide by zero in org timestamps with 0 duration 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))) --=-=-= Content-Type: text/plain Thanks, -- Narendra Joshi --=-=-=--