[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/focus d1bd81ee4d 39/82: Added focus-read-only-mode
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/focus d1bd81ee4d 39/82: Added focus-read-only-mode |
Date: |
Tue, 6 Sep 2022 04:58:56 -0400 (EDT) |
branch: elpa/focus
commit d1bd81ee4dfc56471fcca677bdf6408aeaee07e0
Author: Lars Tveito <larstvei@ifi.uio.no>
Commit: Lars Tveito <larstvei@ifi.uio.no>
Added focus-read-only-mode
---
focus.el | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/focus.el b/focus.el
index 4a76846b41..e79aa47787 100644
--- a/focus.el
+++ b/focus.el
@@ -195,11 +195,37 @@ This is added to the `pre-command-hook' when
(setq focus-read-only-blink-timer
(run-at-time focus-read-only-blink-seconds nil
'focus-read-only-hide-cursor (current-buffer)))))
+
+(defun turn-off-focus-read-only-mode ()
+ "Turn off `focus-read-only-mode'."
+ (interactive)
+ (focus-read-only-mode -1))
+
;;;###autoload
(define-minor-mode focus-mode
"Dim the font color of text in surrounding sections."
:init-value nil
(if focus-mode (focus-init) (focus-terminate)))
+;;;###autoload
+(define-minor-mode focus-read-only-mode
+ "A read-only mode optimized for `focus-mode'."
+ :init-value nil
+ :keymap (let ((map (make-sparse-keymap)))
+ (define-key map (kbd "n") 'focus-next-thing)
+ (define-key map (kbd "SPC") 'focus-next-thing)
+ (define-key map (kbd "p") 'focus-prev-thing)
+ (define-key map (kbd "S-SPC") 'focus-prev-thing)
+ (define-key map (kbd "i") 'turn-off-focus-read-only-mode)
+ (define-key map (kbd "q") 'turn-off-focus-read-only-mode)
+ map)
+ (read-only-mode (if focus-read-only-mode 1 -1))
+ (when focus-read-only-blink-timer (cancel-timer focus-read-only-blink-timer))
+ (setq cursor-type (not focus-read-only-mode))
+ (setq focus-read-only-blink-timer nil)
+ (remove-hook 'pre-command-hook 'focus-read-only-cursor-blink t)
+ (when focus-read-only-mode
+ (add-hook 'pre-command-hook 'focus-read-only-cursor-blink nil t)))
+
(provide 'focus)
;;; focus.el ends here
- [nongnu] elpa/focus e691113e4b 03/82: Moved init/termination to separate functions, (continued)
- [nongnu] elpa/focus e691113e4b 03/82: Moved init/termination to separate functions, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 284a1240ce 33/82: Cleaned up doc in `focus-average-colors', ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 58a91b29aa 34/82: Split focus-bounds into two functions, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus ac711fe13a 35/82: Whitespace cleanup, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 35f3cf5d52 20/82: Use things as defined in thingatpt as bounds, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 871f3c60ce 48/82: Fixed matching parenthesis, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus fe94e0de69 43/82: Split activation/deactivation into functions, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 2fbf024c53 79/82: Fix bug introduced in d5631db, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 6add57b887 59/82: Fix indentation, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 563a3bd188 47/82: Updated README, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus d1bd81ee4d 39/82: Added focus-read-only-mode,
ELPA Syncer <=
- [nongnu] elpa/focus 4c8391ea32 29/82: Fixed bug in defgroup, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus b21341bd40 38/82: Added function for briefly showing the cursor, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 246eaeb8d1 72/82: Define faces for the unfocused and focused regions, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus b90cfb3c27 50/82: Fix #4, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus f590761dac 46/82: focus-read-only-mode calls for version bump, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 01a7a95334 27/82: Changed paragraph to section in README, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus cd2aad5590 31/82: Cleaned up focus-dimness docstring, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 5753e25fdf 30/82: fixed the focus-average-colors docstring, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus fee47bc7c9 11/82: Decrease the width of the gifs, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus abad47f1c4 53/82: Add functions to pin/unpin the focused section, ELPA Syncer, 2022/09/06