unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* outline.el
@ 2004-04-26  6:59 Juri Linkov
  2004-04-29 18:56 ` outline.el Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Juri Linkov @ 2004-04-26  6:59 UTC (permalink / raw)


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))))))
  \f
  (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)))))
  \f
  (defun show-branches ()
    "Show all subheadings of this heading, but not their bodies."

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: outline.el
  2004-04-26  6:59 outline.el Juri Linkov
@ 2004-04-29 18:56 ` Stefan Monnier
  2004-04-30  0:44   ` outline.el Juri Linkov
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2004-04-29 18:56 UTC (permalink / raw)
  Cc: emacs-devel

> The main purpose of Outline mode is to represent the outline
> structure in a compact way.

I never thought of it in this way.  Instead I thought it was about
making the structure easier to see, understand, and navigate.

Conciseness is one part of the way to do that, but if it's too compact it
can make things harder to read.  The old code obviously didn't leave empty
lines visible by mistake: it had special purpose code to make those lines
visible.

I don't have a strong preference between the two, but I expect some people
will not like your new behavior (if for no other reason than habit).


        Stefan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: outline.el
  2004-04-29 18:56 ` outline.el Stefan Monnier
@ 2004-04-30  0:44   ` Juri Linkov
  0 siblings, 0 replies; 3+ messages in thread
From: Juri Linkov @ 2004-04-30  0:44 UTC (permalink / raw)
  Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> The main purpose of Outline mode is to represent the outline
>> structure in a compact way.
>
> I never thought of it in this way.  Instead I thought it was about
> making the structure easier to see, understand, and navigate.
>
> Conciseness is one part of the way to do that, but if it's too compact it
> can make things harder to read.  The old code obviously didn't leave empty
> lines visible by mistake: it had special purpose code to make those lines
> visible.
>
> I don't have a strong preference between the two, but I expect some people
> will not like your new behavior (if for no other reason than habit).

I am sure empty lines are too spacious for outline mode.  They can
improve readability only for large contiguous text blocks such as
paragraphs, but in outline mode every heading is a separate line,
and empty lines even decrease its usability, because twice less
structure is visible at a time on the screen.

And even other outline packages don't show empty lines, too.

However, I can add a variable that will allow to show newlines
in outline-mode.

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-04-30  0:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-26  6:59 outline.el Juri Linkov
2004-04-29 18:56 ` outline.el Stefan Monnier
2004-04-30  0:44   ` outline.el Juri Linkov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).