unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* how to tell what's in the fringe?  (lazy fringe)
@ 2009-06-18 18:30 Drew Adams
  2009-06-19  2:45 ` Miles Bader
  0 siblings, 1 reply; 9+ messages in thread
From: Drew Adams @ 2009-06-18 18:30 UTC (permalink / raw)
  To: emacs-devel

How can I tell (in Emacs-Lisp code) whether there is something other than blank
space somewhere in a given fringe (left or right)? Is that even feasible?

Use case -

I turned off fringe display as soon as it became available in Emacs. I've never
taken to it (ugh).

However, it seems that some things are now available _only_ in the fringe - see
bug #3550, for instance. That's not great design, IMO, but so be it.

So my thought was to code up some lazy fringe: a fringe that would not show,
except when there is some non-blank glyph in it. But I don't know how to test
whether that condition is satisfied (e.g. in Lisp).

Is that even logical? Perhaps if a fringe is not shown then its content is empty
or undefined? I was thinking in terms of it having content that is simply not
shown, but maybe that's incorrect.

Suggestions? Would this be a useful addition to Emacs? If so, would someone
else, who might be more familiar with fringe, like to implement it? ;-)





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

* Re: how to tell what's in the fringe?  (lazy fringe)
  2009-06-18 18:30 how to tell what's in the fringe? (lazy fringe) Drew Adams
@ 2009-06-19  2:45 ` Miles Bader
  2009-06-19 16:24   ` Drew Adams
  0 siblings, 1 reply; 9+ messages in thread
From: Miles Bader @ 2009-06-19  2:45 UTC (permalink / raw)
  To: Drew Adams; +Cc: emacs-devel

"Drew Adams" <drew.adams@oracle.com> writes:
> So my thought was to code up some lazy fringe: a fringe that would not show,
> except when there is some non-blank glyph in it. But I don't know how to test
> whether that condition is satisfied (e.g. in Lisp).
>
> Is that even logical? Perhaps if a fringe is not shown then its
> content is empty or undefined? I was thinking in terms of it having
> content that is simply not shown, but maybe that's incorrect.

Many of the fringe indicators are very dynamic, and only known in
relation to a particular redisplay.  Morever, the presence of the fringe
can change the physical dimensions of the area available for redisplay.

If there's a particular less-dynamic indicator you're interested in,
then perhaps it reflects a condition that can be tested for more easily
in lisp code.

-Miles

-- 
Inhumanity, n. One of the signal and characteristic qualities of humanity.




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

* RE: how to tell what's in the fringe?  (lazy fringe)
  2009-06-19  2:45 ` Miles Bader
@ 2009-06-19 16:24   ` Drew Adams
  2009-06-19 20:52     ` Miles Bader
  0 siblings, 1 reply; 9+ messages in thread
From: Drew Adams @ 2009-06-19 16:24 UTC (permalink / raw)
  To: 'Miles Bader'; +Cc: emacs-devel

> > So my thought was to code up some lazy fringe: a fringe 
> > that would not show, except when there is some non-blank
> > glyph in it. But I don't know how to test
> > whether that condition is satisfied (e.g. in Lisp).
> >
> > Is that even logical? Perhaps if a fringe is not shown then its
> > content is empty or undefined? I was thinking in terms of it having
> > content that is simply not shown, but maybe that's incorrect.
> 
> Many of the fringe indicators are very dynamic, and only known in
> relation to a particular redisplay.  Morever, the presence of 
> the fringe can change the physical dimensions of the area
> available for redisplay.
> 
> If there's a particular less-dynamic indicator you're interested in,
> then perhaps it reflects a condition that can be tested for 
> more easily in lisp code.

OK, thanks for the info. I probably won't bother with this, after all.

It occurred to me that it might be useful to have the fringe appear when it
contains something, but I think I'll continue to do without fringe. The idea was
to avoid wasting space if the fringe areas are completely empty (which they seem
to be much of the time). Simple idea, but perhaps not so simple to realize (?).

So far, the only real lack (from foregoing fringe) I'm aware of is the one
reported in bug #3550, but if additional UI feedback becomes available _only_ in
the fringe, then  perhaps I'll need to reconsider. That would be a shame, IMO,
but I'm probably a minority of one in not being a fan of fringe.





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

* Re: how to tell what's in the fringe?  (lazy fringe)
  2009-06-19 16:24   ` Drew Adams
@ 2009-06-19 20:52     ` Miles Bader
  2009-06-19 21:39       ` Drew Adams
  0 siblings, 1 reply; 9+ messages in thread
From: Miles Bader @ 2009-06-19 20:52 UTC (permalink / raw)
  To: emacs-devel

"Drew Adams" <drew.adams@oracle.com> writes:
> So far, the only real lack (from foregoing fringe) I'm aware of is the
> one reported in bug #3550, but if additional UI feedback becomes
> available _only_ in the fringe, then perhaps I'll need to
> reconsider. That would be a shame, IMO, but I'm probably a minority of
> one in not being a fan of fringe.

You're certainly not the only one (I don't mind it though).

I don't have any pre-20 emacs here to confirm, but my recollection is
that the old behavior was to actually reserve the final column on the
line for the line truncation/wrapping indicator -- i.e., there _was_ a
kind of fringe before, but only on the right side.

So to emulate the old-style behavior in the current emacs, you could set
the fringe-style to `right-only' (and if seeing the non-indicator fringe
annoys you, remove the background color attribute from the `fringe'
face).

-Miles

-- 
Insurrection, n. An unsuccessful revolution.





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

* RE: how to tell what's in the fringe?  (lazy fringe)
  2009-06-19 20:52     ` Miles Bader
@ 2009-06-19 21:39       ` Drew Adams
  2009-06-19 22:24         ` Miles Bader
  0 siblings, 1 reply; 9+ messages in thread
From: Drew Adams @ 2009-06-19 21:39 UTC (permalink / raw)
  To: 'Miles Bader', emacs-devel

> > So far, the only real lack (from foregoing fringe) I'm 
> > aware of is the one reported in bug #3550, but if
> > additional UI feedback becomes available _only_ in the
> > fringe, then perhaps I'll need to reconsider. That would
> > be a shame, IMO, but I'm probably a minority of
> > one in not being a fan of fringe.
> 
> You're certainly not the only one (I don't mind it though).
> 
> I don't have any pre-20 emacs

Pre-21. Emacs 20 uses $ for line truncation, not fringe.

> here to confirm, but my recollection is
> that the old behavior was to actually reserve the final column on the
> line for the line truncation/wrapping indicator -- i.e., there _was_ a
> kind of fringe before, but only on the right side.

No. The indicator, $, simply takes the place of the \ that is used normally for
wrapped lines. With or without truncation, without fringe the window right edge
is right up against the last displayed character of the line (which might be a
newline). When a line is truncated, one less character is displayed - it is
replaced by $.

> So to emulate the old-style behavior in the current emacs, 
> you could set the fringe-style to `right-only' (and if seeing the 
> non-indicator fringe annoys you, remove the background color
> attribute from the `fringe' face).

No, that's not the same, even ignoring the annoyance of a different background.
An extra column is needed for the fringe, regardless of whether any line is too
long.

Anyway, life without fringe is fine. Hopefully it will remain so - no user
feedback should _depend_ on users showing the fringe.

Typically, there is always an alternative way for users to get feedback: If they
turn off tooltip-mode, they can still see tooltips - in the echo area.
Relegating the line-truncation indicator to _only_ the fringe is a UI (design)
bug, IMO. I hope we do not continue that approach.





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

* Re: how to tell what's in the fringe?  (lazy fringe)
  2009-06-19 21:39       ` Drew Adams
@ 2009-06-19 22:24         ` Miles Bader
  2009-06-19 22:42           ` Drew Adams
  0 siblings, 1 reply; 9+ messages in thread
From: Miles Bader @ 2009-06-19 22:24 UTC (permalink / raw)
  To: emacs-devel

"Drew Adams" <drew.adams@oracle.com> writes:
>> I don't have any pre-20 emacs
>
> Pre-21. Emacs 20 uses $ for line truncation, not fringe.

Right.

>> here to confirm, but my recollection is that the old behavior was to
>> actually reserve the final column on the line for the line
>> truncation/wrapping indicator -- i.e., there _was_ a kind of fringe
>> before, but only on the right side.
>
> No. The indicator, $, simply takes the place of the \ that is used
> normally for wrapped lines. With or without truncation, without fringe
> the window right edge is right up against the last displayed character
> of the line (which might be a newline). When a line is truncated, one
> less character is displayed - it is replaced by $.

That is no different than current emacs with only a right fringe:

In emacs <21 (again, IIRC), the last column always contained either "$",
"\", or " " (representing a newline); you could not have lines with 80
"content" (non-newline) characters.  So you basically got 79 generally
usable columns, if your window was 80 columns wide.

In current emacs, you get precisely the same results if you set the
fringe style to `right-only', though the terminology has changed a bit:
The last "column" (the fringe) contains either a fringe indicator or
nothing, _but_ current emacs also allows the " " representing a newline
to displayed in the fringe.  So again, you get 79 generally usable
columns if your window is 80 columns wide.

Thus, despite the new concepts, the amount of usable space is the same,
when you use only the right fringe.

[many thanks to Kim for implementing the newline/cursor-in-the-fringe
feature BTW]

-miles

-- 
Rational, adj. Devoid of all delusions save those of observation, experience
and reflection.





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

* RE: how to tell what's in the fringe?  (lazy fringe)
  2009-06-19 22:24         ` Miles Bader
@ 2009-06-19 22:42           ` Drew Adams
  2009-06-19 23:29             ` Miles Bader
  0 siblings, 1 reply; 9+ messages in thread
From: Drew Adams @ 2009-06-19 22:42 UTC (permalink / raw)
  To: 'Miles Bader', emacs-devel

> In emacs <21 (again, IIRC), the last column always contained 
> either "$", "\", or " " (representing a newline); you could not
> have lines with 80 "content" (non-newline) characters.  So you
> basically got 79 generally usable columns, if your window was
> 80 columns wide.
> 
> In current emacs, you get precisely the same results if you set
> the fringe style to `right-only', though the terminology has
> changed a bit: The last "column" (the fringe) contains either a
> fringe indicator or nothing, _but_ current emacs also allows
> the " " representing a newline to displayed in the fringe.  So
> again, you get 79 generally usable columns if your window is 80
> columns wide.
> 
> Thus, despite the new concepts, the amount of usable space is 
> the same, when you use only the right fringe.

I see. In effect, with only right fringe, you trade a fringe indicator for the \
(or $, if truncated) that was used before. Thanks for the clear explanation.

Turning off the fringe background helps a bit, but I guess I still prefer the \
or $ to the bold arrows (curled or right) used for this in the fringe.

I don't use truncate much - I admit that $ is about as ugly as the fringe bold
right arrow. But \ is much better than the fringe arrow, IMO.





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

* Re: how to tell what's in the fringe?  (lazy fringe)
  2009-06-19 22:42           ` Drew Adams
@ 2009-06-19 23:29             ` Miles Bader
  2009-06-19 23:33               ` Drew Adams
  0 siblings, 1 reply; 9+ messages in thread
From: Miles Bader @ 2009-06-19 23:29 UTC (permalink / raw)
  To: emacs-devel

"Drew Adams" <drew.adams@oracle.com> writes:
> Turning off the fringe background helps a bit, but I guess I still prefer the \
> or $ to the bold arrows (curled or right) used for this in the fringe.
>
> I don't use truncate much - I admit that $ is about as ugly as the fringe bold
> right arrow. But \ is much better than the fringe arrow, IMO.

You can change the fringe glyphs too, using `define-fringe-bitmap'
(though there's no way to make it just use a font character AFAIK).

Here's what I use:

   (require 'fringe)

   (define-fringe-bitmap 'down-arrow [32 32 32 32 32 32 168 112 32] nil nil 'bottom)
   (define-fringe-bitmap 'up-arrow [32 112 168 32 32 32 32 32 32] nil nil 'top)
   (define-fringe-bitmap 'top-left-angle [254 254 128 128 128] nil nil 'top)
   (define-fringe-bitmap 'bottom-left-angle [128 128 128 254 254] nil  nil 'bottom)
   (define-fringe-bitmap 'left-bracket [254 254 128 128 128 0 0 0 0 128 128 128 254 254] nil nil 'center)

   (define-fringe-bitmap 'right-curly-arrow [96 16 8 8 72 80 96 120] nil nil 'bottom)
   (define-fringe-bitmap 'left-curly-arrow [8 16 16 16 18 10 6 30] nil nil 'top)

   ;; A sharper, more obviously arrow-like overlay arrow.
   ;; I admit this resembles something from a bad ms-windows debugger,
   ;; but at least it looks like an arrow rather than a blob (which is
   ;; what the default overlay-arrow looks like).
   (define-fringe-bitmap 'pointer-arrow [16 24 252 254 252 24 16] nil nil 'center
   )
   (setcdr (assq 'overlay-arrow fringe-indicator-alist) 'pointer-arrow)

   ;; Lighter-weight line-truncation indicators (my clever idea was to
   ;; use a dotted arrow-shaft to sort of add the flavor of an ellipses
   ;; to them).
   (define-fringe-bitmap 'right-arrow [4 2 169 2 4] nil 10 'center)
   (define-fringe-bitmap 'left-arrow [32 64 149 64 32] nil nil 'center)

   (setq-default indicate-buffer-boundaries 'left)


-Miles

-- 
People who are more than casually interested in computers should have at
least some idea of what the underlying hardware is like.  Otherwise the
programs they write will be pretty weird.  -- Donald Knuth





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

* RE: how to tell what's in the fringe?  (lazy fringe)
  2009-06-19 23:29             ` Miles Bader
@ 2009-06-19 23:33               ` Drew Adams
  0 siblings, 0 replies; 9+ messages in thread
From: Drew Adams @ 2009-06-19 23:33 UTC (permalink / raw)
  To: 'Miles Bader', emacs-devel

> You can change the fringe glyphs too, using `define-fringe-bitmap'
> (though there's no way to make it just use a font character AFAIK).
> Here's what I use:

Thanks. I'll take a look.





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

end of thread, other threads:[~2009-06-19 23:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-18 18:30 how to tell what's in the fringe? (lazy fringe) Drew Adams
2009-06-19  2:45 ` Miles Bader
2009-06-19 16:24   ` Drew Adams
2009-06-19 20:52     ` Miles Bader
2009-06-19 21:39       ` Drew Adams
2009-06-19 22:24         ` Miles Bader
2009-06-19 22:42           ` Drew Adams
2009-06-19 23:29             ` Miles Bader
2009-06-19 23:33               ` Drew Adams

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).