From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Speed commands Date: Sun, 15 Nov 2009 14:27:03 +0100 Message-ID: <0972299D-A2E7-47AC-B4A8-3E5A0C04D165@uva.nl> References: <87aayqfh8a.wl%ucecesf@ucl.ac.uk> <8D1991FE-E04A-41DF-8919-C72E4EA9AFF1@uva.nl> <4AFDB0AB.9040607@cs.tu-berlin.de> <78C217F4-D3EA-46BA-A237-CA0E54216D5E@uva.nl> <87eio14s0y.fsf@stats.ox.ac.uk> <87pr7k1p8t.fsf@stats.ox.ac.uk> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N9f8M-0006S1-Np for emacs-orgmode@gnu.org; Sun, 15 Nov 2009 08:27:14 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N9f8I-0006Qf-15 for emacs-orgmode@gnu.org; Sun, 15 Nov 2009 08:27:14 -0500 Received: from [199.232.76.173] (port=56250 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N9f8H-0006QZ-TL for emacs-orgmode@gnu.org; Sun, 15 Nov 2009 08:27:09 -0500 Received: from paard.ic.uva.nl ([145.18.40.182]:56455) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N9f8H-00006o-Cr for emacs-orgmode@gnu.org; Sun, 15 Nov 2009 08:27:09 -0500 In-Reply-To: <87pr7k1p8t.fsf@stats.ox.ac.uk> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Dan Davison Cc: Emacs-orgmode mailing list Hi Dan, these are nice, but somehow I find the "n" command logical and the "p" command confusing :-) - Carsten On Nov 15, 2009, at 3:44 AM, Dan Davison wrote: > Dan Davison writes: > >> Carsten Dominik writes: >> >> <...> >>> I am happy to have a discussion what additional >>> commands should be present by default. >> >> I thought a speed command for scrolling through an org document >> might be >> good -- move from heading to heading, displaying the next entry while >> keeping all others hidden, and close subtrees as you leave them. > > Here are simplified versions of the forward- and backward-scroll speed > commands that I'm suggesting. > > --------------------------------------------------------- > (defun ded/org-show-next-heading-tidily () > "Show next entry, keeping other entries closed." > (if (save-excursion (end-of-line) (outline-invisible-p)) > (progn (org-show-entry) (show-children)) > (outline-next-heading) > (unless (and (bolp) (org-on-heading-p)) > (org-up-heading-safe) > (hide-subtree) > (error "Boundary reached")) > (org-overview) > (org-reveal t) > (org-show-entry) > (show-children))) > > (defun ded/org-show-previous-heading-tidily () > "Show previous entry, keeping other entries closed." > (let ((pos (point))) > (outline-previous-heading) > (unless (and (< (point) pos) (bolp) (org-on-heading-p)) > (goto-char pos) > (hide-subtree) > (error "Boundary reached")) > (org-overview) > (org-reveal t) > (org-show-entry) > (show-children))) > > (setq org-use-speed-commands t) > (add-to-list 'org-speed-commands-user > '("n" ded/org-show-next-heading-tidily)) > (add-to-list 'org-speed-commands-user > '("p" ded/org-show-previous-heading-tidily)) > --------------------------------------------------------- > > Dan > >> Or is >> there already an org command that does something like this? > >> >> (Try starting with everything closed.) >> >> -------------------------------------------------------------- >> (defun ded/org-show-next-heading-tidily () >> "Show next entry, keeping other entries closed." >> (if (save-excursion (end-of-line) (outline-invisible-p)) >> (org-cycle) >> (let ((level (org-current-level))) >> (unless (org-heading-has-child-p) (org-cycle)) >> (outline-next-heading) >> (if (< (org-current-level) level) >> (save-excursion >> (outline-backward-same-level 1) >> (org-cycle))) >> (if (and (bolp) (org-on-heading-p)) >> (org-cycle) >> (outline-up-heading 1 t) >> (org-cycle) >> (error "Boundary reached"))))) >> >> (setq org-use-speed-commands t) >> (add-to-list 'org-speed-commands-user >> '("s" ded/org-show-next-heading-tidily)) >> -------------------------------------------------------------- >> >> ( might be quite natural for this one, it seems to get used >> for >> scrolling e.g. in dired and gnus) >> >> Dan >> >> >>> >>> - Carsten >>> >>> >>> _______________________________________________ >>> Emacs-orgmode mailing list >>> Remember: use `Reply All' to send replies to the list. >>> Emacs-orgmode@gnu.org >>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode >> >> >> _______________________________________________ >> Emacs-orgmode mailing list >> Remember: use `Reply All' to send replies to the list. >> Emacs-orgmode@gnu.org >> http://lists.gnu.org/mailman/listinfo/emacs-orgmode - Carsten