diff options
| author | Lars Ingebrigtsen | 2019-07-27 14:18:27 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-07-27 14:18:27 +0200 |
| commit | 0154e83a38071fafd7b32f2c3b5e92d850a617e4 (patch) | |
| tree | bf223af9cf86650a609298600892116bd0b33ba9 | |
| parent | d4fce7394345233026e6b427d90e0debe6c3e89e (diff) | |
| download | emacs-0154e83a38071fafd7b32f2c3b5e92d850a617e4.tar.gz emacs-0154e83a38071fafd7b32f2c3b5e92d850a617e4.zip | |
Allow serial-term to take an optional argument for line-mode
* lisp/term.el (serial-term): Allow taking an optional argument to
avoid term-raw-mode (bug#24922).
* doc/lispref/processes.texi (Serial Ports): Document it.
| -rw-r--r-- | doc/lispref/processes.texi | 4 | ||||
| -rw-r--r-- | etc/NEWS | 4 | ||||
| -rw-r--r-- | lisp/term.el | 15 |
3 files changed, 19 insertions, 4 deletions
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index ebc31c597e6..7a696f7c3ea 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi | |||
| @@ -3038,7 +3038,7 @@ for a process object representing a serial port connection. | |||
| 3038 | 3038 | ||
| 3039 | Serial ports are available on GNU/Linux, Unix, and MS Windows systems. | 3039 | Serial ports are available on GNU/Linux, Unix, and MS Windows systems. |
| 3040 | 3040 | ||
| 3041 | @deffn Command serial-term port speed | 3041 | @deffn Command serial-term port speed &optional line-mode |
| 3042 | Start a terminal-emulator for a serial port in a new buffer. | 3042 | Start a terminal-emulator for a serial port in a new buffer. |
| 3043 | @var{port} is the name of the serial port to connect to. For | 3043 | @var{port} is the name of the serial port to connect to. For |
| 3044 | example, this could be @file{/dev/ttyS0} on Unix. On MS Windows, this | 3044 | example, this could be @file{/dev/ttyS0} on Unix. On MS Windows, this |
| @@ -3051,6 +3051,8 @@ Lisp strings). | |||
| 3051 | is a common value. The buffer is in Term mode; see @ref{Term Mode,,, | 3051 | is a common value. The buffer is in Term mode; see @ref{Term Mode,,, |
| 3052 | emacs, The GNU Emacs Manual}, for the commands to use in that buffer. | 3052 | emacs, The GNU Emacs Manual}, for the commands to use in that buffer. |
| 3053 | You can change the speed and the configuration in the mode line menu. | 3053 | You can change the speed and the configuration in the mode line menu. |
| 3054 | If @var{line-mode} is non-@code{nil}, @code{term-line-mode} is used; | ||
| 3055 | otherwise @code{term-raw-mode} is used. | ||
| 3054 | @end deffn | 3056 | @end deffn |
| 3055 | 3057 | ||
| 3056 | @defun make-serial-process &rest args | 3058 | @defun make-serial-process &rest args |
| @@ -830,6 +830,10 @@ be encrypted with GPG by adding an additional '.gpg' suffix. | |||
| 830 | --- | 830 | --- |
| 831 | *** 'term-read-noecho' is now obsolete, use 'read-passwd' instead. | 831 | *** 'term-read-noecho' is now obsolete, use 'read-passwd' instead. |
| 832 | 832 | ||
| 833 | +++ | ||
| 834 | *** `serial-term' now takes an optional parameter to leave the | ||
| 835 | emulator in line mode. | ||
| 836 | |||
| 833 | ** Flymake | 837 | ** Flymake |
| 834 | 838 | ||
| 835 | +++ | 839 | +++ |
diff --git a/lisp/term.el b/lisp/term.el index f3411044b25..b5f4c6225b5 100644 --- a/lisp/term.el +++ b/lisp/term.el | |||
| @@ -4395,18 +4395,26 @@ Try to be nice by providing useful defaults and history." | |||
| 4395 | x)) | 4395 | x)) |
| 4396 | 4396 | ||
| 4397 | ;;;###autoload | 4397 | ;;;###autoload |
| 4398 | (defun serial-term (port speed) | 4398 | (defun serial-term (port speed &optional line-mode) |
| 4399 | "Start a terminal-emulator for a serial port in a new buffer. | 4399 | "Start a terminal-emulator for a serial port in a new buffer. |
| 4400 | PORT is the path or name of the serial port. For example, this | 4400 | PORT is the path or name of the serial port. For example, this |
| 4401 | could be \"/dev/ttyS0\" on Unix. On Windows, this could be | 4401 | could be \"/dev/ttyS0\" on Unix. On Windows, this could be |
| 4402 | \"COM1\" or \"\\\\.\\COM10\". | 4402 | \"COM1\" or \"\\\\.\\COM10\". |
| 4403 | |||
| 4403 | SPEED is the speed of the serial port in bits per second. 9600 | 4404 | SPEED is the speed of the serial port in bits per second. 9600 |
| 4404 | is a common value. SPEED can be nil, see | 4405 | is a common value. SPEED can be nil, see |
| 4405 | `serial-process-configure' for details. | 4406 | `serial-process-configure' for details. |
| 4407 | |||
| 4408 | Usually `term-char-mode' is used, but if LINE-MODE (the prefix | ||
| 4409 | when used interactively) is non-nil, `term-line-mode' is used | ||
| 4410 | instead. | ||
| 4411 | |||
| 4406 | The buffer is in Term mode; see `term-mode' for the commands to | 4412 | The buffer is in Term mode; see `term-mode' for the commands to |
| 4407 | use in that buffer. | 4413 | use in that buffer. |
| 4414 | |||
| 4408 | \\<term-raw-map>Type \\[switch-to-buffer] to switch to another buffer." | 4415 | \\<term-raw-map>Type \\[switch-to-buffer] to switch to another buffer." |
| 4409 | (interactive (list (serial-read-name) (serial-read-speed))) | 4416 | (interactive (list (serial-read-name) (serial-read-speed) |
| 4417 | current-prefix-arg)) | ||
| 4410 | (serial-supported-or-barf) | 4418 | (serial-supported-or-barf) |
| 4411 | (let* ((process (make-serial-process | 4419 | (let* ((process (make-serial-process |
| 4412 | :port port | 4420 | :port port |
| @@ -4416,7 +4424,8 @@ use in that buffer. | |||
| 4416 | (buffer (process-buffer process))) | 4424 | (buffer (process-buffer process))) |
| 4417 | (with-current-buffer buffer | 4425 | (with-current-buffer buffer |
| 4418 | (term-mode) | 4426 | (term-mode) |
| 4419 | (term-char-mode) | 4427 | (unless line-mode |
| 4428 | (term-char-mode)) | ||
| 4420 | (goto-char (point-max)) | 4429 | (goto-char (point-max)) |
| 4421 | (set-marker (process-mark process) (point)) | 4430 | (set-marker (process-mark process) (point)) |
| 4422 | (set-process-filter process #'term-emulate-terminal) | 4431 | (set-process-filter process #'term-emulate-terminal) |