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

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

[elpa] externals/pulsar a335e52505 03/28: Add commands to pulse+recenter


From: ELPA Syncer
Subject: [elpa] externals/pulsar a335e52505 03/28: Add commands to pulse+recenter
Date: Tue, 22 Mar 2022 06:58:01 -0400 (EDT)

branch: externals/pulsar
commit a335e525056c1f26f4bef65b0a236ba920de670f
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Add commands to pulse+recenter
---
 pulsar.el | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/pulsar.el b/pulsar.el
index 04711e1fd4..0f040ef508 100644
--- a/pulsar.el
+++ b/pulsar.el
@@ -237,5 +237,33 @@ sets up the aforementioned hook."
       (advice-add fn :after #'pulsar--add-hook))
     (add-hook 'pulsar-after-function-hook #'pulsar-pulse-line))))
 
+;;;; Recentering commands
+
+(defmacro pulsar-recenter (name doc arg)
+  "Produce command to pulse and recenter.
+The symbol is NAME, DOC for the doc string, and ARG is passed to
+`recenter'."
+  (declare (indent defun))
+  `(defun ,name ()
+     ,doc
+     (interactive)
+     (recenter ,arg)
+     (pulsar-pulse-line)))
+
+(pulsar-recenter
+  pulsar-recenter-top
+  "Reposition point at the top of the window and pulse line."
+  0)
+
+(pulsar-recenter
+  pulsar-recenter-bottom
+  "Reposition point at the bottom of the window and pulse line."
+  -1)
+
+(pulsar-recenter
+  pulsar-recenter-middle
+  "Reposition point at the center of the window and pulse line."
+  nil)
+
 (provide 'pulsar)
 ;;; pulsar.el ends here



reply via email to

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