Function: ghostel-readonly-exit

ghostel-readonly-exit is an interactive and natively compiled function defined in ghostel.el.

Signature

(ghostel-readonly-exit)

Documentation

Exit copy or Emacs mode and return to the mode active before entry.

Key Bindings

ghostel-readonly-fast-exit-mode-map C-g ghostel-readonly-fast-exit-mode-map C-x C-q ghostel-readonly-fast-exit-mode-map q ghostel-readonly-mode-map C-x C-q

Source Code

;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel.el
(defun ghostel-readonly-exit ()
  "Exit copy or Emacs mode and return to the mode active before entry."
  (interactive)
  (setq quit-flag nil)
  (when (memq ghostel--input-mode '(copy emacs))
    (let ((target (or ghostel--pre-readonly-mode 'semi-char)))
      (setq ghostel--pre-readonly-mode nil)
      (if ghostel--readonly-exit-function
          (funcall ghostel--readonly-exit-function)
        (deactivate-mark)  ; A region left active would grow with point.
        ;; Return to the live viewport before reenabling terminal input.
        (goto-char (point-max))
        (setq ghostel--force-next-redraw t)
        (pcase target
          ('char  (ghostel-char-mode))
          ('emacs (ghostel-emacs-mode))
          (_      (ghostel-semi-char-mode)))
        (ghostel--adjust-size (selected-window) t)
        (ghostel--anchor-window nil t)
        (ghostel-force-redraw)))
    (message "Read-only mode exited")))