unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Another neat Eclipse'ism
@ 2008-06-19  7:58 Paul Michael Reilly
  2008-06-19  9:15 ` David Hansen
  0 siblings, 1 reply; 12+ messages in thread
From: Paul Michael Reilly @ 2008-06-19  7:58 UTC (permalink / raw)
  To: emacs-devel

While I try to do most of my editing from Emacs, occasionally I will 
find myself using the Eclipse Java editor.  One of the more convenient 
niceties, in the absence of auto-fill-mode, is having the print-margin 
displayed.  This is a useful feature in its own right, i.e. show a 1 
pixel background line in Emacs where the right margin is set.  Needless 
to say, I have not a clue how to implement it.

-pmr




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

* Re: Another neat Eclipse'ism
  2008-06-19  7:58 Another neat Eclipse'ism Paul Michael Reilly
@ 2008-06-19  9:15 ` David Hansen
  2008-06-19 15:27   ` Drew Adams
  2008-06-20 14:11   ` Paul Michael Reilly
  0 siblings, 2 replies; 12+ messages in thread
From: David Hansen @ 2008-06-19  9:15 UTC (permalink / raw)
  To: emacs-devel

On Thu, 19 Jun 2008 03:58:25 -0400 Paul Michael Reilly wrote:

> While I try to do most of my editing from Emacs, occasionally I will
> find myself using the Eclipse Java editor.  One of the more convenient
> niceties, in the absence of auto-fill-mode, is having the print-margin
> displayed.  This is a useful feature in its own right, i.e. show a 1
> pixel background line in Emacs where the right margin is set.
> Needless to say, I have not a clue how to implement it.

Not 100% the same but there is column-marker-mode available (search the
emacswiki).  It will highlight a given column iff the line is at least
that long.

David





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

* RE: Another neat Eclipse'ism
  2008-06-19  9:15 ` David Hansen
@ 2008-06-19 15:27   ` Drew Adams
  2008-06-20 14:11   ` Paul Michael Reilly
  1 sibling, 0 replies; 12+ messages in thread
From: Drew Adams @ 2008-06-19 15:27 UTC (permalink / raw)
  To: 'David Hansen', emacs-devel

> > While I try to do most of my editing from Emacs, occasionally I will
> > find myself using the Eclipse Java editor.  One of the more 
> > convenient niceties, in the absence of auto-fill-mode, is having the 
> > print-margin displayed.  This is a useful feature in its own right,
> > i.e. show a 1 pixel background line in Emacs where the right margin
> > is set. Needless to say, I have not a clue how to implement it.
> 
> Not 100% the same but there is column-marker-mode available 
> (search the emacswiki).  It will highlight a given column iff the line
> is at least that long.

Yes, see this page:
http://www.emacswiki.org/cgi-bin/wiki/HighlightCurrentColumn

It also links to other pages that deal with this.





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

* Re: Another neat Eclipse'ism
  2008-06-19  9:15 ` David Hansen
  2008-06-19 15:27   ` Drew Adams
@ 2008-06-20 14:11   ` Paul Michael Reilly
  2008-06-20 14:41     ` Stefan Monnier
  2008-06-20 16:44     ` Drew Adams
  1 sibling, 2 replies; 12+ messages in thread
From: Paul Michael Reilly @ 2008-06-20 14:11 UTC (permalink / raw)
  To: emacs-devel

David Hansen wrote:
> On Thu, 19 Jun 2008 03:58:25 -0400 Paul Michael Reilly wrote:
> 
>> While I try to do most of my editing from Emacs, occasionally I will
>> find myself using the Eclipse Java editor.  One of the more convenient
>> niceties, in the absence of auto-fill-mode, is having the print-margin
>> displayed.  This is a useful feature in its own right, i.e. show a 1
>> pixel background line in Emacs where the right margin is set.
>> Needless to say, I have not a clue how to implement it.
> 
> Not 100% the same but there is column-marker-mode available (search the
> emacswiki).  It will highlight a given column iff the line is at least
> that long.

FWIW, column-marker.el is pretty cool but it pales by comparison to the 
approach used in Eclipse.   The Eclipse solution is barely noticeable 
whereas the Emacs highlighting solution is very much in your face. If 
truth be told I like the merged notion of having multiple such column 
indicators that can be tailored by width and face.  I have a strong 
hunch they will need to be implemented at the C level.  I wonder how to 
do that ... and if this is an itch I want to scratch right about now ...

-pmr




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

* Re: Another neat Eclipse'ism
  2008-06-20 14:11   ` Paul Michael Reilly
@ 2008-06-20 14:41     ` Stefan Monnier
  2008-06-21 11:32       ` Paul Michael Reilly
  2008-06-20 16:44     ` Drew Adams
  1 sibling, 1 reply; 12+ messages in thread
From: Stefan Monnier @ 2008-06-20 14:41 UTC (permalink / raw)
  To: Paul Michael Reilly; +Cc: emacs-devel

>>> While I try to do most of my editing from Emacs, occasionally I will
>>> find myself using the Eclipse Java editor.  One of the more convenient
>>> niceties, in the absence of auto-fill-mode, is having the print-margin
>>> displayed.  This is a useful feature in its own right, i.e. show a 1
>>> pixel background line in Emacs where the right margin is set.
>>> Needless to say, I have not a clue how to implement it.
>> Not 100% the same but there is column-marker-mode available (search the
>> emacswiki).  It will highlight a given column iff the line is at least
>> that long.
> FWIW, column-marker.el is pretty cool but it pales by comparison to the
> approach used in Eclipse.   The Eclipse solution is barely noticeable
> whereas the Emacs highlighting solution is very much in your face. If truth
> be told I like the merged notion of having multiple such column indicators
> that can be tailored by width and face.  I have a strong hunch they will
> need to be implemented at the C level.  I wonder how to do that ... and if
> this is an itch I want to scratch right about now ...

All the Elisp-level approaches are just hacks.  You might be able to get
reasonably far at the Elisp level, depending on your tolerance to pain.

But one question remains: for what is this meant?  If it's for
`fill-column', then there's a problem with variable-width fonts since
in that case fill-column has a variable pixel position.

Personally, I use a much simpler solution: I use my right window border
as "vertical column".  It has worked for as long as I remember (even
under xterm) and it saves screen real estate.


        Stefan




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

* RE: Another neat Eclipse'ism
  2008-06-20 14:11   ` Paul Michael Reilly
  2008-06-20 14:41     ` Stefan Monnier
@ 2008-06-20 16:44     ` Drew Adams
  2008-06-21 11:36       ` Paul Michael Reilly
  1 sibling, 1 reply; 12+ messages in thread
From: Drew Adams @ 2008-06-20 16:44 UTC (permalink / raw)
  To: 'Paul Michael Reilly', emacs-devel

> > On Thu, 19 Jun 2008 03:58:25 -0400 Paul Michael Reilly wrote:
> > 
> >> While I try to do most of my editing from Emacs, 
> occasionally I will
> >> find myself using the Eclipse Java editor.  One of the 
> more convenient
> >> niceties, in the absence of auto-fill-mode, is having the 
> print-margin
> >> displayed.  This is a useful feature in its own right, 
> i.e. show a 1
> >> pixel background line in Emacs where the right margin is set.
> >> Needless to say, I have not a clue how to implement it.
> > 
> > Not 100% the same but there is column-marker-mode available 
> (search the
> > emacswiki).  It will highlight a given column iff the line 
> is at least
> > that long.
> 
> FWIW, column-marker.el is pretty cool but it pales by 
> comparison to the approach used in Eclipse.   The Eclipse
> solution is barely noticeable whereas the Emacs highlighting
> solution is very much in your face.

Again:
http://www.emacswiki.org/cgi-bin/wiki/HighlightCurrentColumn

Some of the other aids are less in-your-face than col-highlight.el. Some are
"barely noticeable".





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

* Re: Another neat Eclipse'ism
  2008-06-20 14:41     ` Stefan Monnier
@ 2008-06-21 11:32       ` Paul Michael Reilly
  2008-06-21 11:44         ` Lennart Borgman (gmail)
  2008-06-21 18:22         ` Stefan Monnier
  0 siblings, 2 replies; 12+ messages in thread
From: Paul Michael Reilly @ 2008-06-21 11:32 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier wrote:
>>>> While I try to do most of my editing from Emacs, occasionally I will
>>>> find myself using the Eclipse Java editor.  One of the more convenient
>>>> niceties, in the absence of auto-fill-mode, is having the print-margin
>>>> displayed.  This is a useful feature in its own right, i.e. show a 1
>>>> pixel background line in Emacs where the right margin is set.
>>>> Needless to say, I have not a clue how to implement it.
>>> Not 100% the same but there is column-marker-mode available (search the
>>> emacswiki).  It will highlight a given column iff the line is at least
>>> that long.
>> FWIW, column-marker.el is pretty cool but it pales by comparison to the
>> approach used in Eclipse.   The Eclipse solution is barely noticeable
>> whereas the Emacs highlighting solution is very much in your face. If truth
>> be told I like the merged notion of having multiple such column indicators
>> that can be tailored by width and face.  I have a strong hunch they will
>> need to be implemented at the C level.  I wonder how to do that ... and if
>> this is an itch I want to scratch right about now ...
> 
> All the Elisp-level approaches are just hacks.  You might be able to get
> reasonably far at the Elisp level, depending on your tolerance to pain.
> 
> But one question remains: for what is this meant?  If it's for
> `fill-column', then there's a problem with variable-width fonts since
> in that case fill-column has a variable pixel position.

Good question and very good point.  And this is where I get kind of
stuck in moving any further.  The answer to the question, if it is
one, may ramble but I'll try.  And the point about variable width
fonts means that the solution is by necessity either limited to
fixed-width fonts (more likely) or fairly complex.

About six months ago I started a Java, Eclipse based, project inside a
very loose organization --- little or no standards and a lot of ugly
existing code to fix/enhance or otherwise grok.  I also started using
a pair of 1920x1200 resolution monitors.  My preference is to keep the
width of code lines around 80 characters so that if and when they are
ever printed they look reasonable and to minimize the need to scroll.
That put me in a minority of one.  Most of the existing code seemed to
have been written by people who felt that entire methods should
consist of a single line of code ... well a slight exaggeration but it
makes the point.  Fixing this code in Emacs is a piece of cake between
C-x = and auto fill mode but in Eclipse it was a pain until I
discovered the existence of the print margin facility.  When using
Eclipse it serves as a constant and gentle reminder (mostly because it
is only 1 pixel wide and does not alter the existing text) of where
the (mostly imaginary) boundary is.

Because of the large monitors I started to keep a full screen instance
of Emacs running split vertically.  It was doing this that keyed off
the desire to have that low intensity margin indication.  With such a
large amount of screen real estate it is "nice" to know where the
boundary is but hardly necessary.

Then I read about column-marker.el where it mentions that some
languages with fixed column constraints, like Fortran, still are used.
This is where multiple, variable (pixel) width, faceable column
indicators make even more sense.  But useful enough to want to start
hacking at the graphics level?  I've another hunch that the solution
is platform dependent.  Certainly toolkit dependent which makes it a
lot of work for not a lot of bang.  In Eclipse it is easier because of
SWT.  If a solution was doable in a day or so with not a lot of risk
about breaking other code it might be worth pursuing.  I'm guessing
this is not the case.

So in a nutshell, my interest is less associated with fill-column and 
more closely related to showing grid-lines in a table or print margins 
in wysiwyg editor.

I think the solution for variable width fonts has to be distance based
and not so much a particular column number, i.e. more complicated
already.

> Personally, I use a much simpler solution: I use my right window border
> as "vertical column".  It has worked for as long as I remember (even
> under xterm) and it saves screen real estate.

This has the consequence of either having text off screen or folded
with ugly fringe arrows.  Both are past my pain threshold.  But I'll
confess that at one point I did think of using this solution.  It
certainly does work.

Thanks,

-pmr





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

* Re: Another neat Eclipse'ism
  2008-06-20 16:44     ` Drew Adams
@ 2008-06-21 11:36       ` Paul Michael Reilly
  2008-06-21 12:32         ` Lennart Borgman (gmail)
  2008-06-21 16:03         ` Drew Adams
  0 siblings, 2 replies; 12+ messages in thread
From: Paul Michael Reilly @ 2008-06-21 11:36 UTC (permalink / raw)
  To: emacs-devel

Drew Adams wrote:
>>> On Thu, 19 Jun 2008 03:58:25 -0400 Paul Michael Reilly wrote:
>>>
>>>> While I try to do most of my editing from Emacs, 
>> occasionally I will
>>>> find myself using the Eclipse Java editor.  One of the 
>> more convenient
>>>> niceties, in the absence of auto-fill-mode, is having the 
>> print-margin
>>>> displayed.  This is a useful feature in its own right, 
>> i.e. show a 1
>>>> pixel background line in Emacs where the right margin is set.
>>>> Needless to say, I have not a clue how to implement it.
>>> Not 100% the same but there is column-marker-mode available 
>> (search the
>>> emacswiki).  It will highlight a given column iff the line 
>> is at least
>>> that long.
>> FWIW, column-marker.el is pretty cool but it pales by 
>> comparison to the approach used in Eclipse.   The Eclipse
>> solution is barely noticeable whereas the Emacs highlighting
>> solution is very much in your face.
> 
> Again:
> http://www.emacswiki.org/cgi-bin/wiki/HighlightCurrentColumn
> 
> Some of the other aids are less in-your-face than col-highlight.el. Some are
> "barely noticeable".

Agreed.  In particular, vline mode with a suitable face is a reasonable 
solution.

-pmr




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

* Re: Another neat Eclipse'ism
  2008-06-21 11:32       ` Paul Michael Reilly
@ 2008-06-21 11:44         ` Lennart Borgman (gmail)
  2008-06-21 18:22         ` Stefan Monnier
  1 sibling, 0 replies; 12+ messages in thread
From: Lennart Borgman (gmail) @ 2008-06-21 11:44 UTC (permalink / raw)
  To: Paul Michael Reilly; +Cc: Stefan Monnier, emacs-devel

Paul Michael Reilly wrote:
> a pair of 1920x1200 resolution monitors.  My preference is to keep the
> width of code lines around 80 characters so that if and when they are
> ever printed they look reasonable and to minimize the need to scroll.

Did you read

   http://www.emacswiki.org/cgi-bin/wiki/EightyColumnRule

Especially lineker.el at the bottom of the page might interest you. It 
will show which lines are too long (or gets too long) and it also lets 
you jump between them.




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

* Re: Another neat Eclipse'ism
  2008-06-21 11:36       ` Paul Michael Reilly
@ 2008-06-21 12:32         ` Lennart Borgman (gmail)
  2008-06-21 16:03         ` Drew Adams
  1 sibling, 0 replies; 12+ messages in thread
From: Lennart Borgman (gmail) @ 2008-06-21 12:32 UTC (permalink / raw)
  To: Paul Michael Reilly; +Cc: emacs-devel

Paul Michael Reilly wrote:
> Drew Adams wrote:
>>>> On Thu, 19 Jun 2008 03:58:25 -0400 Paul Michael Reilly wrote:
>>>>
>>>>> While I try to do most of my editing from Emacs, 
>>> occasionally I will
>>>>> find myself using the Eclipse Java editor.  One of the 
>>> more convenient
>>>>> niceties, in the absence of auto-fill-mode, is having the 
>>> print-margin
>>>>> displayed.  This is a useful feature in its own right, 
>>> i.e. show a 1
>>>>> pixel background line in Emacs where the right margin is set.
>>>>> Needless to say, I have not a clue how to implement it.
>>>> Not 100% the same but there is column-marker-mode available 
>>> (search the
>>>> emacswiki).  It will highlight a given column iff the line 
>>> is at least
>>>> that long.
>>> FWIW, column-marker.el is pretty cool but it pales by comparison to 
>>> the approach used in Eclipse.   The Eclipse
>>> solution is barely noticeable whereas the Emacs highlighting
>>> solution is very much in your face.
>>
>> Again:
>> http://www.emacswiki.org/cgi-bin/wiki/HighlightCurrentColumn
>>
>> Some of the other aids are less in-your-face than col-highlight.el. 
>> Some are
>> "barely noticeable".
> 
> Agreed.  In particular, vline mode with a suitable face is a reasonable 
> solution.


It looks very good IMO but unfortunately it sometimes hit bugs in Emacs 
display engine. See the Emacs Devel archives.




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

* RE: Another neat Eclipse'ism
  2008-06-21 11:36       ` Paul Michael Reilly
  2008-06-21 12:32         ` Lennart Borgman (gmail)
@ 2008-06-21 16:03         ` Drew Adams
  1 sibling, 0 replies; 12+ messages in thread
From: Drew Adams @ 2008-06-21 16:03 UTC (permalink / raw)
  To: 'Paul Michael Reilly', 'emacs-devel'

> > Again:
> > http://www.emacswiki.org/cgi-bin/wiki/HighlightCurrentColumn
> > 
> > Some of the other aids are less in-your-face than 
> > col-highlight.el. Some are "barely noticeable".
> 
> Agreed.  In particular, vline mode with a suitable face is a 
> reasonable solution.

1. col-highlight.el *uses* vline.el. (It used to use column-marker.el.)

What applies to the face for vline.el applies also to the face for
col-highlight.el. See option `col-highlight-vline-face-flag', which lets you
choose between `col-highlight-face' and `vline-face'.

2. FWIW, http://www.emacswiki.org/cgi-bin/wiki/ModeLinePosition is perhaps even
less noticeable. It highlights the column in the mode line when greater than
some limit.

BTW, a year ago, Richard asked that this be installed in Emacs, but I can't see
that it was. If it was, what is the user-definable column limit variable?

[2007-06-24: Thread "mode line: 1) indicate region size, if active; 2) highlight
column # if > limit".]

3. If you are trying to shorten particularly long lines in code, you might also
be interested in this:
http://www.emacswiki.org/cgi-bin/wiki/FindLongLines#goto-longest-line

This is particularly handy to use with Isearch. isearch+.el binds
`goto-longest-line' to `C-end': `C-s C-end C-end C-end...'
http://www.emacswiki.org/cgi-bin/wiki/IsearchPlus





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

* Re: Another neat Eclipse'ism
  2008-06-21 11:32       ` Paul Michael Reilly
  2008-06-21 11:44         ` Lennart Borgman (gmail)
@ 2008-06-21 18:22         ` Stefan Monnier
  1 sibling, 0 replies; 12+ messages in thread
From: Stefan Monnier @ 2008-06-21 18:22 UTC (permalink / raw)
  To: Paul Michael Reilly; +Cc: emacs-devel

> That put me in a minority of one.  Most of the existing code seemed to
> have been written by people who felt that entire methods should
> consist of a single line of code ... well a slight exaggeration but it
> makes the point.  Fixing this code in Emacs is a piece of cake between

Since the 80-columns rule has nothing to do with screen size but with
the human brain, maybe you can find some relevant software-engineering
principles (probably alongside cyclomatic complexity or something ;-).
It might allow you to make a stronger case.

>> Personally, I use a much simpler solution: I use my right window border
>> as "vertical column".  It has worked for as long as I remember (even
>> under xterm) and it saves screen real estate.

> This has the consequence of either having text off screen or folded
> with ugly fringe arrows.

That's OK: 99% of those cases need to be fixed, so I fix them.
The remaining cases where a long line is a better choice than the
alternatives are sufficiently rare that it's a non-issue.

> Both are past my pain threshold.

That's the intention: it compels you to fix the buggers.


        Stefan




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

end of thread, other threads:[~2008-06-21 18:22 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-19  7:58 Another neat Eclipse'ism Paul Michael Reilly
2008-06-19  9:15 ` David Hansen
2008-06-19 15:27   ` Drew Adams
2008-06-20 14:11   ` Paul Michael Reilly
2008-06-20 14:41     ` Stefan Monnier
2008-06-21 11:32       ` Paul Michael Reilly
2008-06-21 11:44         ` Lennart Borgman (gmail)
2008-06-21 18:22         ` Stefan Monnier
2008-06-20 16:44     ` Drew Adams
2008-06-21 11:36       ` Paul Michael Reilly
2008-06-21 12:32         ` Lennart Borgman (gmail)
2008-06-21 16:03         ` 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).