unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [lurwas@moya.dnsalias.net: groff version 1.18.1 and emacs]
       [not found] <E18JXMq-0003vX-00@fencepost.gnu.org>
@ 2002-12-04 12:55 ` Werner LEMBERG
  2002-12-04 20:20   ` Stefan Monnier
  2002-12-06 13:31   ` Richard Stallman
  0 siblings, 2 replies; 16+ messages in thread
From: Werner LEMBERG @ 2002-12-04 12:55 UTC (permalink / raw)
  Cc: Ted.Harding, emacs-devel


> groff version 1.18.1 gives wrongly formatted man-pages, thus not
> letting emacs display escape sequences correctly. With earlier groff
> versions, it works. Setting '(Man-fontify-manpage-flag nil) in my
> .emacs file is a way around this problem, but it's kind of ugly.

IIRC, this has already been answered on the emacs-devel list.

The easiest way currently is to use `setenv' and set the environment
variable GROFF_NO_SGR to 1 (within Emacs) in case the man program
hasn't been configured already to not use SGR.  The proper way is to
make Emacs understand SGR escape sequences.


    Werner

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

* Re: [lurwas@moya.dnsalias.net: groff version 1.18.1 and emacs]
  2002-12-04 12:55 ` [lurwas@moya.dnsalias.net: groff version 1.18.1 and emacs] Werner LEMBERG
@ 2002-12-04 20:20   ` Stefan Monnier
  2002-12-05  9:47     ` Werner LEMBERG
  2002-12-06 13:31   ` Richard Stallman
  1 sibling, 1 reply; 16+ messages in thread
From: Stefan Monnier @ 2002-12-04 20:20 UTC (permalink / raw)
  Cc: rms, Ted.Harding, emacs-devel

> 
> > groff version 1.18.1 gives wrongly formatted man-pages, thus not
> > letting emacs display escape sequences correctly. With earlier groff
> > versions, it works. Setting '(Man-fontify-manpage-flag nil) in my
> > .emacs file is a way around this problem, but it's kind of ugly.
> 
> IIRC, this has already been answered on the emacs-devel list.
> 
> The easiest way currently is to use `setenv' and set the environment
> variable GROFF_NO_SGR to 1 (within Emacs) in case the man program
> hasn't been configured already to not use SGR.  The proper way is to
> make Emacs understand SGR escape sequences.

Why does nroff use SGR when outputting to Emacs ?
Does Emacs pass a TERM var that indicates that SGR codes are supported ?
If so, Emacs should be fixed, otherwise groff should be fixed.


	Stefan

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

* Re: [lurwas@moya.dnsalias.net: groff version 1.18.1 and emacs]
  2002-12-04 20:20   ` Stefan Monnier
@ 2002-12-05  9:47     ` Werner LEMBERG
  2002-12-06 13:32       ` Richard Stallman
  0 siblings, 1 reply; 16+ messages in thread
From: Werner LEMBERG @ 2002-12-05  9:47 UTC (permalink / raw)
  Cc: rms, Ted.Harding, emacs-devel

> > The easiest way currently is to use `setenv' and set the
> > environment variable GROFF_NO_SGR to 1 (within Emacs) in case the
> > man program hasn't been configured already to not use SGR.  The
> > proper way is to make Emacs understand SGR escape sequences.
> 
> Why does nroff use SGR when outputting to Emacs?

In newer versions of groff there is an option `-c' for nroff to not
use SGR.  This is not yet supported in Emacs.  But for this particular
problem it doesn't help since Emacs uses the `man' program for
formatting man pages.


    Werner

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

* Re: [lurwas@moya.dnsalias.net: groff version 1.18.1 and emacs]
  2002-12-04 12:55 ` [lurwas@moya.dnsalias.net: groff version 1.18.1 and emacs] Werner LEMBERG
  2002-12-04 20:20   ` Stefan Monnier
@ 2002-12-06 13:31   ` Richard Stallman
  2002-12-06 22:26     ` Werner LEMBERG
  1 sibling, 1 reply; 16+ messages in thread
From: Richard Stallman @ 2002-12-06 13:31 UTC (permalink / raw)
  Cc: Ted.Harding, emacs-devel

    The easiest way currently is to use `setenv' and set the environment
    variable GROFF_NO_SGR to 1 (within Emacs) in case the man program
    hasn't been configured already to not use SGR.

Can you write the code to do this?

Is the problem really that the man programs are misconfigured?

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

* Re: [lurwas@moya.dnsalias.net: groff version 1.18.1 and emacs]
  2002-12-05  9:47     ` Werner LEMBERG
@ 2002-12-06 13:32       ` Richard Stallman
  2002-12-06 22:19         ` Werner LEMBERG
  0 siblings, 1 reply; 16+ messages in thread
From: Richard Stallman @ 2002-12-06 13:32 UTC (permalink / raw)
  Cc: monnier+gnu/emacs, Ted.Harding, emacs-devel

    In newer versions of groff there is an option `-c' for nroff to not
    use SGR.  This is not yet supported in Emacs.  But for this particular
    problem it doesn't help since Emacs uses the `man' program for
    formatting man pages.

Should the `man' program pass `-c' to nroff?

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

* Re: [lurwas@moya.dnsalias.net: groff version 1.18.1 and emacs]
  2002-12-06 13:32       ` Richard Stallman
@ 2002-12-06 22:19         ` Werner LEMBERG
  2002-12-06 22:55           ` Stefan Monnier
       [not found]           ` <E18LCzH-0004Jz-00@fencepost.gnu.org>
  0 siblings, 2 replies; 16+ messages in thread
From: Werner LEMBERG @ 2002-12-06 22:19 UTC (permalink / raw)
  Cc: monnier+gnu/emacs, Ted.Harding, emacs-devel


>     In newer versions of groff there is an option `-c' for nroff to
>     not use SGR.  This is not yet supported in Emacs.  But for this
>     particular problem it doesn't help since Emacs uses the `man'
>     program for formatting man pages.
> 
> Should the `man' program pass `-c' to nroff?

I don't think so.  Making Emacs understand SGR is much better.


    Werner

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

* Re: [lurwas@moya.dnsalias.net: groff version 1.18.1 and emacs]
  2002-12-06 13:31   ` Richard Stallman
@ 2002-12-06 22:26     ` Werner LEMBERG
  2002-12-07  0:13       ` Alan Shutko
  2002-12-07 18:59       ` Eli Zaretskii
  0 siblings, 2 replies; 16+ messages in thread
From: Werner LEMBERG @ 2002-12-06 22:26 UTC (permalink / raw)
  Cc: Ted.Harding, emacs-devel


>     The easiest way currently is to use `setenv' and set the
>     environment variable GROFF_NO_SGR to 1 (within Emacs) in case
>     the man program hasn't been configured already to not use SGR.
> 
> Can you write the code to do this?

It should be straightforward to add

  (setenv "GROFF_NO_SGR" "1")

somewhere in man.el.  I don't know the right location...

> Is the problem really that the man programs are misconfigured?

Yes and no :-) I decided to make SGR the default output format of
groff's TTY output device starting with groff version 1.18 about six
months ago.  Not all tools understand SGR yet, so it will take some
time until everything has been updated.  Setting this environment
variable will always work regardless of the used version of man or
groff, so I think this is the easiest workaround within Emacs.


    Werner

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

* Re: [lurwas@moya.dnsalias.net: groff version 1.18.1 and emacs]
  2002-12-06 22:19         ` Werner LEMBERG
@ 2002-12-06 22:55           ` Stefan Monnier
  2002-12-07 15:58             ` Werner LEMBERG
       [not found]           ` <E18LCzH-0004Jz-00@fencepost.gnu.org>
  1 sibling, 1 reply; 16+ messages in thread
From: Stefan Monnier @ 2002-12-06 22:55 UTC (permalink / raw)
  Cc: rms, monnier+gnu/emacs, Ted.Harding, emacs-devel

> 
> >     In newer versions of groff there is an option `-c' for nroff to
> >     not use SGR.  This is not yet supported in Emacs.  But for this
> >     particular problem it doesn't help since Emacs uses the `man'
> >     program for formatting man pages.
> > 
> > Should the `man' program pass `-c' to nroff?
> 
> I don't think so.  Making Emacs understand SGR is much better.

I agree, but I also think that if TERM refers to a terminal that
does not understand SGR, then man or groff should notice it
and make sure that SGR codes are not generated.


	Stefan

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

* Re: [lurwas@moya.dnsalias.net: groff version 1.18.1 and emacs]
  2002-12-06 22:26     ` Werner LEMBERG
@ 2002-12-07  0:13       ` Alan Shutko
  2002-12-07 18:59       ` Eli Zaretskii
  1 sibling, 0 replies; 16+ messages in thread
From: Alan Shutko @ 2002-12-07  0:13 UTC (permalink / raw)
  Cc: rms, Ted.Harding, emacs-devel

Werner LEMBERG <wl@gnu.org> writes:

> It should be straightforward to add
>
>   (setenv "GROFF_NO_SGR" "1")

Something like

(let ((process-environment 
       (cons "GROFF_NO_SGR=1" process-environment)))

around the man call might be better.  If for some reason the user has
that variable set to something else within Emacs, you don't want to
overwrite it.

-- 
Alan Shutko <ats@acm.org> - In a variety of flavors!
"The dark man entered her, and he was cold." - The Stand

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

* Re: [lurwas@moya.dnsalias.net: groff version 1.18.1 and emacs]
  2002-12-06 22:55           ` Stefan Monnier
@ 2002-12-07 15:58             ` Werner LEMBERG
  2002-12-07 16:35               ` Alex Schroeder
  2002-12-09 16:12               ` Stefan Monnier
  0 siblings, 2 replies; 16+ messages in thread
From: Werner LEMBERG @ 2002-12-07 15:58 UTC (permalink / raw)
  Cc: emacs-devel

> > > Should the `man' program pass `-c' to nroff?
> > 
> > I don't think so.  Making Emacs understand SGR is much better.
> 
> I agree, but I also think that if TERM refers to a terminal that
> does not understand SGR, then man or groff should notice it
> and make sure that SGR codes are not generated.

groff is as dumb as TeX.  It knows nothing about TERM.  I won't change
that.


    Werner

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

* Re: [lurwas@moya.dnsalias.net: groff version 1.18.1 and emacs]
  2002-12-07 15:58             ` Werner LEMBERG
@ 2002-12-07 16:35               ` Alex Schroeder
  2002-12-09 16:12               ` Stefan Monnier
  1 sibling, 0 replies; 16+ messages in thread
From: Alex Schroeder @ 2002-12-07 16:35 UTC (permalink / raw)
  Cc: monnier+gnu/emacs

Werner LEMBERG <wl@gnu.org> writes:

>> > > Should the `man' program pass `-c' to nroff?
>> > 
>> > I don't think so.  Making Emacs understand SGR is much better.
>> 
>> I agree, but I also think that if TERM refers to a terminal that
>> does not understand SGR, then man or groff should notice it
>> and make sure that SGR codes are not generated.
>
> groff is as dumb as TeX.  It knows nothing about TERM.  I won't change
> that.

Well, it still looks like a bug in groff or man that ought to be fixed
upstream.  As for teaching Emacs about SGR -- we can use ansi-color.el
to do the right thing.  At least it works in shell mode...  :)

Alex.

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

* Re: [lurwas@moya.dnsalias.net: groff version 1.18.1 and emacs]
  2002-12-06 22:26     ` Werner LEMBERG
  2002-12-07  0:13       ` Alan Shutko
@ 2002-12-07 18:59       ` Eli Zaretskii
  1 sibling, 0 replies; 16+ messages in thread
From: Eli Zaretskii @ 2002-12-07 18:59 UTC (permalink / raw)
  Cc: emacs-devel

> From: Werner LEMBERG <wl@gnu.org>
> Date: Fri, 06 Dec 2002 23:26:27 +0100 (CET)
> 
> I decided to make SGR the default output format of
> groff's TTY output device starting with groff version 1.18 about six
> months ago.  Not all tools understand SGR yet, so it will take some
> time until everything has been updated.

And if you remember, I've warned you back then that breakage of the
kind we see with man.el will surely happen if the SGR is going to be
the default output format without giving some time to the related
packages to catch up.  So far, only Less and Texinfo's Info reader can
handle the SGR sequences produced by Groff.

> Setting this environment
> variable will always work regardless of the used version of man or
> groff, so I think this is the easiest workaround within Emacs.

I'd rather suggest to release a Groff where SGR is turned off by
default.

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

* Re: [lurwas@moya.dnsalias.net: groff version 1.18.1 and emacs]
       [not found]           ` <E18LCzH-0004Jz-00@fencepost.gnu.org>
@ 2002-12-09  7:17             ` Werner LEMBERG
  2002-12-09 19:16               ` Eli Zaretskii
  0 siblings, 1 reply; 16+ messages in thread
From: Werner LEMBERG @ 2002-12-09  7:17 UTC (permalink / raw)
  Cc: monnier+gnu/emacs

>     Making Emacs understand SGR is much better.
> 
> Do you want to make Emacs understand SGR?
> Otherwise, I don't know if anyone will do it.

Emacs already has code for that (written by Eli mainly for his DOS
port).  The question is how to make it available for man.el.

BTW, xterm natively supports SGR since a longer time already.  The
same is true for the console of GNU/Linux.  It's a kind of irony that
e.g. `groff -Tlatin1 -man foo.1' sent to xterm displays nicely while
`man foo' doesn't if not configured properly.


    Werner

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

* Re: [lurwas@moya.dnsalias.net: groff version 1.18.1 and emacs]
  2002-12-07 15:58             ` Werner LEMBERG
  2002-12-07 16:35               ` Alex Schroeder
@ 2002-12-09 16:12               ` Stefan Monnier
  1 sibling, 0 replies; 16+ messages in thread
From: Stefan Monnier @ 2002-12-09 16:12 UTC (permalink / raw)
  Cc: monnier+gnu/emacs

> > I agree, but I also think that if TERM refers to a terminal that
> > does not understand SGR, then man or groff should notice it
> > and make sure that SGR codes are not generated.
> groff is as dumb as TeX.  It knows nothing about TERM.  I won't change
> that.

That's why I said "man or groff" rather than just "groff".


	Stefan

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

* Re: [lurwas@moya.dnsalias.net: groff version 1.18.1 and emacs]
  2002-12-09  7:17             ` Werner LEMBERG
@ 2002-12-09 19:16               ` Eli Zaretskii
  2002-12-10 20:57                 ` Werner LEMBERG
  0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2002-12-09 19:16 UTC (permalink / raw)
  Cc: emacs-devel

> Date: Mon, 09 Dec 2002 08:17:05 +0100 (CET)
> From: Werner LEMBERG <wl@gnu.org>
> 
> Emacs already has code for that (written by Eli mainly for his DOS
> port).

I'm not sure what you mean here: I didn't write anything like what
you say.  The DOS port of Emacs does not translate SGR sequences to
colors, it simply has special code (in msdos.c) to turn on and off
colors given face information in `struct glyph'.  The way it turns
colors on and off is specific to DOS and utilizes direct access to
the video memory of the terminal.

Another related piece of code with which I was involved is in the
stand-alone Info reader (the one which comes with the Texinfo
package).  That one works on all supported platforms (not only on
DOS), but all it does is either (1) strip all SGR escapes, so that the
man page is displayed without any colors, or (2) under the -R
command-line option, pass the SGRs unaltered to the pager under the
assumption that the pager will DTRT (latest releases of Less can do
that).

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

* Re: [lurwas@moya.dnsalias.net: groff version 1.18.1 and emacs]
  2002-12-09 19:16               ` Eli Zaretskii
@ 2002-12-10 20:57                 ` Werner LEMBERG
  0 siblings, 0 replies; 16+ messages in thread
From: Werner LEMBERG @ 2002-12-10 20:57 UTC (permalink / raw)
  Cc: emacs-devel

> > Emacs already has code for that (written by Eli mainly for his DOS
> > port).
>
> I'm not sure what you mean here: I didn't write anything like what
> you say.  The DOS port of Emacs does not translate SGR sequences to
> colors, it simply has special code (in msdos.c) to turn on and off
> colors given face information in `struct glyph'.  The way it turns
> colors on and off is specific to DOS and utilizes direct access to
> the video memory of the terminal.

Sorry for the misunderstanding.


    Werner

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

end of thread, other threads:[~2002-12-10 20:57 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E18JXMq-0003vX-00@fencepost.gnu.org>
2002-12-04 12:55 ` [lurwas@moya.dnsalias.net: groff version 1.18.1 and emacs] Werner LEMBERG
2002-12-04 20:20   ` Stefan Monnier
2002-12-05  9:47     ` Werner LEMBERG
2002-12-06 13:32       ` Richard Stallman
2002-12-06 22:19         ` Werner LEMBERG
2002-12-06 22:55           ` Stefan Monnier
2002-12-07 15:58             ` Werner LEMBERG
2002-12-07 16:35               ` Alex Schroeder
2002-12-09 16:12               ` Stefan Monnier
     [not found]           ` <E18LCzH-0004Jz-00@fencepost.gnu.org>
2002-12-09  7:17             ` Werner LEMBERG
2002-12-09 19:16               ` Eli Zaretskii
2002-12-10 20:57                 ` Werner LEMBERG
2002-12-06 13:31   ` Richard Stallman
2002-12-06 22:26     ` Werner LEMBERG
2002-12-07  0:13       ` Alan Shutko
2002-12-07 18:59       ` Eli Zaretskii

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