简体   繁体   English

如果是org-agenda-mode,请用“ Args超出范围:0,0”替换为更漂亮的消息

[英]If org-agenda-mode, substitute “Args out of range: 0, 0” for a prettier message

I understand that the error message means there are no todo entries that mach the search criteria: 我了解该错误消息表示没有符合搜索条件的待办事项:

org-agenda-find-same-or-today-or-agenda: Args out of range: 0, 0

Is there any way to generate a prettier message instead: 有什么方法可以生成更漂亮的消息吗?

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

You can use condition-case to handle that standard error: 您可以使用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)))))
     ...)

However, it sounds like you should correct the code so that that error is prevented, instead. 但是,听起来您应该更正代码,以防止出现该错误。 Can't you test the argument(s) to org-agenda-find-same-or-today-or-agenda before you call it, and call it only if the argument(s) is/are valid? 您不能在调用它之前测试到org-agenda-find-same-or-today-or-agenda to org-agenda-find-same-or-today-or-agenda的参数,并仅在该参数有效时才调用它?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM