- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
使用 Emacs 组织模式,我经常有一个我希望一次激活一个的 TODO 项目列表,按顺序排列。例如,当列表中的项目 A 标记为“完成”时,我希望项目 B 自动标记为“待办事项”。我该如何做到这一点?这不应该是任何类型的一般行为,它应该只发生在我选择的特定对或项目列表中。
最佳答案
;; init-org-lawlist.el
;;
;; QUESTION @Brian Z -- stackoverflow.com: "How to automatically trigger a change in TODO state in Emacs org-mode."
;;
;; "I often have a list of TODO items that I want to have active one at a time, in sequence. For example when the
;; Item A in a list is marked "DONE", then I want Item B to be automatically be marked "TODO". How do I make this
;; happen? This should not be any kind of general behavior, it should only happen with specific pairs or lists of
;; items that I chose."
;;
;;
;; ANSWER @lawlist -- stackoverflow.com -- This script provides two (2) possible options:
;;
;; 1. Navigate to a ** TODO heading (must have at least one todo subtree underneath) and enter: M-x lawlist-done
;; OR
;; 2. Within a ** TODO heading (must have at least one todo subtree underneath), Shift-Right or Shift-Left and cycle
;; to the option ** DONE and then confirm yes or no.
;;
;; NOTE # A: This configuration script assumes the `org-archive-location` will use the SAME lawlist.org file for everything.
;; In this example, the script uses: (setq org-archive-location "/Users/HOME/.0.data/lawlist.org::* ARCHIVES")
;;
;; NOTE # B: Whenever using setq . . ., there is a likelihood that other settings with the same variable will be trumped.
;; So, after testing this script, it would be best to mix and match portions you like with your own configuration for org-mode.
;; You may need to temporarily disable your other configurations that use the same setq variables so as not to conflict while
;; testing this script.
;;
;; NOTE # C: Author to consider adding a check for the existence of at least one subsequent todo subtree as a condition precedent.
;;
;; NOTE # D: Author to consider adding a check that the user is on a second level tier (i.e., a todo) as a condition precedent.
;;
;;
;;
;;
;; SAMPLE lawlist.org CONFIGURATION FILE
;;
;;
;; * TASKS
;;
;; ** TODO [#A] First, figure out this new feature request. :lawlist:
;; DEADLINE: <2013-07-09 Tue>
;; :PROPERTIES:
;; :lawlist-drawer: ACTIVE
;; :END:
;;
;; ** NEXT [#B] Second, If at first you don't succeed, then try again. :lawlist:
;; :PROPERTIES:
;; :lawlist-drawer: PENDING
;; :END:
;;
;; ** WAITING [#C] Third, try again to figure out this new feature request. :lawlist: :WAITING:
;; :PROPERTIES:
;; :lawlist-drawer: DORMANT
;; :END:
;;
;; ** HOLD [#D] Fourth, try, try again to figure out this new feature request. :lawlist: :WAITING:HOLD:
;; :PROPERTIES:
;; :lawlist-drawer: DORMANT
;; :END:
;;
;;
;; * ARCHIVES
;;
;; ** DONE [#E] This task is a done deal. :lawlist:
;; :PROPERTIES:
;; :lawlist-drawer: COMPLETED
;; :END:
(require 'org)
(setq org-startup-folded 'showeverything) ;; overview | content | all | showeverything
(setq org-tags-column 0)
(setq org-startup-indented nil)
(setq org-indent-mode nil)
(setq org-support-shift-select t) ;; 'always to disable; or, t to use shift-select only when cursor is within a special context.
(setq org-cycle-separator-lines 1)
(setq org-insert-heading-respect-content t)
(setq org-blank-before-new-entry '((heading . t) (plain-list-item . nil)))
(setq org-enable-priority-commands t)
(setq org-highest-priority ?A)
(setq org-lowest-priority ?E)
(setq org-default-priority ?A)
(setq org-ellipsis " \u25bc" )
;; '!' (for a timestamp) or '@' (for a note with timestamp)
(setq org-todo-keywords
(quote ((sequence "TODO(t)" "NEXT(n)" "WAITING(w)" "HOLD(h)" "|" "DONE(d)" "CANCELED(c)") )))
(setq org-global-properties '(("lawlist-drawer_ALL". "ACTIVE PENDING DORMANT COMPLETED")))
(setq org-default-properties (cons "lawlist-drawer" org-default-properties))
(setq org-todo-state-tags-triggers
(quote (("CANCELED" ("CANCELED" . t))
("WAITING" ("WAITING" . t))
("HOLD" ("WAITING" . t) ("HOLD" . t))
(done ("WAITING") ("HOLD"))
("TODO" ("WAITING") ("CANCELED") ("HOLD"))
("NEXT" ("WAITING") ("CANCELED") ("HOLD"))
("DONE" ("WAITING") ("CANCELED") ("HOLD")))))
(setq org-tag-alist (quote ((:startgroup)
("john-doe" . ?j)
("jane-doe" . ?J)
(:endgroup)
("lawlist" . ?0))))
(add-hook 'org-after-todo-state-change-hook 'lawlist-hook)
(defun lawlist-hook (&optional default-heading)
(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 (string-equal org-state "DONE")
(if (string-equal org-state "DONE")
(or (yes-or-no-p (format "%s -- process?" org-state))
(error "You changed your mind.")))
(org-forward-heading-same-level 1)
(org-todo "TODO")
(org-priority ?A)
(org-deadline nil "<%<%Y-%m-%d %a>>")
(org-set-property "lawlist-drawer" "ACTIVE")
(org-backward-heading-same-level 1)
(org-priority ?E)
(org-deadline 'remove)
(org-set-property "lawlist-drawer" "COMPLETED")
;; (setq org-archive-save-context-info nil) ;; Set to nil if user doesn't want archive info.
;; NOTE: User must set the correct path to his / her lawlist.org file.
(setq org-archive-location "/Users/HOME/.0.data/lawlist.org::* ARCHIVES")
(org-archive-subtree)
(goto-char (point-min))
(re-search-forward "^\* ARCHIVES" nil t)
(org-sort-entries t ?a)
;; (org-sort-entries t ?d) additional sorting criteria if deadline is not removed.
(lawlist-org-cleanup)
(goto-char (point-min))
(re-search-forward lawlist-item nil t)
(beginning-of-line)
(message "Please take a moment to visually verify your completed tasks has been refiled correctly, then press any key.")
(read-event) )))
(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) )
(defun lawlist-done (&optional default-heading)
(interactive)
(remove-hook 'org-after-todo-state-change-hook 'lawlist-hook)
(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-forward-heading-same-level 1)
(org-todo "TODO")
(org-priority ?A)
(org-deadline nil "<%<%Y-%m-%d %a>>")
(org-set-property "lawlist-drawer" "ACTIVE")
(org-backward-heading-same-level 1)
(org-todo "DONE")
(org-priority ?E)
(org-deadline 'remove)
(org-set-property "lawlist-drawer" "COMPLETED")
;; (setq org-archive-save-context-info nil) ;; Set to nil if user doesn't want archive info.
;; NOTE: User must set the correct path to his / her lawlist.org file.
(setq org-archive-location "/Users/HOME/.0.data/lawlist.org::* ARCHIVES")
(org-archive-subtree)
(goto-char (point-min))
(re-search-forward "^\* ARCHIVES" nil t)
(org-sort-entries t ?a)
;; (org-sort-entries t ?d) additional sorting criteria if deadline is not removed.
(lawlist-org-cleanup)
(goto-char (point-min))
(re-search-forward lawlist-item nil t)
(beginning-of-line))
(add-hook 'org-after-todo-state-change-hook 'lawlist-hook) )
(provide 'init-org-lawlist)
lawlist.org
用于测试脚本的示例文件应该看起来是
exactly
像这样:
* TASKS
** TODO [#A] First, figure out this new feature request. :lawlist:
DEADLINE: <2013-07-09 Tue>
:PROPERTIES:
:lawlist-drawer: ACTIVE
:END:
** NEXT [#B] Second, If at first you don't succeed, then try again. :lawlist:
:PROPERTIES:
:lawlist-drawer: PENDING
:END:
** WAITING [#C] Third, try again to figure out this new feature request. :lawlist: :WAITING:
:PROPERTIES:
:lawlist-drawer: DORMANT
:END:
** HOLD [#D] Fourth, try, try again to figure out this new feature request. :lawlist: :WAITING:HOLD:
:PROPERTIES:
:lawlist-drawer: DORMANT
:END:
* ARCHIVES
** DONE [#E] This task is a done deal. :lawlist:
:PROPERTIES:
:lawlist-drawer: COMPLETED
:END:
关于emacs - 如何在 Emacs 组织模式中自动触发 TODO 状态的更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17559662/
我通过“emacs --daemon”启动了 emacs 服务器。然后我开了几个客户端。 我想将 .emacs 配置的更改应用于所有客户端,而无需重新启动 emacs 守护程序。这可能吗? 最佳答案
我通过“emacs --daemon”启动了 emacs 服务器。然后我开了几个客户端。 我想将 .emacs 配置的更改应用于所有客户端,而无需重新启动 emacs 守护程序。这可能吗? 最佳答案
我看到了一些关于使 emacs 便携(在 Windows 上)的建议。我的 site-start.el 中有这个: (defvar program-dir (substring data-direct
我是一名狂热的 Vim 用户。我的 Vimrc 有 800 多行。我是一个喜欢定制环境的每个部分的修补匠。 Emacs 似乎更容易配置。所以我尝试一下 Emacs。 当您想要缩小时,请按 Emacs
我是一名狂热的 Vim 用户。我的 Vimrc 有 800 多行。我是一个喜欢定制环境的每个部分的修补匠。 Emacs 似乎更容易配置。所以我尝试一下 Emacs。 当您想要缩小时,请按 Emacs
偶尔在term中使用emacs时模式我会误运行emacs file而不仅仅是打开文件。这将在当前客户端内创建一个嵌套的 emacs 客户端。我的问题是如何只关闭内部客户端? 最佳答案 回答 您应该可以
我一直在慢慢学习 elisp 和 emacs 的新命令,并且一直在稳步构建我的 .emacs。必须保持控制台打开以重复打开和关闭 emacs 实例似乎不是测试的最佳选择,但是从 emacs 中运行 e
我正在寻找一个 emacs 服务器,以便 emacsclients 指定的文件 是相对于 emacsclients 的文件系统而不是服务器的文件系统。例如,如果我设置一个 机器“darkstar”上的
我试图将我所有的 emacs 配置置于版本控制之下,以便在不同的计算机之间轻松切换。实际上我的首选系统是 OSX (10.8.3) 和来自 http://emacsformacosx.com/ 的 e
我正在学习 emacs,我认为使用 emacs 的内置帮助功能开发设施将真正平滑学习击键的学习曲线。 使用 emacs 的内置帮助功能来查找命令名称及其击键的有效过程是什么? 例如,我忘记了关闭框架的
我一直在尝试将 emacs minibuffer 的字体/字体与 emacs 默认字体分开,但没有太多运气。 具体来说,我有兴趣使 minibuffer 字体大小更大以用于 emacs MULE,因为
大约 4 年以来,我一直是一个相当普通的 emacs 用户,但在自定义 emacs 和排除 elisp 故障时,我仍然是新手。最近,我开始自定义 emacs 作为我的 ruby 开发环境,并且我从
我希望 emacs 能够处理一些耗时的任务,而不阻塞输入。为此,我尝试了(其中插入的意思是用耗时的任务来代替) (call-process "emacs" nil 0 nil "--eval=(ins
我的 init.el 中有这个设置 (desktop-save-mode 1) 这很好用,只是我想知道: 如何更改它以将 .emacs.desktop 文件保存到 ~/.emacs.d 而不是 ~/
我是 Emacs 包的作者,偶尔在处理我的包时,我会遇到一个看起来很有用的函数并在我的代码中使用它。然后,在我发布后不久,有人使用旧的 Emacs 版本(但仍然是我想要支持的版本)会报告该功能未定
我用 (message "..some text...") 在我的 init 文件中,在 EMACS 加载时将消息发送到消息缓冲区。这是我查看我刚刚所做的更改导致启动崩溃的快速方法。 但是,我无法找到
简单的问题,我在 Emacs 中使用通用模式进行颜色编码。除了在这种语言中 " 和 ' 可以用来表示字符串之外,下面的代码很好用,如 'this is a string' 或 “这是一个字符串”。默认
有没有办法让我的 Emacs 以预定义的框架作为我附加的屏幕截图开始?我不太熟悉如何在我的 .emacs 脚本中执行此操作... 就这么简单: split-window-horizontally(
在emacs markdown-mode写markdown时,我想让electric-pair-mode自动关闭**bold**和 *italic*成对语法,即当输入一个 * 一秒时 * 应该自动出现
Emacs 是否有一个简单的原始缩进模式可以执行以下操作: 当我转到新行(按 Enter)时,复制上述行 用于缩进的任何空格 当我按 Tab 时,在我按 Tab 的地方插入可以配置的缩进字符(空格/制
我是一名优秀的程序员,十分优秀!