2013-04-24 15 views
1

我使用tabbar來定義文件組。 有些處於「Emacs緩衝區」組中,其他處於「Dired」組中,其他所有處於ATM的處於「用戶緩衝區」組中。將所有議程文件放在tabbar組中emacs

我想爲使用議程文件時添加另一個組 - 而不是讓所有文件都顯示在「用戶緩衝區」中,並拋棄我的選項卡視圖,我希望它們出現在指定位置小組稱爲「議程緩衝區」。 這怎麼能做到?

目前,這是我的配置:

(defun tabbar-buffer-groups() 
    "Return the list of group names the current buffer belongs to. 
This function is a custom function for tabbar-mode's tabbar-buffer-groups. 
This function group all buffers into 3 groups: 
Those Dired, those user buffer, and those emacs buffer. 
Emacs buffer are those starting with 「*」." 
    (list 
    (cond 
    ((string-equal "*" (substring (buffer-name) 0 1)) "Emacs Buffer") 
    ((eq major-mode 'dired-mode) "Dired") 
    ((eq major-mode 'sr-mode) "Dired") 
    (t "User Buffer") 
    ))) 

(setq tabbar-buffer-groups-function 'tabbar-buffer-groups) 
+0

什麼是議程文件? org文件,'* Org Agenda *'緩衝區? – 2013-04-24 12:23:37

+0

org-agenda-files列表中的所有文件。 – CrimsonKing 2013-04-24 12:47:44

+1

評論:更好地使用'(派生模式-p'直接模式)'而不是'(eq主模式'直接模式)''。 – Stefan 2013-04-24 13:40:30

回答

2

添加條件的功能如下:

(defun tabbar-buffer-groups() 
    "Return the list of group names the current buffer belongs to. 
This function is a custom function for tabbar-mode's tabbar-buffer-groups. 
This function group all buffers into 3 groups: 
Those Dired, those user buffer, and those emacs buffer. 
Emacs buffer are those starting with 「*」." 
    (list 
    (cond 
    ((string-equal "*" (substring (buffer-name) 0 1)) "Emacs Buffer") 
    ((member (buffer-file-name) (mapcar 'expand-file-name org-agenda-files)) "Agenda") 
    ((eq major-mode 'dired-mode) "Dired") 
    ((eq major-mode 'sr-mode) "Dired") 
    (t "User Buffer") 
    ))) 
+0

似乎沒有工作。打開Todo.org會在用戶緩衝區中打開它,或者使用議程視圖來解決這個問題。 – CrimsonKing 2013-04-24 13:36:30

+0

啊是的你必須從文件名中提取緩衝區名稱。嘗試新版本。 – 2013-04-24 13:38:26

+0

仍然不起作用:) – CrimsonKing 2013-04-24 14:01:41

相關問題