Recovering interrupter with occasional relapses, lover of spreadsheets, blogger, programmer, adept debugger, conjurer of analogies, and probably other things.
(defunjf/pulse(parg)"Pulse the current line.
If PARG (given as universal prefix), pulse between `point' and `mark'."(interactive"P")(if(carparg)(pulsar--pulsenilnil(point)(mark))(pulsar-pulse-line)))(global-set-key(kbd"C-x l")'jf/pulse)
The above function uses the pulsar.el package to create a visual "pulse" that temporarily highlights either the current line or the region between mark and point.
Point is analogue to the cursor. Mark is analogue to a "temporary" bookmark.
In the above code, the last line (e.g. (global-set-key...)) maps to C-x l (e.g. Ctrl+x then l) the jf/pulse function defined on lines 1 through 8.
By default, if I just type C-x l, I will "pulse" the current line. If I "prefix" the function call by first typing C-u (e.g. Ctrl+u) then type C-x l, I will pulse the region between mark and point.
The anatomy of the above is as follows:
Line 1: Name the function jf/pulse and one parameter parg (e.g. prefix arg).
Line 2 through 4: This is the doc string, it's available throughout emacs.
Line 5: This declares the function as interactive (I can call it from a menu). The "P" indicates that the above parg parameter is a prefix argument.
Line 6: If given the parg (e.g. I typed C-u C-x l)...
Line 7: ...then pulse the region between point and mark.
Line 8: ...else pulse the current line.
Line 9: Bind the jf/pulse to the C-x l key combination.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
The above function uses the pulsar.el package to create a visual "pulse" that temporarily highlights either the current line or the region between mark and point.
Point is analogue to the cursor. Mark is analogue to a "temporary" bookmark.
In the above code, the last line (e.g.
(global-set-key...
)) maps toC-x l
(e.g. Ctrl+x then l) thejf/pulse
function defined on lines 1 through 8.By default, if I just type
C-x l
, I will "pulse" the current line. If I "prefix" the function call by first typingC-u
(e.g. Ctrl+u) then typeC-x l
, I will pulse the region between mark and point.The anatomy of the above is as follows:
jf/pulse
and one parameterparg
(e.g. prefix arg).parg
parameter is a prefix argument.parg
(e.g. I typedC-u C-x l
)...jf/pulse
to theC-x l
key combination.