1

我了解错误消息意味着没有符合搜索条件的待办事项条目:

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."))
4

1 回答 1

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在调用它之前测试参数,并且只有在参数有效时才调用它?

于 2013-10-31T03:41:47.417 回答