diff options
| author | Stefan Monnier | 2009-12-04 04:39:21 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2009-12-04 04:39:21 +0000 |
| commit | b2bf5be549a3453e58f88a2c3009629e95f1b5bb (patch) | |
| tree | 75f3f02c854029a1dd1f45d98ecd1c4d70e70c80 | |
| parent | 7e6947958e0f2d1800fda5b4e9ffd403b9ee1187 (diff) | |
| download | emacs-b2bf5be549a3453e58f88a2c3009629e95f1b5bb.tar.gz emacs-b2bf5be549a3453e58f88a2c3009629e95f1b5bb.zip | |
Minor cleanup.
* term.el (term-send-raw, term-send-raw-meta): Use read-key-sequence's
key decoding rather than do it manually via last-input-event + ascii-character.
(term-exec): Use delete-and-extract-region.
(term-handle-ansi-terminal-messages): Remove unused var `end'.
(term-process-pager): Remove unused var `i'.
(term-dynamic-simple-complete): Make obsolete.
(serial-update-config-menu): Remove unused vars `y' and `str'.
(term-update-mode-line): Remove unused var `temp'.
| -rw-r--r-- | lisp/ChangeLog | 35 | ||||
| -rw-r--r-- | lisp/term.el | 60 |
2 files changed, 45 insertions, 50 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 870883cf1d4..ecc1b420c4c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,16 @@ | |||
| 1 | 2009-12-04 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | Minor cleanup. | ||
| 4 | * term.el (term-send-raw, term-send-raw-meta): Use read-key-sequence's | ||
| 5 | key decoding rather than do it manually via last-input-event + | ||
| 6 | ascii-character. | ||
| 7 | (term-exec): Use delete-and-extract-region. | ||
| 8 | (term-handle-ansi-terminal-messages): Remove unused var `end'. | ||
| 9 | (term-process-pager): Remove unused var `i'. | ||
| 10 | (term-dynamic-simple-complete): Make obsolete. | ||
| 11 | (serial-update-config-menu): Remove unused vars `y' and `str'. | ||
| 12 | (term-update-mode-line): Remove unused var `temp'. | ||
| 13 | |||
| 1 | 2009-12-03 Dan Nicolaescu <dann@ics.uci.edu> | 14 | 2009-12-03 Dan Nicolaescu <dann@ics.uci.edu> |
| 2 | 15 | ||
| 3 | Limit the number of log entries displayed by default. | 16 | Limit the number of log entries displayed by default. |
| @@ -11,14 +24,13 @@ | |||
| 11 | 24 | ||
| 12 | 2009-12-03 Alan Mackenzie <acm@muc.de> | 25 | 2009-12-03 Alan Mackenzie <acm@muc.de> |
| 13 | 26 | ||
| 14 | Enhance `c-parse-state' to run efficiently in "brace desserts". | 27 | Enhance `c-parse-state' to run efficiently in "brace desserts". |
| 15 | 28 | ||
| 16 | * progmodes/cc-mode.el (c-basic-common-init): Call | 29 | * progmodes/cc-mode.el (c-basic-common-init): |
| 17 | c-state-cache-init. | 30 | Call c-state-cache-init. |
| 18 | (c-neutralize-syntax-in-and-mark-CPP): Renamed from | 31 | (c-neutralize-syntax-in-and-mark-CPP): Rename from |
| 19 | c-extend-and-neutralize-syntax-in-CPP. Mark each CPP construct by | 32 | c-extend-and-neutralize-syntax-in-CPP. Mark each CPP construct by |
| 20 | placing `category' properties value 'c-cpp-delimiter at its | 33 | placing `category' properties value 'c-cpp-delimiter at its boundaries. |
| 21 | boundaries. | ||
| 22 | 34 | ||
| 23 | * progmodes/cc-langs.el (c-before-font-lock-function): | 35 | * progmodes/cc-langs.el (c-before-font-lock-function): |
| 24 | c-extend-and-neutralize-syntax-in-CPP has been renamed | 36 | c-extend-and-neutralize-syntax-in-CPP has been renamed |
| @@ -50,14 +62,13 @@ Enhance `c-parse-state' to run efficiently in "brace desserts". | |||
| 50 | (c-remove-stale-state-cache-backwards, c-state-cache-init) | 62 | (c-remove-stale-state-cache-backwards, c-state-cache-init) |
| 51 | (c-invalidate-state-cache-1, c-parse-state-1) | 63 | (c-invalidate-state-cache-1, c-parse-state-1) |
| 52 | (c-invalidate-state-cache): New defuns/defmacros/defsubsts. | 64 | (c-invalidate-state-cache): New defuns/defmacros/defsubsts. |
| 53 | (c-parse-state): Enhanced and refactored. | 65 | (c-parse-state): Enhance and refactor. |
| 54 | (c-debug-parse-state): Amended to deal with all the new variables. | 66 | (c-debug-parse-state): Amend to deal with all the new variables. |
| 55 | 67 | ||
| 56 | * progmodes/cc-defs.el (c-<-as-paren-syntax, c-mark-<-as-paren) | 68 | * progmodes/cc-defs.el (c-<-as-paren-syntax, c-mark-<-as-paren) |
| 57 | (c->-as-paren-syntax, c-mark->-as-paren, c-unmark-<->-as-paren): | 69 | (c->-as-paren-syntax, c-mark->-as-paren, c-unmark-<->-as-paren): |
| 58 | modify to use category text properties rather than syntax-table | 70 | modify to use category text properties rather than syntax-table ones. |
| 59 | ones. | 71 | (c-suppress-<->-as-parens, c-restore-<->-as-parens): New defsubsts |
| 60 | (c-suppress-<->-as-parens, c-restore-<->-as-parens): new defsubsts | ||
| 61 | to switch off/on the syntactic paren property of C++ template | 72 | to switch off/on the syntactic paren property of C++ template |
| 62 | delimiters using the category property. | 73 | delimiters using the category property. |
| 63 | (c-with-<->-as-parens-suppressed): Macro to invoke code with | 74 | (c-with-<->-as-parens-suppressed): Macro to invoke code with |
| @@ -65,7 +76,7 @@ Enhance `c-parse-state' to run efficiently in "brace desserts". | |||
| 65 | (c-cpp-delimiter, c-set-cpp-delimiters, c-clear-cpp-delimiters): | 76 | (c-cpp-delimiter, c-set-cpp-delimiters, c-clear-cpp-delimiters): |
| 66 | New constant/macros which apply category properties to the start | 77 | New constant/macros which apply category properties to the start |
| 67 | and end of preprocessor constructs. | 78 | and end of preprocessor constructs. |
| 68 | (c-comment-out-cpps, c-uncomment-out-cpps): defsubsts which | 79 | (c-comment-out-cpps, c-uncomment-out-cpps): Defsubsts which |
| 69 | "comment out" the syntactic value of characters in preprocessor | 80 | "comment out" the syntactic value of characters in preprocessor |
| 70 | constructs. | 81 | constructs. |
| 71 | (c-with-cpps-commented-out) | 82 | (c-with-cpps-commented-out) |
diff --git a/lisp/term.el b/lisp/term.el index 61dd3f415f0..f8bd58b4dd4 100644 --- a/lisp/term.el +++ b/lisp/term.el | |||
| @@ -1203,25 +1203,13 @@ Entry to this mode runs the hooks on `term-mode-hook'." | |||
| 1203 | "Send the last character typed through the terminal-emulator | 1203 | "Send the last character typed through the terminal-emulator |
| 1204 | without any interpretation." | 1204 | without any interpretation." |
| 1205 | (interactive) | 1205 | (interactive) |
| 1206 | ;; Convert `return' to C-m, etc. | 1206 | (let ((keys (this-command-keys))) |
| 1207 | (when (and (symbolp last-input-event) | 1207 | (term-send-raw-string (string (aref keys (1- (length keys))))))) |
| 1208 | (get last-input-event 'ascii-character)) | ||
| 1209 | (setq last-input-event (get last-input-event 'ascii-character))) | ||
| 1210 | (term-send-raw-string (make-string 1 last-input-event))) | ||
| 1211 | 1208 | ||
| 1212 | (defun term-send-raw-meta () | 1209 | (defun term-send-raw-meta () |
| 1213 | (interactive) | 1210 | (interactive) |
| 1214 | (let ((char last-input-event)) | 1211 | (let* ((keys (this-command-keys)) |
| 1215 | (when (symbolp last-input-event) | 1212 | (char (aref keys (1- (length keys))))) |
| 1216 | ;; Convert `return' to C-m, etc. | ||
| 1217 | (let ((tmp (get char 'event-symbol-elements))) | ||
| 1218 | (when tmp | ||
| 1219 | (setq char (car tmp))) | ||
| 1220 | (when (symbolp char) | ||
| 1221 | (setq tmp (get char 'ascii-character)) | ||
| 1222 | (when tmp | ||
| 1223 | (setq char tmp))))) | ||
| 1224 | (setq char (event-basic-type char)) | ||
| 1225 | (term-send-raw-string (if (and (numberp char) | 1213 | (term-send-raw-string (if (and (numberp char) |
| 1226 | (> char 127) | 1214 | (> char 127) |
| 1227 | (< char 256)) | 1215 | (< char 256)) |
| @@ -1303,7 +1291,6 @@ you type \\[term-send-input] which sends the current line to the inferior." | |||
| 1303 | (term-page (when (term-pager-enabled) " page")) | 1291 | (term-page (when (term-pager-enabled) " page")) |
| 1304 | (serial-item-speed) | 1292 | (serial-item-speed) |
| 1305 | (serial-item-config) | 1293 | (serial-item-config) |
| 1306 | (temp) | ||
| 1307 | (proc (get-buffer-process (current-buffer)))) | 1294 | (proc (get-buffer-process (current-buffer)))) |
| 1308 | (when (and (term-check-proc (current-buffer)) | 1295 | (when (and (term-check-proc (current-buffer)) |
| 1309 | (equal (process-type nil) 'serial)) | 1296 | (equal (process-type nil) 'serial)) |
| @@ -1375,7 +1362,7 @@ Blasts any old process running in the buffer. Doesn't set the buffer mode. | |||
| 1375 | You can use this to cheaply run a series of processes in the same term | 1362 | You can use this to cheaply run a series of processes in the same term |
| 1376 | buffer. The hook `term-exec-hook' is run after each exec." | 1363 | buffer. The hook `term-exec-hook' is run after each exec." |
| 1377 | (with-current-buffer buffer | 1364 | (with-current-buffer buffer |
| 1378 | (let ((proc (get-buffer-process buffer))) ; Blast any old process. | 1365 | (let ((proc (get-buffer-process buffer))) ; Blast any old process. |
| 1379 | (when proc (delete-process proc))) | 1366 | (when proc (delete-process proc))) |
| 1380 | ;; Crank up a new process | 1367 | ;; Crank up a new process |
| 1381 | (let ((proc (term-exec-1 name buffer command switches))) | 1368 | (let ((proc (term-exec-1 name buffer command switches))) |
| @@ -1387,20 +1374,19 @@ buffer. The hook `term-exec-hook' is run after each exec." | |||
| 1387 | (set-process-filter proc 'term-emulate-terminal) | 1374 | (set-process-filter proc 'term-emulate-terminal) |
| 1388 | (set-process-sentinel proc 'term-sentinel) | 1375 | (set-process-sentinel proc 'term-sentinel) |
| 1389 | ;; Feed it the startfile. | 1376 | ;; Feed it the startfile. |
| 1390 | (cond (startfile | 1377 | (when startfile |
| 1391 | ;;This is guaranteed to wait long enough | 1378 | ;;This is guaranteed to wait long enough |
| 1392 | ;;but has bad results if the term does not prompt at all | 1379 | ;;but has bad results if the term does not prompt at all |
| 1393 | ;; (while (= size (buffer-size)) | 1380 | ;; (while (= size (buffer-size)) |
| 1394 | ;; (sleep-for 1)) | 1381 | ;; (sleep-for 1)) |
| 1395 | ;;I hope 1 second is enough! | 1382 | ;;I hope 1 second is enough! |
| 1396 | (sleep-for 1) | 1383 | (sleep-for 1) |
| 1397 | (goto-char (point-max)) | 1384 | (goto-char (point-max)) |
| 1398 | (insert-file-contents startfile) | 1385 | (insert-file-contents startfile) |
| 1399 | (setq startfile (buffer-substring (point) (point-max))) | 1386 | (term-send-string |
| 1400 | (delete-region (point) (point-max)) | 1387 | proc (delete-and-extract-region (point) (point-max))))) |
| 1401 | (term-send-string proc startfile))) | ||
| 1402 | (run-hooks 'term-exec-hook) | 1388 | (run-hooks 'term-exec-hook) |
| 1403 | buffer))) | 1389 | buffer)) |
| 1404 | 1390 | ||
| 1405 | (defun term-sentinel (proc msg) | 1391 | (defun term-sentinel (proc msg) |
| 1406 | "Sentinel for term buffers. | 1392 | "Sentinel for term buffers. |
| @@ -2668,7 +2654,6 @@ See `term-prompt-regexp'." | |||
| 2668 | (while (string-match "\eAnSiT.+\n" message) | 2654 | (while (string-match "\eAnSiT.+\n" message) |
| 2669 | ;; Extract the command code and the argument. | 2655 | ;; Extract the command code and the argument. |
| 2670 | (let* ((start (match-beginning 0)) | 2656 | (let* ((start (match-beginning 0)) |
| 2671 | (end (match-end 0)) | ||
| 2672 | (command-code (aref message (+ start 6))) | 2657 | (command-code (aref message (+ start 6))) |
| 2673 | (argument | 2658 | (argument |
| 2674 | (save-match-data | 2659 | (save-match-data |
| @@ -3482,7 +3467,8 @@ The top-most line is line 0." | |||
| 3482 | (defun term-process-pager () | 3467 | (defun term-process-pager () |
| 3483 | (when (not term-pager-break-map) | 3468 | (when (not term-pager-break-map) |
| 3484 | (let* ((map (make-keymap)) | 3469 | (let* ((map (make-keymap)) |
| 3485 | (i 0) tmp) | 3470 | ;; (i 0) |
| 3471 | tmp) | ||
| 3486 | ;; (while (< i 128) | 3472 | ;; (while (< i 128) |
| 3487 | ;; (define-key map (make-string 1 i) 'term-send-raw) | 3473 | ;; (define-key map (make-string 1 i) 'term-send-raw) |
| 3488 | ;; (setq i (1+ i))) | 3474 | ;; (setq i (1+ i))) |
| @@ -3920,7 +3906,6 @@ This is a good place to put keybindings.") | |||
| 3920 | ;; term-dynamic-list-filename-completions List completions in help buffer. | 3906 | ;; term-dynamic-list-filename-completions List completions in help buffer. |
| 3921 | ;; term-replace-by-expanded-filename Expand and complete filename at point; | 3907 | ;; term-replace-by-expanded-filename Expand and complete filename at point; |
| 3922 | ;; replace with expanded/completed name. | 3908 | ;; replace with expanded/completed name. |
| 3923 | ;; term-dynamic-simple-complete Complete stub given candidates. | ||
| 3924 | 3909 | ||
| 3925 | ;; These are not installed in the term-mode keymap. But they are | 3910 | ;; These are not installed in the term-mode keymap. But they are |
| 3926 | ;; available for people who want them. Shell-mode installs them: | 3911 | ;; available for people who want them. Shell-mode installs them: |
| @@ -4129,6 +4114,7 @@ See also `term-dynamic-complete-filename'." | |||
| 4129 | (t | 4114 | (t |
| 4130 | (message "Partially completed") | 4115 | (message "Partially completed") |
| 4131 | 'partial))))))) | 4116 | 'partial))))))) |
| 4117 | (make-obsolete 'term-dynamic-simple-complete 'completion-in-region "23.2") | ||
| 4132 | 4118 | ||
| 4133 | 4119 | ||
| 4134 | (defun term-dynamic-list-filename-completions () | 4120 | (defun term-dynamic-list-filename-completions () |
| @@ -4434,9 +4420,7 @@ The return value may be nil for a special serial port." | |||
| 4434 | (defun serial-update-config-menu () | 4420 | (defun serial-update-config-menu () |
| 4435 | (setq serial-mode-line-config-menu (make-sparse-keymap "Configuration")) | 4421 | (setq serial-mode-line-config-menu (make-sparse-keymap "Configuration")) |
| 4436 | (let ((config (process-contact | 4422 | (let ((config (process-contact |
| 4437 | (get-buffer-process (current-buffer)) t)) | 4423 | (get-buffer-process (current-buffer)) t))) |
| 4438 | (y) | ||
| 4439 | (str)) | ||
| 4440 | (dolist (y '((:flowcontrol hw "Hardware flowcontrol (RTS/CTS)") | 4424 | (dolist (y '((:flowcontrol hw "Hardware flowcontrol (RTS/CTS)") |
| 4441 | (:flowcontrol sw "Software flowcontrol (XON/XOFF)") | 4425 | (:flowcontrol sw "Software flowcontrol (XON/XOFF)") |
| 4442 | (:flowcontrol nil "No flowcontrol") | 4426 | (:flowcontrol nil "No flowcontrol") |
| @@ -4537,7 +4521,7 @@ The return value may be nil for a special serial port." | |||
| 4537 | ;; For modes that use term-mode, term-dynamic-complete-functions is the | 4521 | ;; For modes that use term-mode, term-dynamic-complete-functions is the |
| 4538 | ;; hook to add completion functions to. Functions on this list should return | 4522 | ;; hook to add completion functions to. Functions on this list should return |
| 4539 | ;; non-nil if completion occurs (i.e., further completion should not occur). | 4523 | ;; non-nil if completion occurs (i.e., further completion should not occur). |
| 4540 | ;; You could use term-dynamic-simple-complete to do the bulk of the | 4524 | ;; You could use completion-in-region to do the bulk of the |
| 4541 | ;; completion job. | 4525 | ;; completion job. |
| 4542 | 4526 | ||
| 4543 | (provide 'term) | 4527 | (provide 'term) |