emacs-orgmode
[Top][All Lists]
Advanced

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

[O] [RFC] Repeat Heading movement commands


From: Jacob Gerlach
Subject: [O] [RFC] Repeat Heading movement commands
Date: Sun, 29 Mar 2015 15:11:50 -0400

Hi List,

I often find myself wanting to move up by several headings:

C-c C-p, C-c C-p, C-c C-p...
(I don't usually know ahead of time how many I want to move, so I
can't use a numeric prefix arg)

I like how `set-mark-command' works with non-nil `set-mark-repeat-pop'
to avoid the need to repeat a prefix key and wanted to try something
similar for C-p. I came up with the following:

(define-key org-mode-map
 (kbd "C-p")
 (lambda (arg)
   (interactive "p")
   (if (not (eq last-command 'org-previous-visible-heading))
       (previous-line arg)
     (org-previous-visible-heading arg)
     (setq this-command 'org-previous-visible-heading))))

So now I can do:
C-c C-p, C-p, C-p...
And repeatedly move by headlines.

This (with a similar definition for C-n) is working well for me. If I
fleshed this out into a patch with a defcustom to control the
behavior, might it be applied? Or is this too far in the weeds of
individual user preference to warrant modifying org.el?

Thanks for any comments.

Regards,
Jake



reply via email to

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