emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 0154e83: Allow serial-term to take an optional argu


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master 0154e83: Allow serial-term to take an optional argument for line-mode
Date: Sat, 27 Jul 2019 08:19:14 -0400 (EDT)

branch: master
commit 0154e83a38071fafd7b32f2c3b5e92d850a617e4
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    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.
---
 doc/lispref/processes.texi |  4 +++-
 etc/NEWS                   |  4 ++++
 lisp/term.el               | 15 ++++++++++++---
 3 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi
index ebc31c5..7a696f7 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 9d8b23b..d876c95 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 f341104..b5f4c62 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.
+
 \\<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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]