2013-07-17 31 views
1

我想刪除編譯緩衝區時編譯完成Emacs字符串匹配「編譯完成」但失敗

以下是我的init-compile.el

(require 'compile) 

(defun notify-compilation-result(buffer msg) 
    (if (string-match "Compilation finished" msg) 
     (progn (delete-windows-on buffer))) 
    (setq current-frame (car (car (cdr (current-frame-configuration))))) 
    (select-frame-set-input-focus current-frame)) 

(add-to-list 'compilation-finish-functions 
      'notify-compilation-result) 

(provide 'init-compile) 

如何將普通字符串匹配嗎?

回答

0

這會有幫助嗎?

(cl-search "compilation finished" "whatever compilation finished whatever") 
9 
(cl-search "compilation finished" "compilation did not finish") 
nil 
+0

對不起,我不熟悉elisp。剛剛從http://www.emacswiki.org/emacs/CompileCommand獲取並修改了一個示例。但它沒有任何影響。 – goofansu

+0

嗯......你用那個代碼做了什麼呢? :)爲了記錄,從它的外觀來看,它會建議你將它保存在某個地方的init-compile.el文件中,Emacs可以找到它(eval'load-path'來查看所有可能的位置)Emacs將會尋找,你也可以在那裏添加更多的地點)。然後在'.emacs'文件中放入'(require'init-compile)',然後評估該表單,如果你需要這個表單的話。 – 2013-07-17 05:26:44

+0

我使用該函數來通知編譯結果。如果編譯成功,則關閉編譯緩衝區,否則什麼都不做。 – goofansu