forked from 11111000000/pen.el
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pen-comint.el
35 lines (30 loc) · 1.09 KB
/
pen-comint.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
(require 'comint)
(define-key comint-mode-map (kbd "C-j") 'comint-accumulate)
(define-key comint-mode-map (kbd "C-a") 'comint-bol)
(define-key comint-mode-map (kbd "C-e") 'end-of-line)
(defun pen-comint-del ()
(interactive)
(cond
((derived-mode-p 'comint-mode) (let ((pos
(save-excursion-and-region-reliably
(comint-bol))))
(if (< pos (point))
(delete-backward-char 1))))
((and (derived-mode-p 'term-mode)
(minor-mode-enabled term-char-mode))
(let ((pos
(save-excursion-and-region-reliably
(comint-bol))))
(if (< pos (point))
(let ((pen-mode nil))
(execute-kbd-macro (kbd "C-h"))))))
((derived-mode-p 'term-mode)
;; (lambda () (interactive) (term-send-raw-string "?"))
(term-send-raw))
(t
(delete-backward-char 1)
;; (let ((pen-mode nil))
;; (execute-kbd-macro (kbd "C-h")))
)))
(define-key pen-map (kbd "DEL") 'pen-comint-del)
(provide 'pen-comint)