From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: C-x n s no longer works in outline mode Date: Mon, 15 Aug 2011 15:43:50 +0200 Message-ID: <87wree3i3t.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:57446) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QsxRh-0006oW-Vk for emacs-orgmode@gnu.org; Mon, 15 Aug 2011 09:43:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QsxRh-0005kS-8e for emacs-orgmode@gnu.org; Mon, 15 Aug 2011 09:43:13 -0400 Received: from mail-wy0-f169.google.com ([74.125.82.169]:59685) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QsxRg-0005kM-Sy for emacs-orgmode@gnu.org; Mon, 15 Aug 2011 09:43:13 -0400 Received: by wyi11 with SMTP id 11so4084801wyi.0 for ; Mon, 15 Aug 2011 06:43:11 -0700 (PDT) In-Reply-To: (Leo's message of "Tue, 02 Aug 2011 22:05:13 +0800") 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: Leo Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Hi Leo, Leo writes: > I have been using this outside of org-mode for many years but it is > broken in 7.7. I suggest using this (new) outline function instead: #+begin_src emacs-lisp (defun outline-narrow-to-subtree () "Narrow buffer to the current subtree." (interactive) (save-excursion (save-match-data (narrow-to-region (progn (outline-back-to-heading t) (point)) (progn (outline-end-of-subtree) (if (and (outline-on-heading-p t) (not (eobp))) (backward-char 1)) (point)))))) #+end_src You can patch outline.el with the attached patch to bind this command to C-c @ C-s in outline-mode or outline-minor-mode. I will submit this patch to Emacs developers. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=outline.el.patch --- lisp/outline.el 2011-04-19 13:44:55 +0000 +++ lisp/outline.el 2011-08-15 13:41:50 +0000 @@ -83,6 +83,7 @@ (define-key map "\C-k" 'show-branches) (define-key map "\C-q" 'hide-sublevels) (define-key map "\C-o" 'hide-other) + (define-key map "\C-s" 'outline-narrow-to-subtree) (define-key map "\C-^" 'outline-move-subtree-up) (define-key map "\C-v" 'outline-move-subtree-down) (define-key map [(control ?<)] 'outline-promote) @@ -1116,6 +1117,18 @@ (insert "\n\n")))))) (kill-new (buffer-string))))))) +(defun outline-narrow-to-subtree () + "Narrow buffer to the current subtree." + (interactive) + (save-excursion + (save-match-data + (narrow-to-region + (progn (outline-back-to-heading t) (point)) + (progn (outline-end-of-subtree) + (if (and (outline-on-heading-p t) (not (eobp))) + (backward-char 1)) + (point)))))) + (provide 'outline) (provide 'noutline) --=-=-= Content-Type: text/plain -- Bastien --=-=-=--