Режим Plink comint в emacs: Только чтение текста и т.д.

я хочу использовать новый режим comint для plink(putty), я поместил код в init.el.

Но если M-x запустить-plink, я получил «Текст только для чтения» и «comint-send-input: текущий буфер не имеет процесса». Символ подсказки отсутствует, и я не могу ввести. Я просто хочу иметь новый режим comint для plink(putty).

Я новичок в emacs. Кто-нибудь может это увидеть?

(require '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))

person Felix Liu    schedule 23.08.2016    source источник


Ответы (1)


Это отлично работает:

(apply 'make-comint-in-buffer "Plink" buffer plink-program nil plink-arguments) 
person Felix Liu    schedule 13.09.2016