Skip to content

Commit

Permalink
Simplify macro for "recenter" commands
Browse files Browse the repository at this point in the history
  • Loading branch information
protesilaos committed Jul 27, 2023
1 parent 4373dce commit c5086de
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions pulsar.el
Original file line number Diff line number Diff line change
Expand Up @@ -404,19 +404,18 @@ This is a buffer-local mode. Also check `pulsar-global-mode'."
;;;; Recentering commands

;;;###autoload
(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'."
(defmacro pulsar-define-recenter (place arg)
"Produce command to pulse and recenter at PLACE.
ARG has the same meaning as the one passed to `recenter'."
(declare (indent defun))
`(defun ,name ()
,(format "Reposition point at the %s of the window and pulse line." doc)
`(defun ,(intern (format "pulsar-recent-%s" place)) ()

This comment has been minimized.

Copy link
@ryankask

ryankask Aug 2, 2023

Is this supposed to be pulsar-recenter-%s instead of pulsar-recent-%s? That was the name of the old function.

If not, the docs should be updated where the function is referenced. For example, (add-hook 'consult-after-jump-hook #'pulsar-recent-top)

This comment has been minimized.

Copy link
@protesilaos

protesilaos Aug 2, 2023

Author Owner

Oh, that was a typo! Just pushed the change. Thank you!

,(format "Reposition point at the %s of the window and pulse line." place)
(interactive)
(recenter ,arg)
(pulsar-pulse-line)))

(pulsar-recenter pulsar-recenter-top "top" 0)
(pulsar-recenter pulsar-recenter-middle "center" nil)
(pulsar-define-recenter "top" 0)
(pulsar-define-recenter "center" nil)

;;;; Reveal contents of Org or Outline headings

Expand Down

0 comments on commit c5086de

Please sign in to comment.