* C-x n s no longer works in outline mode
@ 2011-08-02 14:05 Leo
2011-08-05 16:24 ` Leo
2011-08-15 13:43 ` Bastien
0 siblings, 2 replies; 3+ messages in thread
From: Leo @ 2011-08-02 14:05 UTC (permalink / raw)
To: emacs-orgmode
I have been using this outside of org-mode for many years but it is
broken in 7.7.
Debugger entered--Lisp error: (error "Before first headline at position 134230 in buffer init")
signal(error ("Before first headline at position 134230 in buffer init"))
error("Before first headline at position %d in buffer %s" 134230 #<buffer init>)
byte-code("\300\301`p#\207" [error "Before first headline at position %d in buffer %s"] 4)
org-back-to-heading(t)
org-narrow-to-subtree()
call-interactively(org-narrow-to-subtree nil nil)
Leo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: C-x n s no longer works in outline mode
2011-08-02 14:05 C-x n s no longer works in outline mode Leo
@ 2011-08-05 16:24 ` Leo
2011-08-15 13:43 ` Bastien
1 sibling, 0 replies; 3+ messages in thread
From: Leo @ 2011-08-05 16:24 UTC (permalink / raw)
To: emacs-orgmode
Note:
Broken by commit http://orgmode.org/w/?p=org-mode.git;a=commitdiff;h=1e59039f8cf93830f930f7dc99117c41586552e9
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: C-x n s no longer works in outline mode
2011-08-02 14:05 C-x n s no longer works in outline mode Leo
2011-08-05 16:24 ` Leo
@ 2011-08-15 13:43 ` Bastien
1 sibling, 0 replies; 3+ messages in thread
From: Bastien @ 2011-08-15 13:43 UTC (permalink / raw)
To: Leo; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 735 bytes --]
Hi Leo,
Leo <sdl.web@gmail.com> 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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: outline.el.patch --]
[-- Type: text/x-patch, Size: 951 bytes --]
--- 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)
[-- Attachment #3: Type: text/plain, Size: 14 bytes --]
--
Bastien
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-08-15 13:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-02 14:05 C-x n s no longer works in outline mode Leo
2011-08-05 16:24 ` Leo
2011-08-15 13:43 ` Bastien
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.