emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/focus abad47f1c4 53/82: Add functions to pin/unpin the foc


From: ELPA Syncer
Subject: [nongnu] elpa/focus abad47f1c4 53/82: Add functions to pin/unpin the focused section
Date: Tue, 6 Sep 2022 04:58:57 -0400 (EDT)

branch: elpa/focus
commit abad47f1c40e595779c376a1e936c1609be1cdf4
Author: Lars Tveito <larstvei@ifi.uio.no>
Commit: Lars Tveito <larstvei@ifi.uio.no>

    Add functions to pin/unpin the focused section
---
 focus.el | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/focus.el b/focus.el
index e53d2b19dc..231b52f528 100644
--- a/focus.el
+++ b/focus.el
@@ -196,6 +196,21 @@ default is overwritten. This function simply helps set the
          (thing (completing-read "Thing: " candidates)))
     (setq focus-current-thing (intern thing))))
 
+(defun focus-pin ()
+  "Pin the focused section to its current location or the region,
+if active."
+  (interactive)
+  (when focus-mode
+    (when (region-active-p)
+      (focus-move-overlays (region-beginning) (region-end)))
+   (remove-hook 'post-command-hook 'focus-move-focus t)))
+
+(defun focus-unpin ()
+  "Unpin the focused section."
+  (interactive)
+  (when focus-mode
+    (add-hook 'post-command-hook 'focus-move-focus nil t)))
+
 (defun focus-next-thing (&optional n)
   "Moves the point to the middle of the Nth next thing."
   (interactive "p")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]