Re: [O] [RFC] Repeat Heading movement commands

2015-03-29 Thread Jacob Gerlach
On Sun, Mar 29, 2015 at 4:05 PM, Kyle Meyer k...@kyleam.com wrote:
 With org-use-speed-commands set to t, this could be C-c C-p p p.

Well, this is much better. Should have thought to check the info, of
course there's already something like this built in...

On Sun, Mar 29, 2015 at 4:09 PM, John Kitchin jkitc...@andrew.cmu.edu wrote:
 This kind of repeated command seems to be a good application for hydra.

I suppose I'll stick with speed commands for org-mode, but hydra looks
interesting.

Thanks for the tips.

Regards,
Jake



Re: [O] [RFC] Repeat Heading movement commands

2015-03-29 Thread Kyle Meyer
Jacob Gerlach jacobgerl...@gmail.com wrote:
 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.

With org-use-speed-commands set to t, this could be C-c C-p p p.

--
Kyle



Re: [O] [RFC] Repeat Heading movement commands

2015-03-29 Thread Kyle Meyer
John Kitchin jkitc...@andrew.cmu.edu wrote:
 This kind of repeated command seems to be a good application for
 hydra.

True.  Basic navigation could be set up with something like this:

#+begin_src elisp
  (defhydra hydra-org-navigation ()
Org navigation
(p org-previous-visible-heading previous heading)
(n org-next-visible-heading next heading)
(f org-forward-heading-same-level forward heading)
(b org-backward-heading-same-level backward heading)
(u outline-up-heading up heading)
(q nil cancel))
#+end_src

-- 
Kyle



Re: [O] [RFC] Repeat Heading movement commands

2015-03-29 Thread John Kitchin
This kind of repeated command seems to be a good application for hydra.

On Sunday, March 29, 2015, Kyle Meyer k...@kyleam.com wrote:

 Jacob Gerlach jacobgerl...@gmail.com javascript:; wrote:
  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.

 With org-use-speed-commands set to t, this could be C-c C-p p p.

 --
 Kyle



-- 
John

---
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu


Re: [O] [RFC] Repeat Heading movement commands

2015-03-29 Thread Suvayu Ali
On 29 March 2015 at 23:43, Xavier Maillard xav...@maillard.im wrote:

 John Kitchin jkitc...@andrew.cmu.edu writes:

 This kind of repeated command seems to be a good application for hydra.

 Excuse me if this is a FAQ but: what's hydra ?

https://github.com/abo-abo/hydra/

-- 
Suvayu

Open source is the future. It sets us free.



Re: [O] [RFC] Repeat Heading movement commands

2015-03-29 Thread Kyle Meyer
Xavier Maillard xav...@maillard.im wrote:
 John Kitchin jkitc...@andrew.cmu.edu writes:

 This kind of repeated command seems to be a good application for hydra.

 Excuse me if this is a FAQ but: what's hydra ?

Hydra [1] is a really nice package for creating keymaps that are similar
to keymaps under a prefix key.  Hydra has lots of little features, but
two main advantages of using a hydra over a standard prefix key are that
commands are repeatable with a single key and that a menu displays the
key/command information.  Have a look at hydra-examples.el [2] for some
use cases.

[1] https://github.com/abo-abo/hydra
[2] https://github.com/abo-abo/hydra/blob/master/hydra-examples.el

--
Kyle



Re: [O] [RFC] Repeat Heading movement commands

2015-03-29 Thread Xavier Maillard

John Kitchin jkitc...@andrew.cmu.edu writes:

 This kind of repeated command seems to be a good application for hydra.

Excuse me if this is a FAQ but: what's hydra ?

-- Xavier.