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.
This commit is contained in:
Lars Ingebrigtsen 2019-07-27 14:18:27 +02:00
parent d4fce73943
commit 0154e83a38
3 changed files with 19 additions and 4 deletions

View file

@ -3038,7 +3038,7 @@ for a process object representing a serial port connection.
Serial ports are available on GNU/Linux, Unix, and MS Windows systems.
@deffn Command serial-term port speed
@deffn Command serial-term port speed &optional line-mode
Start a terminal-emulator for a serial port in a new buffer.
@var{port} is the name of the serial port to connect to. For
example, this could be @file{/dev/ttyS0} on Unix. On MS Windows, this
@ -3051,6 +3051,8 @@ Lisp strings).
is a common value. The buffer is in Term mode; see @ref{Term Mode,,,
emacs, The GNU Emacs Manual}, for the commands to use in that buffer.
You can change the speed and the configuration in the mode line menu.
If @var{line-mode} is non-@code{nil}, @code{term-line-mode} is used;
otherwise @code{term-raw-mode} is used.
@end deffn
@defun make-serial-process &rest args

View file

@ -830,6 +830,10 @@ be encrypted with GPG by adding an additional '.gpg' suffix.
---
*** 'term-read-noecho' is now obsolete, use 'read-passwd' instead.
+++
*** `serial-term' now takes an optional parameter to leave the
emulator in line mode.
** Flymake
+++

View file

@ -4395,18 +4395,26 @@ Try to be nice by providing useful defaults and history."
x))
;;;###autoload
(defun serial-term (port speed)
(defun serial-term (port speed &optional line-mode)
"Start a terminal-emulator for a serial port in a new buffer.
PORT is the path or name of the serial port. For example, this
could be \"/dev/ttyS0\" on Unix. On Windows, this could be
\"COM1\" or \"\\\\.\\COM10\".
SPEED is the speed of the serial port in bits per second. 9600
is a common value. SPEED can be nil, see
`serial-process-configure' for details.
Usually `term-char-mode' is used, but if LINE-MODE (the prefix
when used interactively) is non-nil, `term-line-mode' is used
instead.
The buffer is in Term mode; see `term-mode' for the commands to
use in that buffer.
\\<term-raw-map>Type \\[switch-to-buffer] to switch to another buffer."
(interactive (list (serial-read-name) (serial-read-speed)))
(interactive (list (serial-read-name) (serial-read-speed)
current-prefix-arg))
(serial-supported-or-barf)
(let* ((process (make-serial-process
:port port
@ -4416,7 +4424,8 @@ use in that buffer.
(buffer (process-buffer process)))
(with-current-buffer buffer
(term-mode)
(term-char-mode)
(unless line-mode
(term-char-mode))
(goto-char (point-max))
(set-marker (process-mark process) (point))
(set-process-filter process #'term-emulate-terminal)