-
Notifications
You must be signed in to change notification settings - Fork 2
/
inputrc.el
56 lines (50 loc) · 2.06 KB
/
inputrc.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
(defun read-inputrc-file (file)
(let ((expressions '()))
(flet ((collect-expression (expression)
(push expression expressions))
(collect-include (included-expressions)
(setf expressions (nreverse (revappend expressions
included-expressions)))))
(dolist (line (split-string (string-from-file-literally file) "\n"))
(let* ((sharp-pos (position (character "#") line))
(line (if sharp-pos
(subseq line 0 sharp-pos)
line))
(colon-pos (position (character ":") line)))
(if colon-pos
(let ((left (substring line 0 colon-pos))
(right (substring line (1+ colon-pos))))
(collect-expression `(alias
,(car (read-from-string left))
,(car (read-from-string right)))))
(let ((words (split-string line)))
(when words
(cond
((string= "$include" (first words))
(collect-include (ignore-errors
(read-inputrc-file (second words)))))
(t
(collect-expression (mapcar (lambda (string)
(car (read-from-string string)))
words)))))))))
(nreverse expressions))))
;; (insert (pp (read-inputrc-file "~/.inputrc")))
;; ((set editing-mode emacs)
;; (set meta-flag on)
;; (set convert-meta off)
;; (set input-meta on)
;; (set output-meta on)
;; (set bell-style visible)
;; (alias "[1~" beginning-of-line)
;; (alias "[3~" delete-char)
;; (alias "[4~" end-of-line)
;; (alias "" backward-kill-word)
;; (alias "[3~" kill-word)
;; (alias Meta-p "")
;; (alias Meta-n "")
;; (alias "p" "")
;; (alias "n" ""))
;;
;; (local-set-key "p" "")
;; (kbd 'Meta-p)"[Meta-p]"
;; "Meta-p"