Function: ghostel-readonly-RET-or-exit-and-send
ghostel-readonly-RET-or-exit-and-send is an interactive and natively
compiled function defined in ghostel.el.
Signature
(ghostel-readonly-RET-or-exit-and-send)
Documentation
Open the link at point, or exit read-only mode and send RET.
Bound to RET / <return> in ghostel-readonly-fast-exit-mode-map
so RET behaves like other input keys when fast exit is on: a press
at a hyperlink opens the link and exits read-only mode, while a
press anywhere else exits and forwards a CR to the terminal.
Key Bindings
ghostel-readonly-fast-exit-mode-map <return> ghostel-readonly-fast-exit-mode-map RET
Source Code
;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel.el
(defun ghostel-readonly-RET-or-exit-and-send ()
"Open the link at point, or exit read-only mode and send RET.
Bound to RET / `<return>' in `ghostel-readonly-fast-exit-mode-map'
so RET behaves like other input keys when fast exit is on: a press
at a hyperlink opens the link and exits read-only mode, while a
press anywhere else exits and forwards a CR to the terminal."
(interactive)
(if-let* ((url (ghostel--uri-at-pos (point))))
;; Capture URL before exiting: `ghostel-readonly-exit' moves
;; point to `point-max', and opening a file:// or fileref:
;; link switches the current buffer.
(progn
(ghostel-readonly-exit)
(ghostel--open-link url))
(let ((target (or ghostel--pre-readonly-mode 'semi-char))
(custom-exit ghostel--readonly-exit-function))
(ghostel-readonly-exit)
(when (and ghostel--term (not custom-exit)
(memq target '(semi-char char)))
(ghostel--send-encoded "return" "")))))