C/C++都使用h作为头文件后缀名,使得无法简单地在Emacs里面指定major-mode。使用magic-mode-alist可以减轻一点烦恼。以v8项目为例:
(add-to-list 'magic-mode-alist
'("// .* the v8 project" . c++-mode))
Emacs在打开文件时如果匹配到相应的正则表达式,就会使用c++-mode。
C/C++都使用h作为头文件后缀名,使得无法简单地在Emacs里面指定major-mode。使用magic-mode-alist可以减轻一点烦恼。以v8项目为例:
(add-to-list 'magic-mode-alist
'("// .* the v8 project" . c++-mode))
Emacs在打开文件时如果匹配到相应的正则表达式,就会使用c++-mode。
microblog的一个功能算告诉世界What are you doing?以下一段代码把正在计时的任务和刚刚完成的任务记录在identi.ca或者任何自己建立的laconi.ca上。
(defun wl-org-clock-in-update ()
(let ((current-heading (org-get-heading t))
(tags (org-get-tags-at)))
(when (member "@office" tags)
(with-current-buffer identica-buffer
(identica-update-status-if-not-blank "statuses" "update"
current-heading)))))
(add-hook 'org-clock-in-hook 'wl-org-clock-in-update)
(defun wl-org-todo-state-change-update ()
(let ((current-heading (org-get-heading t))
(tags (org-get-tags-at)))
(when (and (member "@office" tags)
(string-match "^(DONE|CANCELED|GOT) " current-heading))
(with-current-buffer identica-buffer
(identica-update-status-if-not-blank "statuses" "update"
(concat "#" current-heading))))))
(add-hook 'org-after-todo-state-change-hook 'wl-org-todo-state-change-update)
我在公司的机器上装了laconica,所以只在上面记录跟工作相关的内容,其中(member "@office" tags)保证只发送含有@office标签的任务。