[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/focus 6040c744cc 02/82: Made custom search functions that
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/focus 6040c744cc 02/82: Made custom search functions that saves excursion |
Date: |
Tue, 6 Sep 2022 04:58:53 -0400 (EDT) |
branch: elpa/focus
commit 6040c744cc481b65254e3ef7c03d71496f9fb5a3
Author: Lars Tveito <larstvei@ifi.uio.no>
Commit: Lars Tveito <larstvei@ifi.uio.no>
Made custom search functions that saves excursion
---
focus-mode.el | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/focus-mode.el b/focus-mode.el
index 665aaaa375..963b6f4b75 100644
--- a/focus-mode.el
+++ b/focus-mode.el
@@ -1,6 +1,12 @@
(defvar-local focus-pre-overlay nil)
(defvar-local focus-post-overlay nil)
+(defun focus-search-backward (regex)
+ (save-excursion (re-search-backward regex nil t)))
+
+(defun focus-search-forward (regex)
+ (save-excursion (re-search-forward regex nil t)))
+
(defun focus-hexstr-to-int (str)
(read (concat "#x" (substring str 1))))
@@ -10,12 +16,10 @@
(format "#%X" avg)))
(defun focus-move-focus ()
- (save-excursion
- (let* ((pre (or (re-search-backward "^\n" nil t) 1))
- (post (1- (or (re-search-forward "^\n" nil t 2)
- (1+ (point-max))))))
- (move-overlay focus-pre-overlay (point-min) pre)
- (move-overlay focus-post-overlay post (point-max)))))
+ (let* ((pre (or (focus-search-backward "^\n") (point-min)))
+ (post (or (focus-search-forward "^\n") (point-max))))
+ (move-overlay focus-pre-overlay (point-min) pre)
+ (move-overlay focus-post-overlay post (point-max))))
;;;###autoload
(define-minor-mode focus-mode
- [nongnu] branch elpa/focus created (now 704db49988), ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus fbeecfc8ca 08/82: Added README, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 10b44de510 07/82: Docstring update, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 6040c744cc 02/82: Made custom search functions that saves excursion,
ELPA Syncer <=
- [nongnu] elpa/focus 4846438e3f 41/82: Merge branch 'read-only', ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 60f460b5be 28/82: Simplified installation, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 236c002b57 14/82: Tweaking sizes, trying max-with, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus ab42b87799 68/82: Fix buffer-local variables definition, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 9defce6158 10/82: Place the gif's side by side, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 03e3cbc566 05/82: Documented every function/variable, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 497d13d758 32/82: Added functions for jumping between things, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 307df45c69 51/82: Fix #5, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 3013760ef0 12/82: Resizing did not work, retry!, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus ff93c948da 26/82: Added defgroup, ELPA Syncer, 2022/09/06