Flymake抱怨即使配置为不使用X,X也不可用

big*_*ose 2 emacs terminal syntax-checking flymake

在文本模式控制台Emacs会话中运行Flymake模式,如何告诉Flymake 在文本控制台中显示其消息而不是尝试与X通信?

Emacs 23运行在各种环境中,包括Debian和Ubuntu.

我已经flymake-gui-warnings-enabled开始了nil,但当我flymake-display-err-menu-for-current-line抱怨时:

X windows are not in use or not initialized
Run Code Online (Sandbox Code Playgroud)

对,我知道; Emacs在没有X的情况下运行SSH连接.这就是我禁用Flymake使用GUI的原因.我如何告诉Flymake 不要尝试使用GUI,而是说出它在Emacs窗口中要说些什么

Nou*_*him 5

我发现"工具提示"错误消息无论如何都很烦人,所以我在我的.emacs这个显示flymake迷你消息中的错误消息.这是我从某个地方下网的事情.它被称为flymake-cursor.el.信用属于第一个写它的人.您不需要特定于我用作flymake帮助器的Python工具的pyflake位.主要功能是show-fly-err-at-point允许您使用常规光标悬停在消息的突出显示行上.

;; License: Gnu Public License
;;
;; Additional functionality that makes flymake error messages appear
;; in the minibuffer when point is on a line containing a flymake
;; error. This saves having to mouse over the error, which is a
;    ; keyboard user's annoyance

;;flymake-ler(file line type text &optional full-file)
(defun show-fly-err-at-point ()
  "If the cursor is sitting on a flymake error, display the
message in the minibuffer"
  (interactive)
  (let ((line-no (line-number-at-pos)))
    (dolist (elem flymake-err-info)
      (if (eq (car elem) line-no)
      (let ((err (car (second elem))))
        (message "%s" (fly-pyflake-determine-message err)))))))

(defun fly-pyflake-determine-message (err)
  "pyflake is flakey if it has compile problems, this adjusts the
message to display, so there is one ;)"
  (cond ((not (or (eq major-mode 'Python) (eq major-mode 'python-mode) t)))
    ((null (flymake-ler-file err))
     ;; normal message do your thing
     (flymake-ler-text err))
    (t ;; could not compile err
     (format "compile error, problem on line %s" (flymake-ler-line err)))))

(defadvice flymake-goto-next-error (after display-message activate compile)
  "Display the error in the mini-buffer rather than having to mouse over it"
  (show-fly-err-at-point))

(defadvice flymake-goto-prev-error (after display-message activate compile)
  "Display the error in the mini-buffer rather than having to mouse over it"
  (show-fly-err-at-point))

(defadvice flymake-mode (before post-command-stuff activate compile)
  "Add functionality to the post command hook so that if the
cursor is sitting on a flymake error the error information is
displayed in the minibuffer (rather than having to mouse over
it)"
  (set (make-local-variable 'post-command-hook)
       (cons 'show-fly-err-at-point post-command-hook))) 
Run Code Online (Sandbox Code Playgroud)