From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Fraga Subject: Re: [bug] org-agenda-diary-entry fails on redisplay of the agenda Date: Sun, 30 Sep 2012 20:11:23 +0930 Message-ID: <87ehljbxnw.fsf@ucl.ac.uk> References: <87ipavbztw.fsf@ucl.ac.uk> <87391zsug2.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:42546) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TIHR7-0005JX-CT for emacs-orgmode@gnu.org; Sun, 30 Sep 2012 07:11:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TIHR5-00007c-3c for emacs-orgmode@gnu.org; Sun, 30 Sep 2012 07:11:49 -0400 Received: from mail-tx2.bigfish.com ([65.55.88.10]:3624 helo=tx2outboundpool.messaging.microsoft.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TIHR4-00007K-Pg for emacs-orgmode@gnu.org; Sun, 30 Sep 2012 07:11:47 -0400 In-Reply-To: <87391zsug2.fsf@bzg.ath.cx> (Bastien's message of "Sun, 30 Sep 2012 11:58:53 +0200") 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Bastien Cc: emacs-orgmode@gnu.org Bastien writes: > Hi Eric, > > Eric Fraga writes: > >> I should note that >> I have set org-agenda-diary-file to point to an org file instead of the = default >> Emacs diary file and that file is based on a date-tree layout. > > Can you get this error with a limited set of (tagged) items? Hello Bastien, I am not entirely sure what you mean but I have tested this now with an empty diary.org file (i.e. no tags at all in that file at least) and I get: --8<---------------cut here---------------start------------->8--- Debugger entered--Lisp error: (wrong-type-argument sequencep t) mapcar((lambda (tg) (if (or (and hide-re (string-match hide-re tg)) (and = (not add-inherited) (get-text-property 0 (quote inherited) tg))) nil tg)) t) (delq nil (mapcar (function (lambda (tg) (if (or (and hide-re (string-mat= ch hide-re tg)) (and (not add-inherited) (get-text-property 0 ... tg))) nil= tg))) tags)) (setq tags (delq nil (mapcar (function (lambda (tg) (if (or (and hide-re = ...) (and ... ...)) nil tg))) tags))) (progn (if (string-match "\\([ ]+\\)\\(:[[:alnum:]_@#%:]+:\\)[ ]*$" txt= ) (setq txt (substring txt 0 (match-beginning 0)))) (setq tags (delq nil (m= apcar (function (lambda (tg) (if (or ... ...) nil tg))) tags))) (if tags (p= rogn (let ((have-i (get-text-property 0 (quote inherited) (car tags))) i) (= setq txt (concat txt " :" (mapconcat (function ...) tags ":") (if have-i ":= :" ":"))))))) (if (or add-inherited hide-re) (progn (if (string-match "\\([ ]+\\)\\(:[= [:alnum:]_@#%:]+:\\)[ ]*$" txt) (setq txt (substring txt 0 (match-beginnin= g 0)))) (setq tags (delq nil (mapcar (function (lambda (tg) (if ... nil tg)= )) tags))) (if tags (progn (let ((have-i (get-text-property 0 ... ...)) i) = (setq txt (concat txt " :" (mapconcat ... tags ":") (if have-i "::" ":"))))= )))) org-agenda-fix-displayed-tags(#("test 5" 0 6 (org-heading t)) t t nil) (setq txt (org-agenda-fix-displayed-tags txt tags org-agenda-show-inherit= ed-tags org-agenda-hide-tags-regexp)) (progn (setq txt (org-trim txt)) (setq txt (org-agenda-fix-displayed-tags= txt tags org-agenda-show-inherited-tags org-agenda-hide-tags-regexp)) (let= * ((category (or category (if (stringp org-category) org-category (and org-= category (symbol-name org-category))) (if buffer-file-name (file-name-sans-= extension (file-name-nondirectory buffer-file-name)) ""))) (category-icon (= org-agenda-get-category-icon category)) (category-icon (if category-icon (p= ropertize " " (quote display) category-icon) "")) (tag (if tags (nth (1- (l= ength tags)) tags) "")) time effort neffort (ts (if dotime (concat (if (str= ingp dotime) dotime "") (and org-agenda-search-headline-for-time txt)))) (t= ime-of-day (and dotime (org-get-time-of-day ts))) stamp plain s0 s1 s2 rtn = srp l duration thecategory) (and (derived-mode-p (quote org-mode)) buffer-f= ile-name (add-to-list (quote org-agenda-contributing-files) buffer-file-nam= e)) (if (and dotime time-of-day) (progn (if (or (setq stamp (string-match o= rg-stamp-time-of-day-regexp ts)) (setq plain (string-match org-plain-time-o= f-day-regexp ts))) (progn (setq s0 (match-string 0 ts) srp (and stamp ...) = s1 (match-string ... ts) s2 (match-string ... ts)) (if (and org-prefix-has-= time org-agenda-remove-times-when-in-prefix ... ... ... ...) (setq txt ...)= ))) (if s1 (setq s1 (org-get-time-of-day s1 (quote string) t))) (if s2 (set= q s2 (org-get-time-of-day s2 (quote string) t))) (if (and s1 (not s2) org-a= genda-default-appointment-duration) (progn (setq s2 (org-minutes-to-hh:mm-s= tring ...)))) (if s2 (progn (setq duration (- ... ...)))))) (if (string-mat= ch "\\([ ]+\\)\\(:[[:alnum:]_@#%:]+:\\)[ ]*$" txt) (progn (if (or (eq org= -agenda-remove-tags t) (and org-agenda-remove-tags org-prefix-has-tag)) (se= tq txt (replace-match "" t t txt)) (setq txt (replace-match (concat ... ...= ) t t txt))))) (if (derived-mode-p (quote org-mode)) (progn (setq effort (c= ondition-case nil (org-get-effort (or ... ...)) (error nil))) (if effort (p= rogn (setq neffort (org-duration-string-to-minutes effort) effort (setq eff= ort ...)))))) (or effort (setq effort "")) (if remove-re (progn (while (str= ing-match remove-re txt) (setq txt (replace-match "" t t txt))))) (add-text= -properties 0 (length txt) (quote (org-heading t)) txt) (setq time (cond (s= 2 (concat (org-agenda-time-of-day-to-ampm-maybe s1) "-" (org-agenda-time-of= -day-to-ampm-maybe s2) (if org-agenda-timegrid-use-ampm " "))) (s1 (concat = (org-agenda-time-of-day-to-ampm-maybe s1) (if org-agenda-timegrid-use-ampm = "........ " "......"))) (t "")) extra (or (and (not habitp) extra) "") cate= gory (if (symbolp category) (symbol-name category) category) thecategory (c= opy-sequence category) level (or level "")) (if (string-match org-bracket-l= ink-regexp category) (progn (setq l (if (match-end 3) (- (match-end 3) (mat= ch-beginning 3)) (- (match-end 1) (match-beginning 1)))) (if (< l (or org-p= refix-category-length 0)) (progn (setq category (copy-sequence category)) (= org-add-props category nil (quote extra-space) (make-string ... 32))))) (if= (and org-prefix-category-max-length (>=3D (length category) org-prefix-cat= egory-max-length)) (setq category (substring category 0 (1- org-prefix-cate= gory-max-length))))) (setq rtn (concat (eval formatter) txt)) (remove-text-= properties 0 (length rtn) (quote (line-prefix t wrap-prefix t)) rtn) (org-a= dd-props rtn nil (quote org-category) (if thecategory (downcase thecategory= ) category) (quote tags) (mapcar (quote org-downcase-keep-props) tags) (quo= te org-highest-priority) org-highest-priority (quote org-lowest-priority) o= rg-lowest-priority (quote time-of-day) time-of-day (quote duration) duratio= n (quote effort) effort (quote effort-minutes) neffort (quote txt) txt (quo= te level) level (quote time) time (quote extra) extra (quote format) org-pr= efix-format-compiled (quote dotime) dotime))) (unwind-protect (progn (setq txt (org-trim txt)) (setq txt (org-agenda-fi= x-displayed-tags txt tags org-agenda-show-inherited-tags org-agenda-hide-ta= gs-regexp)) (let* ((category (or category (if (stringp org-category) org-ca= tegory (and org-category ...)) (if buffer-file-name (file-name-sans-extensi= on ...) ""))) (category-icon (org-agenda-get-category-icon category)) (cate= gory-icon (if category-icon (propertize " " (quote display) category-icon) = "")) (tag (if tags (nth (1- ...) tags) "")) time effort neffort (ts (if dot= ime (concat (if ... dotime "") (and org-agenda-search-headline-for-time txt= )))) (time-of-day (and dotime (org-get-time-of-day ts))) stamp plain s0 s1 = s2 rtn srp l duration thecategory) (and (derived-mode-p (quote org-mode)) b= uffer-file-name (add-to-list (quote org-agenda-contributing-files) buffer-f= ile-name)) (if (and dotime time-of-day) (progn (if (or (setq stamp ...) (se= tq plain ...)) (progn (setq s0 ... srp ... s1 ... s2 ...) (if ... ...))) (i= f s1 (setq s1 (org-get-time-of-day s1 ... t))) (if s2 (setq s2 (org-get-tim= e-of-day s2 ... t))) (if (and s1 (not s2) org-agenda-default-appointment-du= ration) (progn (setq s2 ...))) (if s2 (progn (setq duration ...))))) (if (s= tring-match "\\([ ]+\\)\\(:[[:alnum:]_@#%:]+:\\)[ ]*$" txt) (progn (if (o= r (eq org-agenda-remove-tags t) (and org-agenda-remove-tags org-prefix-has-= tag)) (setq txt (replace-match "" t t txt)) (setq txt (replace-match ... t = t txt))))) (if (derived-mode-p (quote org-mode)) (progn (setq effort (condi= tion-case nil (org-get-effort ...) (error nil))) (if effort (progn (setq ne= ffort ... effort ...))))) (or effort (setq effort "")) (if remove-re (progn= (while (string-match remove-re txt) (setq txt (replace-match "" t t txt)))= )) (add-text-properties 0 (length txt) (quote (org-heading t)) txt) (setq t= ime (cond (s2 (concat (org-agenda-time-of-day-to-ampm-maybe s1) "-" (org-ag= enda-time-of-day-to-ampm-maybe s2) (if org-agenda-timegrid-use-ampm " "))) = (s1 (concat (org-agenda-time-of-day-to-ampm-maybe s1) (if org-agenda-timegr= id-use-ampm "........ " "......"))) (t "")) extra (or (and (not habitp) ext= ra) "") category (if (symbolp category) (symbol-name category) category) th= ecategory (copy-sequence category) level (or level "")) (if (string-match o= rg-bracket-link-regexp category) (progn (setq l (if (match-end 3) (- ... ..= .) (- ... ...))) (if (< l (or org-prefix-category-length 0)) (progn (setq c= ategory ...) (org-add-props category nil ... ...)))) (if (and org-prefix-ca= tegory-max-length (>=3D (length category) org-prefix-category-max-length)) = (setq category (substring category 0 (1- org-prefix-category-max-length))))= ) (setq rtn (concat (eval formatter) txt)) (remove-text-properties 0 (lengt= h rtn) (quote (line-prefix t wrap-prefix t)) rtn) (org-add-props rtn nil (q= uote org-category) (if thecategory (downcase thecategory) category) (quote = tags) (mapcar (quote org-downcase-keep-props) tags) (quote org-highest-prio= rity) org-highest-priority (quote org-lowest-priority) org-lowest-priority = (quote time-of-day) time-of-day (quote duration) duration (quote effort) ef= fort (quote effort-minutes) neffort (quote txt) txt (quote level) level (qu= ote time) time (quote extra) extra (quote format) org-prefix-format-compile= d (quote dotime) dotime))) (set-match-data save-match-data-internal (quote = evaporate))) (let ((save-match-data-internal (match-data))) (unwind-protect (progn (se= tq txt (org-trim txt)) (setq txt (org-agenda-fix-displayed-tags txt tags or= g-agenda-show-inherited-tags org-agenda-hide-tags-regexp)) (let* ((category= (or category (if ... org-category ...) (if buffer-file-name ... ""))) (cat= egory-icon (org-agenda-get-category-icon category)) (category-icon (if cate= gory-icon (propertize " " ... category-icon) "")) (tag (if tags (nth ... ta= gs) "")) time effort neffort (ts (if dotime (concat ... ...))) (time-of-day= (and dotime (org-get-time-of-day ts))) stamp plain s0 s1 s2 rtn srp l dura= tion thecategory) (and (derived-mode-p (quote org-mode)) buffer-file-name (= add-to-list (quote org-agenda-contributing-files) buffer-file-name)) (if (a= nd dotime time-of-day) (progn (if (or ... ...) (progn ... ...)) (if s1 (set= q s1 ...)) (if s2 (setq s2 ...)) (if (and s1 ... org-agenda-default-appoint= ment-duration) (progn ...)) (if s2 (progn ...)))) (if (string-match "\\([ = ]+\\)\\(:[[:alnum:]_@#%:]+:\\)[ ]*$" txt) (progn (if (or ... ...) (setq tx= t ...) (setq txt ...)))) (if (derived-mode-p (quote org-mode)) (progn (setq= effort (condition-case nil ... ...)) (if effort (progn ...)))) (or effort = (setq effort "")) (if remove-re (progn (while (string-match remove-re txt) = (setq txt ...)))) (add-text-properties 0 (length txt) (quote (org-heading t= )) txt) (setq time (cond (s2 (concat ... "-" ... ...)) (s1 (concat ... ...)= ) (t "")) extra (or (and (not habitp) extra) "") category (if (symbolp cate= gory) (symbol-name category) category) thecategory (copy-sequence category)= level (or level "")) (if (string-match org-bracket-link-regexp category) (= progn (setq l (if ... ... ...)) (if (< l ...) (progn ... ...))) (if (and or= g-prefix-category-max-length (>=3D ... org-prefix-category-max-length)) (se= tq category (substring category 0 ...)))) (setq rtn (concat (eval formatter= ) txt)) (remove-text-properties 0 (length rtn) (quote (line-prefix t wrap-p= refix t)) rtn) (org-add-props rtn nil (quote org-category) (if thecategory = (downcase thecategory) category) (quote tags) (mapcar (quote org-downcase-k= eep-props) tags) (quote org-highest-priority) org-highest-priority (quote o= rg-lowest-priority) org-lowest-priority (quote time-of-day) time-of-day (qu= ote duration) duration (quote effort) effort (quote effort-minutes) neffort= (quote txt) txt (quote level) level (quote time) time (quote extra) extra = (quote format) org-prefix-format-compiled (quote dotime) dotime))) (set-mat= ch-data save-match-data-internal (quote evaporate)))) (let* ((bindings (car org-prefix-format-compiled)) (formatter (cadr org-p= refix-format-compiled))) (progn (let* ((--cl-var-- bindings) (--cl-var-- ni= l) (var nil) (value nil)) (while (consp --cl-var--) (setq --cl-var-- (car -= -cl-var--) var (car (prog1 --cl-var-- (setq --cl-var-- ...))) value (car --= cl-var--)) (set var value) (setq --cl-var-- (cdr --cl-var--))) nil)) (let (= (save-match-data-internal (match-data))) (unwind-protect (progn (setq txt (= org-trim txt)) (setq txt (org-agenda-fix-displayed-tags txt tags org-agenda= -show-inherited-tags org-agenda-hide-tags-regexp)) (let* ((category (or cat= egory ... ...)) (category-icon (org-agenda-get-category-icon category)) (ca= tegory-icon (if category-icon ... "")) (tag (if tags ... "")) time effort n= effort (ts (if dotime ...)) (time-of-day (and dotime ...)) stamp plain s0 s= 1 s2 rtn srp l duration thecategory) (and (derived-mode-p (quote org-mode))= buffer-file-name (add-to-list (quote org-agenda-contributing-files) buffer= -file-name)) (if (and dotime time-of-day) (progn (if ... ...) (if s1 ...) (= if s2 ...) (if ... ...) (if s2 ...))) (if (string-match "\\([ ]+\\)\\(:[[:= alnum:]_@#%:]+:\\)[ ]*$" txt) (progn (if ... ... ...))) (if (derived-mode-= p (quote org-mode)) (progn (setq effort ...) (if effort ...))) (or effort (= setq effort "")) (if remove-re (progn (while ... ...))) (add-text-propertie= s 0 (length txt) (quote (org-heading t)) txt) (setq time (cond (s2 ...) (s1= ...) (t "")) extra (or (and ... extra) "") category (if (symbolp category)= (symbol-name category) category) thecategory (copy-sequence category) leve= l (or level "")) (if (string-match org-bracket-link-regexp category) (progn= (setq l ...) (if ... ...)) (if (and org-prefix-category-max-length ...) (s= etq category ...))) (setq rtn (concat (eval formatter) txt)) (remove-text-p= roperties 0 (length rtn) (quote (line-prefix t wrap-prefix t)) rtn) (org-ad= d-props rtn nil (quote org-category) (if thecategory (downcase thecategory)= category) (quote tags) (mapcar (quote org-downcase-keep-props) tags) (quot= e org-highest-priority) org-highest-priority (quote org-lowest-priority) or= g-lowest-priority (quote time-of-day) time-of-day (quote duration) duration= (quote effort) effort (quote effort-minutes) neffort (quote txt) txt (quot= e level) level (quote time) time (quote extra) extra (quote format) org-pre= fix-format-compiled (quote dotime) dotime))) (set-match-data save-match-dat= a-internal (quote evaporate))))) org-agenda-format-item(nil #("test 5" 0 6 (org-heading t)) nil nil t) org-agenda-add-entry-to-org-agenda-diary-file(day #("test 5" 0 6 (org-hea= ding t)) (9 30 2012)) (cond ((equal char 100) (setq text (read-string "Day entry: ")) (org-agen= da-add-entry-to-org-agenda-diary-file (quote day) text d1) (and (equal (buf= fer-name) org-agenda-buffer-name) (org-agenda-redo))) ((equal char 97) (set= q d1 (list (car d1) (nth 1 d1) (read-number (format "Reference year [%d]: "= (nth 2 d1)) (nth 2 d1)))) (setq text (read-string "Anniversary (use %d to = show years): ")) (org-agenda-add-entry-to-org-agenda-diary-file (quote anni= versary) text d1) (and (equal (buffer-name) org-agenda-buffer-name) (org-ag= enda-redo))) ((equal char 98) (setq text (read-string "Block entry: ")) (if= (and d1 d2 (not (equal d1 d2))) nil (error "No block of days selected")) (= org-agenda-add-entry-to-org-agenda-diary-file (quote block) text d1 d2) (an= d (equal (buffer-name) org-agenda-buffer-name) (org-agenda-redo))) ((equal = char 106) (org-switch-to-buffer-other-window (find-file-noselect org-agenda= -diary-file)) (require (quote org-datetree)) (org-datetree-find-date-create= d1) (org-reveal t)) (t (error "Invalid selection character `%c'" char))) (let (d1 d2 char (text "") dp1 dp2) (if (equal (buffer-name) "*Calendar*"= ) (setq d1 (calendar-cursor-to-date t) d2 (car calendar-mark-ring)) (setq d= p1 (get-text-property (point-at-bol) (quote day))) (if dp1 nil (error "No d= ate defined in current line")) (setq d1 (calendar-gregorian-from-absolute d= p1) d2 (and (condition-case nil (progn (mark)) (error nil)) (save-excursion= (goto-char (mark)) (setq dp2 (get-text-property (point-at-bol) (quote day)= ))) (calendar-gregorian-from-absolute dp2)))) (message "Diary entry: [d]ay = [a]nniversary [b]lock [j]ump to date tree") (setq char (read-char-exclusive= )) (cond ((equal char 100) (setq text (read-string "Day entry: ")) (org-age= nda-add-entry-to-org-agenda-diary-file (quote day) text d1) (and (equal (bu= ffer-name) org-agenda-buffer-name) (org-agenda-redo))) ((equal char 97) (se= tq d1 (list (car d1) (nth 1 d1) (read-number (format "Reference year [%d]: = " (nth 2 d1)) (nth 2 d1)))) (setq text (read-string "Anniversary (use %d to= show years): ")) (org-agenda-add-entry-to-org-agenda-diary-file (quote ann= iversary) text d1) (and (equal (buffer-name) org-agenda-buffer-name) (org-a= genda-redo))) ((equal char 98) (setq text (read-string "Block entry: ")) (i= f (and d1 d2 (not (equal d1 d2))) nil (error "No block of days selected")) = (org-agenda-add-entry-to-org-agenda-diary-file (quote block) text d1 d2) (a= nd (equal (buffer-name) org-agenda-buffer-name) (org-agenda-redo))) ((equal= char 106) (org-switch-to-buffer-other-window (find-file-noselect org-agend= a-diary-file)) (require (quote org-datetree)) (org-datetree-find-date-creat= e d1) (org-reveal t)) (t (error "Invalid selection character `%c'" char)))) org-agenda-diary-entry-in-org-file() (if (not (eq org-agenda-diary-file (quote diary-file))) (org-agenda-diary= -entry-in-org-file) (require (quote diary-lib)) (let* ((char (progn (messag= e "Diary entry: [d]ay [w]eekly [m]onthly [y]early [a]nniversary [b]lock [c]= yclic") (read-char-exclusive))) (cmd (cdr (assoc char (quote (... ... ... .= .. ... ... ...))))) (oldf (symbol-function (quote calendar-cursor-to-date))= ) (point (point)) (mark (or (mark t) (point)))) (if cmd nil (error "No comm= and associated with <%c>" char)) (if (and (get-text-property point (quote d= ay)) (or (not (equal 98 char)) (get-text-property mark (quote day)))) nil (= error "Don't know which date to use for diary entry")) (let ((calendar-mark= -ring (list (calendar-gregorian-from-absolute (or ... ...))))) (unwind-prot= ect (progn (fset (quote calendar-cursor-to-date) (function (lambda ... ...)= )) (call-interactively cmd)) (fset (quote calendar-cursor-to-date) oldf))))) org-agenda-diary-entry() call-interactively(org-agenda-diary-entry nil nil) --8<---------------cut here---------------end--------------->8--- with nothing removed from the backtrace in case that helps. After inserting an item (but failing on re-display as above), the diary file now looks like this: --8<---------------cut here---------------start------------->8--- * 2012 *** 2012-09 September ***** 2012-09-30 Sunday ******* test 5 <2012-09-30 Sun> --8<---------------cut here---------------end--------------->8--- Thanks again, eric --=20 : Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D : in Emacs 24.2.50.1 and Org release_7.9.1-452-g7d8a0c