From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Teemu Likonen Newsgroups: gmane.emacs.bugs Subject: bug#1598: Please add easy key bindings for outline-(minor-)mode Date: Wed, 17 Dec 2008 11:57:14 +0200 Message-ID: <87hc53i0p1.fsf@iki.fi> Reply-To: Teemu Likonen , 1598@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1229509480 6698 80.91.229.12 (17 Dec 2008 10:24:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 17 Dec 2008 10:24:40 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Dec 17 11:25:44 2008 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LCtb5-0000c0-VW for geb-bug-gnu-emacs@m.gmane.org; Wed, 17 Dec 2008 11:25:44 +0100 Original-Received: from localhost ([127.0.0.1]:43432 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LCtZt-000236-Ih for geb-bug-gnu-emacs@m.gmane.org; Wed, 17 Dec 2008 05:24:29 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LCtZo-000231-4Z for bug-gnu-emacs@gnu.org; Wed, 17 Dec 2008 05:24:24 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LCtZm-00022Z-BU for bug-gnu-emacs@gnu.org; Wed, 17 Dec 2008 05:24:23 -0500 Original-Received: from [199.232.76.173] (port=60446 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LCtZm-00022T-47 for bug-gnu-emacs@gnu.org; Wed, 17 Dec 2008 05:24:22 -0500 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:56172) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LCtZl-0006B5-Ib for bug-gnu-emacs@gnu.org; Wed, 17 Dec 2008 05:24:21 -0500 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id mBHAOJBD029555; Wed, 17 Dec 2008 02:24:19 -0800 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id mBHA56su024679; Wed, 17 Dec 2008 02:05:06 -0800 X-Loop: don@donarmstrong.com Resent-From: Teemu Likonen Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Wed, 17 Dec 2008 10:05:06 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 1598 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by submit@emacsbugs.donarmstrong.com id=B.122950785222528 (code B ref -1); Wed, 17 Dec 2008 10:05:06 +0000 Original-Received: (at submit) by emacsbugs.donarmstrong.com; 17 Dec 2008 09:57:32 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id mBH9vSG0022522 for ; Wed, 17 Dec 2008 01:57:30 -0800 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LCt9k-00010J-9P for bug-gnu-emacs@gnu.org; Wed, 17 Dec 2008 04:57:28 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LCt9i-0000zW-6V for bug-gnu-emacs@gnu.org; Wed, 17 Dec 2008 04:57:27 -0500 Original-Received: from [199.232.76.173] (port=48707 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LCt9h-0000zR-NK for bug-gnu-emacs@gnu.org; Wed, 17 Dec 2008 04:57:25 -0500 Original-Received: from mta-out.inet.fi ([195.156.147.13]:40035 helo=kirsi1.inet.fi) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LCt9g-0000tw-Ao for bug-gnu-emacs@gnu.org; Wed, 17 Dec 2008 04:57:25 -0500 Original-Received: from mithlond.arda.local (80.220.180.181) by kirsi1.inet.fi (8.5.014) id 48FC5AC9029CAB84 for bug-gnu-emacs@gnu.org; Wed, 17 Dec 2008 11:57:15 +0200 Original-Received: from dtw by mithlond.arda.local with local (Exim 4.69) (envelope-from ) id 1LCt9W-0000yY-Je for bug-gnu-emacs@gnu.org; Wed, 17 Dec 2008 11:57:14 +0200 User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Wed, 17 Dec 2008 05:24:23 -0500 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:23316 Archived-At: --=-=-= This is a "wishlist" bug with an example code to solve the issue. The default key bindings for outline-mode and outline-minor-mode are difficult to remember and slow to use. I think the main reason is that there are way too many different key-bindings to operate with outlining. I suggest that you make keys like M- and M- to act modally so that they open and close one outline level at the time depending on which levels and bodies are currently visible. In addition to that, and to make outline navigating easy, M- and M- could move the cursor to previous and next visible outline header. I'll attach a code that I use. It works as I explained above. The code is partly written by me but it's based on a code on Emacs wiki page: http://www.emacswiki.org/emacs/OutlineMinorMode In the Emacs wiki the original code is titled "Explorer like Key-Bindings" and my modified version is "Variation of Explorer-like bindings". The latter is attached to this message). The code is licensed with the usual Emacs wiki license (see the bottom of the web page): This work is licensed to you under version 2 of the GNU General Public License. Alternatively, you may choose to receive this work under any other license that grants the right to use, copy, modify, and/or distribute the work, as long as that license imposes the restriction that derivative works have to grant the same rights and impose the same restriction. For example, you may choose to receive this work under the GNU Free Documentation License, the CreativeCommons ShareAlike License, the XEmacs manual license, or similar licenses. --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=outline-mode-easy-bindings.el Content-Transfer-Encoding: quoted-printable Content-Description: Outline-mode easy key-bindings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; outline-mode-easy-bindings.el ;; ;; Store this file as outline-mode-easy-bindings.el somewhere in your ;; load-path and add the following lines to your init file: ;; ;; (add-hook 'outline-mode-hook ;; '(lambda () ;; (require 'outline-mode-easy-bindings))) ;; ;; (add-hook 'outline-minor-mode-hook ;; '(lambda () ;; (require 'outline-mode-easy-bindings))) (defun outline-body-p () (save-excursion (outline-back-to-heading) (outline-end-of-heading) (and (not (eobp)) (progn (forward-char 1) (not (outline-on-heading-p)))))) (defun outline-body-visible-p () (save-excursion (outline-back-to-heading) (outline-end-of-heading) (not (outline-invisible-p)))) (defun outline-subheadings-p () (save-excursion (outline-back-to-heading) (let ((level (funcall outline-level))) (outline-next-heading) (and (not (eobp)) (< level (funcall outline-level)))))) (defun outline-subheadings-visible-p () (interactive) (save-excursion (outline-next-heading) (not (outline-invisible-p)))) (defun outline-do-close () (interactive) (when (outline-on-heading-p) (cond ((and (outline-body-p) (outline-body-visible-p)) (hide-entry) (hide-leaves)) (t (hide-subtree))))) (defun outline-do-open () (interactive) (when (outline-on-heading-p) (cond ((and (outline-subheadings-p) (not (outline-subheadings-visible-p))) (show-children 1)) ((and (not (outline-subheadings-p)) (not (outline-body-visible-p))) (show-subtree)) ((and (outline-body-p) (not (outline-body-visible-p))) (show-entry)) (t (show-subtree))))) (define-key outline-mode-map (kbd "M-") 'outline-do-close) (define-key outline-mode-map (kbd "M-") 'outline-do-open) (define-key outline-mode-map (kbd "M-") 'outline-previous-visible-headi= ng) (define-key outline-mode-map (kbd "M-") 'outline-next-visible-heading) (define-key outline-minor-mode-map (kbd "M-") 'outline-do-close) (define-key outline-minor-mode-map (kbd "M-") 'outline-do-open) (define-key outline-minor-mode-map (kbd "M-") 'outline-previous-visible= -heading) (define-key outline-minor-mode-map (kbd "M-") 'outline-next-visible-h= eading) (provide 'outline-mode-easy-bindings) --=-=-=--