| 1 |
ulm |
1.1 |
--- teco.el
|
| 2 |
|
|
+++ teco.el
|
| 3 |
|
|
@@ -2213,9 +2213,11 @@
|
| 4 |
|
|
(define-key teco:command-keymap "/" 'teco:command-slash)
|
| 5 |
|
|
(define-key teco:command-keymap "*" 'teco:command-star)
|
| 6 |
|
|
|
| 7 |
|
|
-(defvar teco:command-escapes nil
|
| 8 |
|
|
- "Records where ESCs are, since they are represented in the command buffer
|
| 9 |
|
|
-by $.")
|
| 10 |
|
|
+(defvar teco:command-display-table
|
| 11 |
|
|
+ (let ((table (make-display-table)))
|
| 12 |
|
|
+ (aset table ?\e [?$])
|
| 13 |
|
|
+ table)
|
| 14 |
|
|
+ "Display table used while reading teco commands.")
|
| 15 |
|
|
|
| 16 |
|
|
(defun teco:copy-to-q-reg (char start end)
|
| 17 |
|
|
"Copy region into Teco q-reg REG.
|
| 18 |
|
|
@@ -2244,15 +2246,11 @@
|
| 19 |
|
|
|
| 20 |
|
|
(defun teco:read-command ()
|
| 21 |
|
|
"Read a teco command string from the user."
|
| 22 |
|
|
- (let* ((teco:command-escapes nil)
|
| 23 |
|
|
- (command (catch 'teco:command-quit
|
| 24 |
|
|
- (read-from-minibuffer teco:prompt nil
|
| 25 |
|
|
- teco:command-keymap))))
|
| 26 |
|
|
- (if command
|
| 27 |
|
|
- (while teco:command-escapes
|
| 28 |
|
|
- (aset command (car teco:command-escapes) ?\e)
|
| 29 |
|
|
- (setq teco:command-escapes (cdr teco:command-escapes))))
|
| 30 |
|
|
- command))
|
| 31 |
|
|
+ (minibuffer-with-setup-hook
|
| 32 |
|
|
+ (lambda ()
|
| 33 |
|
|
+ (setq buffer-display-table teco:command-display-table))
|
| 34 |
|
|
+ (catch 'teco:command-quit
|
| 35 |
|
|
+ (read-from-minibuffer teco:prompt nil teco:command-keymap))))
|
| 36 |
|
|
|
| 37 |
|
|
(defun teco:command-self-insert ()
|
| 38 |
|
|
(interactive)
|
| 39 |
|
|
@@ -2276,16 +2274,13 @@
|
| 40 |
|
|
(interactive)
|
| 41 |
|
|
;; Two ESCs in a row terminate the command string
|
| 42 |
|
|
(if (eq last-command 'teco:command-escape)
|
| 43 |
|
|
- (throw 'teco:command-quit (buffer-string)))
|
| 44 |
|
|
+ (throw 'teco:command-quit (minibuffer-contents-no-properties)))
|
| 45 |
|
|
(teco:command-insert-character last-command-char))
|
| 46 |
|
|
|
| 47 |
|
|
(defun teco:command-ctrl-u ()
|
| 48 |
|
|
(interactive)
|
| 49 |
|
|
;; delete the characters
|
| 50 |
|
|
(kill-line 0)
|
| 51 |
|
|
- ;; forget that they were ESCs
|
| 52 |
|
|
- (while (and teco:command-escapes (<= (point) (car teco:command-escapes)))
|
| 53 |
|
|
- (setq teco:command-escapes (cdr teco:command-escapes)))
|
| 54 |
|
|
;; decide whether to shrink the window
|
| 55 |
|
|
(while (let ((a (insert ?\n))
|
| 56 |
|
|
(b (pos-visible-in-window-p))
|
| 57 |
|
|
@@ -2297,9 +2292,6 @@
|
| 58 |
|
|
(interactive)
|
| 59 |
|
|
;; delete the character
|
| 60 |
|
|
(backward-delete-char 1)
|
| 61 |
|
|
- ;; forget that it was an ESC
|
| 62 |
|
|
- (if (and teco:command-escapes (= (1- (point)) (car teco:command-escapes)))
|
| 63 |
|
|
- (setq teco:command-escapes (cdr teco:command-escapes)))
|
| 64 |
|
|
;; decide whether to shrink the window
|
| 65 |
|
|
(insert ?\n)
|
| 66 |
|
|
(if (prog1 (pos-visible-in-window-p)
|
| 67 |
|
|
@@ -2362,9 +2354,6 @@
|
| 68 |
|
|
|
| 69 |
|
|
;; Insert a single command character
|
| 70 |
|
|
(defun teco:command-insert-character (c)
|
| 71 |
|
|
- (if (eq c ?\e)
|
| 72 |
|
|
- (setq teco:command-escapes (cons (1- (point)) teco:command-escapes)
|
| 73 |
|
|
- c ?$))
|
| 74 |
|
|
(insert c)
|
| 75 |
|
|
(if (not (pos-visible-in-window-p))
|
| 76 |
|
|
(enlarge-window 1)))
|