Function: terminal-cease-edit

terminal-cease-edit is an interactive and byte-compiled function defined in terminal.el.gz.

Signature

(terminal-cease-edit)

Documentation

Finish editing message; switch back to Terminal proper.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/terminal.el.gz
(defun terminal-cease-edit ()
  "Finish editing message; switch back to Terminal proper."
  (interactive)

  ;;>> emulator will blow out if buffer isn't exactly te-width x te-height
  (let ((buffer-read-only nil))
    (widen)
    (let ((opoint (point-marker))
          (width te-width)
          (h (1- te-height)))
      (goto-char (point-min))
      (while (>= h 0)
        (let ((p (point)))
          (cond ((search-forward "\n" (+ p width) 'move)
                 (forward-char -1)
                 (insert-char ?\s (- width (- (point) p)))
                 (forward-char 1))
                ((eobp)
                 (insert-char ?\s (- width (- (point) p))))
                ((= (following-char) ?\n)
                 (forward-char 1))
                (t
                 (setq p (point))
                 (if (search-forward "\n" nil t)
                     (delete-region p (1- (point)))
                     (delete-region p (point-max))))))
        (if (= h 0)
            (if (not (eobp)) (delete-region (point) (point-max)))
            (if (eobp) (insert ?\n)))
        (setq h (1- h)))
      (goto-char opoint)
      (set-marker opoint nil nil)
      (setq te-saved-point (point))
      (setq te-redisplay-count 0)
      (setq te-more-count -1)))

  (setq mode-line-modified (default-value 'mode-line-modified))
  (use-local-map terminal-map)
  (setq major-mode 'terminal-mode)
  (setq mode-name "terminal")
  (setq mode-line-process '(":%s")))