Function: serial-read-speed

serial-read-speed is a byte-compiled function defined in term.el.gz.

Signature

(serial-read-speed)

Documentation

Read a serial port speed (in bits per second) from the user.

Try to be nice by providing useful defaults and history.

Source Code

;; Defined in /usr/src/emacs/lisp/term.el.gz
(defun serial-read-speed ()
  "Read a serial port speed (in bits per second) from the user.
Try to be nice by providing useful defaults and history."
  (serial-supported-or-barf)
  (let* ((history serial-speed-history)
         (h (car history))
         (x (read-from-minibuffer
             (cond ((string= h serial-no-speed)
                    "Speed (default nil = set by port): ")
                   (h
                    (format-prompt "Speed" (format "%s b/s" h)))
                   (t "Speed (b/s): "))
             nil nil nil '(history . 1) nil nil)))
    (when (or (null x) (and (stringp x) (zerop (length x))))
      (setq x h))
    (when (or (null x) (not (stringp x)) (zerop (length x)))
      (error "Invalid speed"))
    (if (string= x serial-no-speed)
        (setq x nil)
      (setq x (string-to-number x))
      (when (or (null x) (not (integerp x)) (<= x 0))
        (error "Invalid speed")))
    (setq serial-speed-history history)
    x))