Bastien <b...@altern.org> writes:

> Hi Eric,
>
> Eric Fraga <e.fr...@ucl.ac.uk> 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-match 
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 (mapcar (function (lambda (tg) (if (or ... ...) nil tg))) tags))) (if tags 
(progn (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-beginning 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-inherited-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 (propertize " " (quote display) category-icon) "")) (tag (if tags 
(nth (1- (length tags)) tags) "")) time effort neffort (ts (if dotime (concat 
(if (stringp dotime) 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)) 
buffer-file-name (add-to-list (quote org-agenda-contributing-files) 
buffer-file-name)) (if (and dotime time-of-day) (progn (if (or (setq stamp 
(string-match org-stamp-time-of-day-regexp ts)) (setq plain (string-match 
org-plain-time-of-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 (setq s2 (org-get-time-of-day s2 (quote string) t))) (if (and s1 (not 
s2) org-agenda-default-appointment-duration) (progn (setq s2 
(org-minutes-to-hh:mm-string ...)))) (if s2 (progn (setq duration (- ... 
...)))))) (if (string-match "\\([         ]+\\)\\(:[[:alnum:]_@#%:]+:\\)[       
  ]*$" txt) (progn (if (or (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 (concat ... ...) t t txt))))) (if 
(derived-mode-p (quote org-mode)) (progn (setq effort (condition-case nil 
(org-get-effort (or ... ...)) (error nil))) (if effort (progn (setq neffort 
(org-duration-string-to-minutes effort) effort (setq 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 time (cond (s2 (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) "") category (if (symbolp category) (symbol-name category) 
category) thecategory (copy-sequence category) level (or level "")) (if 
(string-match org-bracket-link-regexp category) (progn (setq l (if (match-end 
3) (- (match-end 3) (match-beginning 3)) (- (match-end 1) (match-beginning 
1)))) (if (< l (or org-prefix-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 (>= (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 (length rtn) (quote (line-prefix t wrap-prefix 
t)) rtn) (org-add-props rtn nil (quote org-category) (if thecategory (downcase 
thecategory) category) (quote tags) (mapcar (quote org-downcase-keep-props) 
tags) (quote org-highest-priority) org-highest-priority (quote 
org-lowest-priority) org-lowest-priority (quote time-of-day) time-of-day (quote 
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)))
  (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 category (if (stringp 
org-category) org-category (and org-category ...)) (if buffer-file-name 
(file-name-sans-extension ...) ""))) (category-icon 
(org-agenda-get-category-icon category)) (category-icon (if category-icon 
(propertize " " (quote display) category-icon) "")) (tag (if tags (nth (1- ...) 
tags) "")) time effort neffort (ts (if dotime (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)) buffer-file-name (add-to-list (quote 
org-agenda-contributing-files) buffer-file-name)) (if (and dotime time-of-day) 
(progn (if (or (setq stamp ...) (setq plain ...)) (progn (setq s0 ... srp ... 
s1 ... s2 ...) (if ... ...))) (if s1 (setq s1 (org-get-time-of-day s1 ... t))) 
(if s2 (setq s2 (org-get-time-of-day s2 ... t))) (if (and s1 (not s2) 
org-agenda-default-appointment-duration) (progn (setq s2 ...))) (if s2 (progn 
(setq duration ...))))) (if (string-match "\\([       
]+\\)\\(:[[:alnum:]_@#%:]+:\\)[         ]*$" txt) (progn (if (or (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 (condition-case nil 
(org-get-effort ...) (error nil))) (if effort (progn (setq neffort ... 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 time (cond (s2 (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) "") category (if (symbolp category) (symbol-name category) 
category) thecategory (copy-sequence category) level (or level "")) (if 
(string-match org-bracket-link-regexp category) (progn (setq l (if (match-end 
3) (- ... ...) (- ... ...))) (if (< l (or org-prefix-category-length 0)) (progn 
(setq category ...) (org-add-props category nil ... ...)))) (if (and 
org-prefix-category-max-length (>= (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 (length rtn) (quote (line-prefix t wrap-prefix t)) 
rtn) (org-add-props rtn nil (quote org-category) (if thecategory (downcase 
thecategory) category) (quote tags) (mapcar (quote org-downcase-keep-props) 
tags) (quote org-highest-priority) org-highest-priority (quote 
org-lowest-priority) org-lowest-priority (quote time-of-day) time-of-day (quote 
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-match-data 
save-match-data-internal (quote evaporate)))
  (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 category (if ... org-category ...) (if buffer-file-name ... ""))) 
(category-icon (org-agenda-get-category-icon category)) (category-icon (if 
category-icon (propertize " " ... category-icon) "")) (tag (if tags (nth ... 
tags) "")) 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 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 (or ... ...) (progn ... ...)) (if s1 (setq s1 
...)) (if s2 (setq s2 ...)) (if (and s1 ... 
org-agenda-default-appointment-duration) (progn ...)) (if s2 (progn ...)))) (if 
(string-match "\\([   ]+\\)\\(:[[:alnum:]_@#%:]+:\\)[         ]*$" txt) (progn 
(if (or ... ...) (setq txt ...) (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 category) (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 org-prefix-category-max-length (>= ... org-prefix-category-max-length)) 
(setq category (substring category 0 ...)))) (setq rtn (concat (eval formatter) 
txt)) (remove-text-properties 0 (length rtn) (quote (line-prefix t wrap-prefix 
t)) rtn) (org-add-props rtn nil (quote org-category) (if thecategory (downcase 
thecategory) category) (quote tags) (mapcar (quote org-downcase-keep-props) 
tags) (quote org-highest-priority) org-highest-priority (quote 
org-lowest-priority) org-lowest-priority (quote time-of-day) time-of-day (quote 
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-match-data 
save-match-data-internal (quote evaporate))))
  (let* ((bindings (car org-prefix-format-compiled)) (formatter (cadr 
org-prefix-format-compiled))) (progn (let* ((--cl-var-- bindings) (--cl-var-- 
nil) (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 category ... ...)) (category-icon (org-agenda-get-category-icon category)) 
(category-icon (if category-icon ... "")) (tag (if tags ... "")) time effort 
neffort (ts (if dotime ...)) (time-of-day (and dotime ...)) stamp plain s0 s1 
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-properties 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) level (or level "")) (if (string-match org-bracket-link-regexp 
category) (progn (setq l ...) (if ... ...)) (if (and 
org-prefix-category-max-length ...) (setq category ...))) (setq rtn (concat 
(eval formatter) txt)) (remove-text-properties 0 (length rtn) (quote 
(line-prefix t wrap-prefix t)) rtn) (org-add-props rtn nil (quote org-category) 
(if thecategory (downcase thecategory) category) (quote tags) (mapcar (quote 
org-downcase-keep-props) tags) (quote org-highest-priority) 
org-highest-priority (quote org-lowest-priority) org-lowest-priority (quote 
time-of-day) time-of-day (quote 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-match-data save-match-data-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-heading 
t)) (9 30 2012))
  (cond ((equal char 100) (setq text (read-string "Day entry: ")) 
(org-agenda-add-entry-to-org-agenda-diary-file (quote day) text d1) (and (equal 
(buffer-name) org-agenda-buffer-name) (org-agenda-redo))) ((equal char 97) 
(setq 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 anniversary) 
text d1) (and (equal (buffer-name) org-agenda-buffer-name) (org-agenda-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) (and 
(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 dp1 
(get-text-property (point-at-bol) (quote day))) (if dp1 nil (error "No date 
defined in current line")) (setq d1 (calendar-gregorian-from-absolute dp1) 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-agenda-add-entry-to-org-agenda-diary-file (quote day) text d1) (and (equal 
(buffer-name) org-agenda-buffer-name) (org-agenda-redo))) ((equal char 97) 
(setq 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 anniversary) 
text d1) (and (equal (buffer-name) org-agenda-buffer-name) (org-agenda-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) (and 
(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))))
  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 (message "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 command associated with <%c>" char)) (if (and 
(get-text-property point (quote day)) (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-protect (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

-- 
: Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D
: in Emacs 24.2.50.1 and Org release_7.9.1-452-g7d8a0c


Reply via email to