有人可以给我一个设置标记的函数示例,然后做一些在缓冲区其他地方设置附加标记的操作,然后返回到函数开头标记的原始位置。
transient-mark-mode
默认启用。我尝试设置标记,(activate-mark)
然后(deactivate-mark)
将标记推入mark-ring
,然后我的函数在缓冲区中移动,存档待办事项并执行一些组织工作并暂停 a read-event
(在待办事项存档的新位置)让我看到一切都正确地完成了,然后我过去常常(set-mark-command t)
回到一切开始的地方。但是,(set-mark-command t)
并没有让我回到函数开始时的原始标记。相反,(set-mark-command t)
将我带到另一个标记,该标记在函数运行时无意中设置在其他位置。
(defun none (&optional default-heading)
(interactive)
(beginning-of-visual-line)
(activate-mark)
(deactivate-mark)
(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)))
)
)
(when (search-forward-regexp ":event\\|event:" (line-end-position) t)
(replace-match "")
(when (and (looking-at ":$\\|: ") (looking-back " "))
(delete-char 1)))
(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) )
(error nil))
(re-search-forward lawlist-item nil t)
(message (format "%s -- Finished!" lawlist-item))
(beginning-of-visual-line)
(org-cycle-hide-drawers 'all)
(read-event)
(set-mark-command t)
))