我理解错误消息表示没有符合搜索条件的todo条目:
org-agenda-find-same-or-today-or-agenda: Args out of range: 0, 0
有没有办法生成更漂亮的消息:
(if (and (eq major-mode 'org-agenda-mode)
(org-agenda-find-same-or-today-or-agenda: Args out of range: 0, 0) )
(message "There are no events that match your search criteria."))
答案 0 :(得分:1)
您可以使用condition-case
来处理该标准错误:
(if (and (eq major-mode 'org-agenda-mode)
(condition-case err
(org-agenda-find-same-or-today-or-agenda ...) ; Whatever args you need to pass.
(args-out-of-range (error "There are no events that match your search criteria"))
(error (error (error-message-string err)))))
...)
但是,听起来您应该更正代码,以防止出现该错误。在调用它之前,你不能测试org-agenda-find-same-or-today-or-agenda
的参数,只有在参数有效的情况下才调用它吗?