[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/coterm e0a38cc 53/80: Add more documentation for auto c
From: |
ELPA Syncer |
Subject: |
[elpa] externals/coterm e0a38cc 53/80: Add more documentation for auto char mode |
Date: |
Wed, 13 Oct 2021 18:57:35 -0400 (EDT) |
branch: externals/coterm
commit e0a38cc7e491c66d5c8843ba889a90fc22126821
Author: m <>
Commit: m <>
Add more documentation for auto char mode
---
coterm.el | 35 ++++++++++++++++++++++++++++-------
1 file changed, 28 insertions(+), 7 deletions(-)
diff --git a/coterm.el b/coterm.el
index 49a54af..f91ebcd 100644
--- a/coterm.el
+++ b/coterm.el
@@ -184,7 +184,11 @@ If it is disabled, enable `coterm-auto-char-mode'."
(define-minor-mode coterm-auto-char-mode
"Whether we should enter or leave char mode automatically.
If enabled, `coterm-auto-char-functions' are consulted to set
-`coterm-char-mode' and `coterm-scroll-snap-mode' automatically."
+`coterm-char-mode' and `coterm-scroll-snap-mode' automatically.
+
+By default, functions in `coterm-auto-char-functions' try to
+guess which mode is appropriate based on various heuristics. See
+their doc strings for more information."
:lighter ""
(if coterm-auto-char-mode
(progn
@@ -232,6 +236,7 @@ If point is not on process mark, leave `coterm-char-mode'
and
(when coterm-scroll-snap-mode (coterm-scroll-snap-mode -1)))))
(defun coterm--auto-char-less-prompt ()
+ "Enter `coterm-char-mode' if a \"less\" prompt is detected."
(when (eobp)
(let ((opoint (point)))
(forward-line 0)
@@ -252,18 +257,28 @@ If point is not on process mark, leave `coterm-char-mode'
and
(goto-char opoint)))))
(defun coterm--auto-char-mpv-prompt ()
+ "Enter `coterm-char-mode' if a mpv prompt is detected.
+However, simply entering it isn't satisfactory, because mpv often
+erases its status prompt for brief periods of time before
+redrawing it again. Because we don't want to leave char mode for
+these brief periods, we temporarily modify
+`coterm-auto-char-functions' such that `coterm-char-mode' is kept
+active if these status prompt erasures are detected."
(when (coterm--auto-char-mpv-prompt-1)
- ;; (unless coterm-char-mode (coterm-char-mode 1))
- ;; (when coterm-scroll-snap-mode (coterm-scroll-snap-mode -1))
(coterm-char-mode 1)
(cl-labels
((hook ()
(or (coterm--auto-char-mpv-prompt-1)
+ ;; If we are on the last lane and this line is empty, it is
+ ;; likely because mpv has erased its status buffer for a brief
+ ;; period before redrawing it.
(and (eobp) (bolp))
(ignore (rem-hook))))
(rem-hook ()
(remove-hook 'coterm-auto-char-functions #'hook t)
- (remove-hook 'coterm-auto-char-mode-hook #'rem-hook t)))
+ (remove-hook 'coterm-auto-char-mode-hook #'rem-hook t)
+ (remove-hook 'coterm-char-mode-hook #'rem-hook t)
+ (remove-hook 'coterm-scroll-snap-mode-hook #'rem-hook t)))
(add-hook 'coterm-auto-char-functions #'hook nil t)
(add-hook 'coterm-auto-char-mode-hook #'rem-hook nil t)
(add-hook 'coterm-char-mode-hook #'rem-hook nil t)
@@ -288,9 +303,13 @@ If point is not on process mark, leave `coterm-char-mode'
and
(goto-char opoint)))))
(defun coterm--auto-char-not-eob ()
+ "Enter `coterm-char-mode' if a full-screen TUI program is detected.
+We assume that if the cursor moves more than 9 lines above the
+bottom row, a full-screen program is likely being drawn. In this
+case, enter `coterm-char-mode' and `coterm-scroll-snap-mode' and
+temporarily modify `coterm-auto-char-functions' such that we will
+only leave these modes once cursor moves to the bottom line."
(when (looking-at "\\(?:.*\n\\)\\{9,\\}")
- ;; (unless coterm-char-mode (coterm-char-mode 1))
- ;; (unless coterm-scroll-snap-mode (coterm-scroll-snap-mode 1))
(coterm-char-mode 1)
(coterm-scroll-snap-mode 1)
(cl-labels
@@ -299,7 +318,9 @@ If point is not on process mark, leave `coterm-char-mode'
and
(ignore (rem-hook))))
(rem-hook ()
(remove-hook 'coterm-auto-char-functions #'hook t)
- (remove-hook 'coterm-auto-char-mode-hook #'rem-hook t)))
+ (remove-hook 'coterm-auto-char-mode-hook #'rem-hook t)
+ (remove-hook 'coterm-char-mode-hook #'rem-hook t)
+ (remove-hook 'coterm-scroll-snap-mode-hook #'rem-hook t)))
(add-hook 'coterm-auto-char-functions #'hook nil t)
(add-hook 'coterm-auto-char-mode-hook #'rem-hook nil t)
(add-hook 'coterm-char-mode-hook #'rem-hook nil t)
- [elpa] externals/coterm 73aa1f3 31/80: Properly handle OSC and Emacs specific escape sequences, (continued)
- [elpa] externals/coterm 73aa1f3 31/80: Properly handle OSC and Emacs specific escape sequences, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm f4f69ab 32/80: Export TERMINFO environment variable, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm 654e286 49/80: Fix mistake in turning mode off, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm fd4041e 58/80: Remove redundant "(dirty)", ELPA Syncer, 2021/10/13
- [elpa] externals/coterm edfdbb7 50/80: Ignore sequences \e= end \e> (output by mpv), ELPA Syncer, 2021/10/13
- [elpa] externals/coterm e534194 60/80: Fix buffer-locality of saved scroll-margin, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm 952b917 52/80: Better indication of current char-mode status, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm bfcd5e4 63/80: Properly indicate that pmark is synchronized, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm 96a636e 64/80: Protect user input at EOB more accurately, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm bd7c681 73/80: Further document the "less" line-wrap workaround, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm e0a38cc 53/80: Add more documentation for auto char mode,
ELPA Syncer <=
- [elpa] externals/coterm 10205c8 66/80: Improve README, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm 7941200 61/80: Describe package, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm e268359 59/80: Account for home marker reposition when clearing screen, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm 8a5ffd9 68/80: Fix 'coterm--t-goto' for column zero, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm 11a9594 78/80: [auto-char] Detect prompts from "less -M", ELPA Syncer, 2021/10/13
- [elpa] externals/coterm 8ca9291 71/80: Minor fixes to description, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm 07a2570 69/80: Work around a line wrapping issue with "less", ELPA Syncer, 2021/10/13
- [elpa] externals/coterm 139e8d0 79/80: Fix for Emacs 27, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm 5aea1c8 25/80: Fixup some comments, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm f48ef18 26/80: Fix \e[M and \e[L outside scrolling region, ELPA Syncer, 2021/10/13