我想爲plink(putty)使用一個新的comint模式,我把代碼放在init.el中,但是如果Mx run-plink,i獲得如下錯誤:emacs中的新的comint mod for plink(putty):Symbol的函數定義是void
設*:Symbol的函數定義爲void:COMINT檢查進程內
;; path
(defvar plink-file-path "C:/Programme/Putty/plink.exe"
"Path to the program used by `run-plink'")
;; arguments
(defvar plink-arguments '()
"Commandline arguments to pass to `plink'")
;; prompt
(defvar plink-prompt-regexp "^>\s"
"Prompt for `run-plink'.")
;; Run-plink
(defun run-plink()
"Run an inferior instance of `plink.js' inside Emacs."
(interactive)
(setq plink-buffer "*Plink*")
(let* ((plink-program plink-file-path) (buffer (comint-check-proc "Plink")))
;; pop to the "*plink*" buffer if the process is dead, the
;; buffer is missing or it's got the wrong mode.
(pop-to-buffer-same-window
(if (or buffer (not (derived-mode-p 'plink-mode))
(comint-check-proc (current-buffer)))
(get-buffer-create (or buffer "*Plink*"))
(current-buffer)))
;; create the comint process if there is no buffer.
(unless buffer
(apply 'make-comint-in-buffer "Plink" buffer plink-program plink-arguments)
(plink-mode))))
;; plink-mode
(define-derived-mode plink-mode comint-mode "plink" nil "plink"
(setq comint-process-echoes t)
(setq comint-use-prompt-regexp t)
(setq comint-prompt-regexp plink-prompt-regexp)
; ">" read-only
(setq comint-prompt-read-only t)
(set (make-local-variable 'paragraph-separate) "..'")
(set (make-local-variable 'paragraph-start) plink-prompt-regexp))
你應該把它移動到一個單獨的文件中,嚴格保留'init.el'以滿足你的個人喜好。 Emacs手冊爲如何編寫模塊化代碼提供了一些額外的指導。開始在https://www.gnu.org/software/emacs/manual/html_node/eintr/Simple-Extension.html – tripleee
謝謝。我認爲,代碼運行時沒有單獨的文件。任何方式,我必須學習一些elisp。 –
當然,它可以被剝離,這只是一個重大的不便,你可能想避免。 – tripleee