From: Lars Ingebrigtsen Date: Sat, 27 Jul 2019 12:18:27 +0000 (+0200) Subject: Allow serial-term to take an optional argument for line-mode X-Git-Tag: emacs-27.0.90~1817^2~76 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0154e83a38071fafd7b32f2c3b5e92d850a617e4;p=emacs.git 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. --- 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. 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 diff --git a/etc/NEWS b/etc/NEWS index 9d8b23b6b5b..d876c95e68c 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -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 +++ 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." 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. + \\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)