任何人都可以帮我删除标题为:event
or的标签:event:
,它可能会或可能不会出现在被标记为已完成的特定待办事项中。
如果不存在其他标签,则要删除的表单是:event:
. 如果右侧附加了一个附加标签,那么要删除的表单是:event
——因为连接到另一个标签的冒号需要保留——例如,:smith_john:
我想对所有待办事项使用这个功能,即使有些待办事项将不包含event
标签。
这有点棘手,因为正常的搜索和替换不仅限于待办事项列表中的这一特定任务。我知道与状态更改有关的标签删除功能,但我更愿意使用我自己的删除功能。
这是:event
附加到另一个标签的示例:
** Reference [#A] smith @ meeting; 08/09/2013; 8:30 a.m. :event:smith_john:
DEADLINE: <2013-08-09 Fri 08:30 > SCHEDULED: <2013-08-09 Fri >
:PROPERTIES:
:ToodledoID: 335265357
:ToodledoFolder: EVENTS
:Hash: 4a6b6cc7fbefa9b7695b12247bf84d15
:END:
These are some notes relating to the client named John Smith.
这是一个不包含:event
or:event:
标记的任务示例。尽管如此,该none
功能应该能够像上面的任务一样将其关闭。
** Next Action [#D] 0 @ kid's birthday -- 07/18/1993 :lawlist:
DEADLINE: <2014-07-18 Fri >
:PROPERTIES:
:ToodledoID: 332902470
:ToodledoFolder: TASKS
:Hash: e7cf177f187d47c8fa8ca882f2725305
:END:
These are some notes relating to a task without an event tag.
以下是我用来将待办事项标记为 的函数None
,当与 Toodledo 同步时,将被理解为等同于通常称为completed
or的函数done
。上面任务中的单词Reference
是我选择用于我日历上的事件的 Toodledo 待办状态,这个词Next Action
是我用于具有未来截止日期的任务的单词。
(defun none (&optional default-heading)
(interactive)
(let ((lawlist-item default-heading)
result)
(unless lawlist-item
(condition-case nil
(progn
(org-back-to-heading t)
(setq lawlist-item (elt (org-heading-components) 4)))
)
)
(org-todo "None")
(org-priority ?E)
(org-schedule 'remove)
(org-deadline 'remove)
(org-set-property "ToodledoFolder" "DONE")
(setq org-archive-save-context-info nil)
(setq org-archive-location "/Users/HOME/.0.data/*TODO*::* DONE")
(org-archive-subtree)
(goto-char (point-min))
(re-search-forward "^\* DONE" nil t)
(condition-case err
(progn
(org-sort-entries t ?a)
(lawlist-org-cleanup) ) ;; a custom pagination function.
(error nil))
(re-search-forward lawlist-item nil t)
(beginning-of-visual-line)
(org-cycle-hide-drawers 'all)
))
编辑:以下是上述函数中使用的清理none
函数,以防万一有人对以这种方式关闭特定待办事项的完整解决方案感兴趣:
(defun delete-trailing-blank-lines-at-end-of-file ()
"Deletes all blank lines at the end of the file, even the last one"
(interactive)
(save-excursion
(save-restriction
(widen)
(goto-char (point-max))
(delete-blank-lines)
(let ((trailnewlines (abs (skip-chars-backward "\n\t"))))
(if (> trailnewlines 0)
(progn
(delete-char trailnewlines)))))))
(defun lawlist-org-cleanup ()
(interactive)
(save-excursion
(replace-regexp "\n+\\*\\* " "\n\n** " nil (point-min) (point-max))
(replace-regexp "\n+\\* " "\n\n\n* " nil (point-min) (point-max))
(replace-regexp "\n\t\s*" "\n " nil (point-min) (point-max)) )
(delete-trailing-blank-lines-at-end-of-file) )