Completing read

自动补全功能在任何时候都是受欢迎的,Emacs提供了一个基本的函数completing-read,可以在接受用户输入时提供补全功能。除此之外,我们还可以使用一些更加强大的函数,比如ido里面的ido-completing-read,或者使用iswitchb提供的功能。

使用ido-completing-read比较简单,参见psvn.el。而iswitchb并没有提供一个类似的函数,所以必须自己写一个。

(defun wl-completing-read (prompt choices dummy require-match)
  "Use iswitchb completion functionality."
  (let ((iswitchb-make-buflist-hook
         (lambda ()
           (setq iswitchb-temp-buflist choices))))
    (iswitchb-read-buffer prompt nil require-match)))

(defvar wl-completing-read-function
  (if (fboundp 'iswitchb-read-buffer) 'wl-completing-read 'completing-read))

在引入wl-completing-read-function变量之后,要使用funcall来调用它,而不是直接进行函数调用。

(funcall wl-completing-read-function prompt choice nil t)

Customize agenda view of Org Mode

看了Randy Pausch的Time Management,感觉有必要改善自己使用Org Mode的方式,First thing first。我常用的任务状态有四个——TODO, STARTED, WAITING, DONE。日积月累,处于WAITING状态的任务已经达到7个之多,TODO夹在里面,很难分辨。最佳的解决方法是重新安排任务日期,使其不再出现在每天的任务列表里面。然而总有些东西挥之不去。

我的第一个解决方法是降低这些任务的优先级,然后设置排序算法,使优先级低的任务出现在不显眼的位置,对我来说,就是列表的底部。

(setq org-agenda-sorting-strategy
  '((agenda priority-down time-up)
    (todo priority-down category-keep)
    (tags priority-down category-keep)))

其次,让WAITING这几个字符低调一点,红彤彤的一大片,太惹眼了。

(setq org-todo-keyword-faces
      '(("WAITING" . (:foreground "gray" :weight bold))))

这下世界清静了。