From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: [RFC] Repeat Heading movement commands Date: Sun, 29 Mar 2015 16:09:30 -0400 Message-ID: References: <87mw2vfu23.fsf@kmlap.domain.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113312ea76de6d051272f18f Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47160) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YcJWX-0002Uz-L4 for emacs-orgmode@gnu.org; Sun, 29 Mar 2015 16:09:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YcJWW-0001MM-8x for emacs-orgmode@gnu.org; Sun, 29 Mar 2015 16:09:33 -0400 Received: from mail-pd0-x234.google.com ([2607:f8b0:400e:c02::234]:33803) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YcJWW-0001M6-1C for emacs-orgmode@gnu.org; Sun, 29 Mar 2015 16:09:32 -0400 Received: by pdbni2 with SMTP id ni2so153580137pdb.1 for ; Sun, 29 Mar 2015 13:09:30 -0700 (PDT) In-Reply-To: <87mw2vfu23.fsf@kmlap.domain.org> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Kyle Meyer Cc: Org-mode , Jacob Gerlach --001a113312ea76de6d051272f18f Content-Type: text/plain; charset=UTF-8 This kind of repeated command seems to be a good application for hydra. On Sunday, March 29, 2015, Kyle Meyer wrote: > Jacob Gerlach > 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 --001a113312ea76de6d051272f18f Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable This kind of repeated command seems to be a good application for hydra.

On Sunday, March 29, 2015, Kyle Meyer <kyle@kyleam.com> wrote:
Jacob Gerlach <jacobgerlach@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<= br> > 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
>=C2=A0 (kbd "C-p")
>=C2=A0 (lambda (arg)
>=C2=A0 =C2=A0 (interactive "p")
>=C2=A0 =C2=A0 (if (not (eq last-command 'org-previous-visible-headi= ng))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 (previous-line arg)
>=C2=A0 =C2=A0 =C2=A0 (org-previous-visible-heading arg)
>=C2=A0 =C2=A0 =C2=A0 (setq this-command 'org-previous-visible-headi= ng))))
>
> 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=C2=A0
= Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon= University
Pittsburgh, PA 15213
412-268-7803

--001a113312ea76de6d051272f18f--