emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

outline.el


From: Juri Linkov
Subject: outline.el
Date: Mon, 26 Apr 2004 09:59:27 +0300
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

The main purpose of Outline mode is to represent the outline
structure in a compact way.  Currently, outline.el partly fails
at this by displaying useless empty lines between heading lines.
Empty lines are only useful to separate large blocks of text,
but in Outline mode, where they separate one-line heading lines,
empty lines simply waste space.

The following patch hides empty lines, and so lets outline.el
display twice more headings than now.

The first change hides empty lines except at the end of the buffer.
The second change doesn't show empty lines for headings.
The third change also fixes incorrect handling of empty lines for
outline editing functions outline-move-subtree-down and
outline-move-subtree-up.

Index: lisp/outline.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/outline.el,v
retrieving revision 1.5
diff -c -r1.5 outline.el
*** lisp/outline.el     21 Jan 2004 03:25:37 -0000      1.5
--- lisp/outline.el     26 Apr 2004 04:07:14 -0000
***************
*** 349,355 ****
    (if (re-search-forward (concat "\n\\(?:" outline-regexp "\\)")
                         nil 'move)
        (goto-char (match-beginning 0)))
!   (if (and (bolp) (not (bobp)))
        (forward-char -1)))
  
  (defun outline-next-heading ()
--- 349,355 ----
    (if (re-search-forward (concat "\n\\(?:" outline-regexp "\\)")
                         nil 'move)
        (goto-char (match-beginning 0)))
!   (if (and (bolp) (eobp) (not (bobp)))
        (forward-char -1)))
  
  (defun outline-next-heading ()
***************
*** 769,778 ****
  
  (defun outline-show-heading ()
    "Show the current heading and move to its end."
!   (outline-flag-region (- (point)
!                         (if (bobp) 0
!                           (if (eq (char-before (1- (point))) ?\n)
!                               2 1)))
                       (progn (outline-end-of-heading) (point))
                       nil))
  
--- 770,776 ----
  
  (defun outline-show-heading ()
    "Show the current heading and move to its end."
!   (outline-flag-region (- (point) (if (bobp) 0 1))
                       (progn (outline-end-of-heading) (point))
                       nil))
  
***************
*** 840,849 ****
      (if (bolp)
        (progn
          ;; Go to end of line before heading
!         (forward-char -1)
!         (if (bolp)
!             ;; leave blank line before heading
!             (forward-char -1))))))
  
  (defun show-branches ()
    "Show all subheadings of this heading, but not their bodies."
--- 838,844 ----
      (if (bolp)
        (progn
          ;; Go to end of line before heading
!         (forward-char -1)))))
  
  (defun show-branches ()
    "Show all subheadings of this heading, but not their bodies."

-- 
Juri Linkov
http://www.jurta.org/emacs/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]