瀏覽代碼

emacs.el: add function eshell-text-mode-toggle and major-mode eshell-text-mode

pull/1/head
10sr 10 年之前
父節點
當前提交
8967d3b6c6
共有 1 個檔案被更改,包括 26 行新增0 行删除
  1. +26
    -0
      emacs.el

+ 26
- 0
emacs.el 查看文件

@@ -1766,6 +1766,30 @@ Optional prefix ARG says how many lines to unflag; default is one line."

(lazy-load-eval 'eshell nil

(defvar eshell-text-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "C-x t") 'eshell-text-mode-toggle)
map))

(define-derived-mode eshell-text-mode text-mode
"Eshell-Text"
"Text-mode for Eshell."
nil)

(defun eshell-text-mode-toggle ()
"Toggle eshell-text-mode and eshell-mode."
(interactive)
(cond ((eq major-mode
'eshell-text-mode)
(goto-char (point-max))
(eshell-mode))
((eq major-mode
'eshell-mode)
(eshell-text-mode))
(t
(message "Not in eshell buffer")
nil)))

(defun my-eshell-backward-delete-char ()
(interactive)
(when (< (save-excursion
@@ -1981,6 +2005,8 @@ if arg given, use that eshell buffer, otherwise make new eshell buffer."
;; (interactive)
;; (eshell-goto-prompt)
;; (keyboard-quit)))
(define-key eshell-mode-map (kbd "C-x t")
'eshell-text-mode-toggle)
(define-key eshell-mode-map (kbd "C-u")
'eshell-kill-input)
(define-key eshell-mode-map (kbd "C-d")


Loading…
取消
儲存