Re: [gentoo-user] less file.html

2012-05-13 Thread Stroller

On 13 May 2012, at 06:57, Paul Colquhoun wrote:
 … 
 You can set LESSIGNORE='*.htm*'. This environment variable is used by
 the lesspipe command, which is invoked by less and filters the input
 file before giving it to less itself.
 
 … 
 I have here now:
 
 $ env | grep -i less
 PAGER=/usr/bin/less
 LESS=-R -M --shift 5
 LESSOPEN=|lesspipe %s
 LESSIGNORE=*.htm*
 $
 
 … 
 
 I would interpret the don't do anything fancy caveat on LESSIGNORE to mean 
 that wildcards may not work.  Some experimenting on my system shows me that 
 this version seems to do what you want:
 
 LESSIGNORE=htm html
 
 I don't normally have LESSOPEN set, so I havn't seen this situation before.

Blimey! Thank you! That's wonderful!

:D

Stroller.




Re: [gentoo-user] less file.html

2012-05-12 Thread Alex Schuster
Stroller writes:

 I want to view the html source of a webpage.
 
 When I run `less file.html` the rendered webpage is shown, not the
 source. It is as if lynx had been invoked, rather than less. 
 
 `more file.html` and `most file.html` both work fine, but this is
 annoying - it takes an effort to prevent my fingers from typing `less`.
 
 How do I disable less from parsing html source, please?

You can set LESSIGNORE='*.htm*'. This environment variable is used by the
lesspipe command, which is invoked by less and filters the input file
before giving it to less itself.
The is, if LESSOPEN='|lesspipe %s', which is set for me as such
in /etc/env.d/70less.

Wonko



Re: [gentoo-user] less file.html

2012-05-12 Thread Stroller

On 12 May 2012, at 22:49, Alex Schuster wrote:
 ...
 I want to view the html source of a webpage.
 
 When I run `less file.html` the rendered webpage is shown, not the
 source. It is as if lynx had been invoked, rather than less. 
 ...
 How do I disable less from parsing html source, please?
 
 You can set LESSIGNORE='*.htm*'. This environment variable is used by the
 lesspipe command, which is invoked by less and filters the input file
 before giving it to less itself.

That's great! Thanks!

Searching the manpage for lessopen I find that I can use this shortcut 
instead:

less -L file.html

Stroller.




Re: [gentoo-user] less file.html

2012-05-12 Thread Stroller

On 12 May 2012, at 23:39, Stroller wrote:

 
 On 12 May 2012, at 22:49, Alex Schuster wrote:
 ...
 I want to view the html source of a webpage.
 
 When I run `less file.html` the rendered webpage is shown, not the
 source. It is as if lynx had been invoked, rather than less. 
 ...
 How do I disable less from parsing html source, please?
 
 You can set LESSIGNORE='*.htm*'. This environment variable is used by the
 lesspipe command, which is invoked by less and filters the input file
 before giving it to less itself.
 
 That's great! Thanks!
 
 Searching the manpage for lessopen I find that I can use this shortcut 
 instead:
 
less -L file.html
 
 Stroller.

Oooops! Damnit!

I replied to the wrong message. Please ignore the above.


Re: [gentoo-user] less file.html

2012-05-12 Thread Stroller

On 12 May 2012, at 22:50, Canek Peláez Valdés wrote:
 ...
 Another one; unset LESSOPEN:
 
 LESSOPEN= file.html

That's great! Thanks!

Searching the manpage for lessopen I find that I can use this shortcut 
instead:

   less -L file.html

Stroller.



Re: [gentoo-user] less file.html

2012-05-12 Thread Stroller

On 12 May 2012, at 22:49, Alex Schuster wrote:
 … 
 I want to view the html source of a webpage.
 
 When I run `less file.html` the rendered webpage is shown, not the
 source. It is as if lynx had been invoked, rather than less. 
 ...
 How do I disable less from parsing html source, please?
 
 You can set LESSIGNORE='*.htm*'. This environment variable is used by the
 lesspipe command, which is invoked by less and filters the input file
 before giving it to less itself.

Contrary to my previous email, sent in error, that does NOT work.

Did you check this yourself?

$ LESSOPEN= less file.html# works fine
$ LESSIGNORE='*.htm*' less file.html#does not

I've also tried `export LESSIGNORE='*.htm*'` (for what difference that makes?) 
and tried running the `less` command on a separate line.

What version of less are you using, please? I have =sys-apps/less-444 installed 
here.

As per my previous reply to Canek's suggestion, I now have a working solution. 
LESSOPEN is the keyword that works for me, here. So I only make this reply to 
you now for completeness, as part of the eternal quest for deeper understanding 
and for the benefit of those searching in the future. LESSIGNORE seems even 
more poorly documented than LESSOPEN - I'm afraid I never think to use `info`, 
only `man` in the first instance.

Stroller.






Re: [gentoo-user] less file.html

2012-05-12 Thread Alex Schuster
Stroller writes:

 On 12 May 2012, at 22:49, Alex Schuster wrote:
[...]
  How do I disable less from parsing html source, please?
  
  You can set LESSIGNORE='*.htm*'. This environment variable is used by
  the lesspipe command, which is invoked by less and filters the input
  file before giving it to less itself.
 
 Contrary to my previous email, sent in error, that does NOT work.
 
 Did you check this yourself?

Yes. I did not know about this mechanism before, but 'env|grep -i less'
showed the LESS and LESSOPEN environment variable, so I learnt about the
lesspipe command. lesspipe -h gives a little info, LESSIGNORE is shown
there.

 $ LESSOPEN= less file.html# works fine

It should, for any type of file.

 $ LESSIGNORE='*.htm*' less file.html#does not

Working fine here.

 I've also tried `export LESSIGNORE='*.htm*'` (for what difference that
 makes?) and tried running the `less` command on a separate line.

There is no difference, but it's more convenient to export the variable as
you do not have to set it every time then.

 What version of less are you using, please? I have =sys-apps/less-444
 installed here.

445-r1, but I just downgraded to 444, and it behaves the same. I have the
pcre and unicode USE flags set, but don't assume they make any
difference. Weird, no idea why it it not working for you.

Wonko



Re: [gentoo-user] less file.html

2012-05-12 Thread Stroller

On 13 May 2012, at 00:22, Alex Schuster wrote:
 … 
 You can set LESSIGNORE='*.htm*'. This environment variable is used by
 the lesspipe command, which is invoked by less and filters the input
 file before giving it to less itself.
 
 Contrary to my previous email, sent in error, that does NOT work.
 
 Did you check this yourself?
 
 Yes. I did not know about this mechanism before, but 'env|grep -i less'
 showed the LESS and LESSOPEN environment variable, so I learnt about the
 lesspipe command. lesspipe -h gives a little info, LESSIGNORE is shown
 there.

I have here now:

$ env | grep -i less
PAGER=/usr/bin/less
LESS=-R -M --shift 5
LESSOPEN=|lesspipe %s
LESSIGNORE=*.htm*
$ 

And still the same thing.

 What version of less are you using, please? I have =sys-apps/less-444
 installed here.
 
 445-r1, but I just downgraded to 444, and it behaves the same. I have the
 pcre and unicode USE flags set, but don't assume they make any
 difference. Weird, no idea why it it not working for you.

Thanks for your help.

`less -L file.html` works for me - I've got a way of dealing with this, and I'm 
busy with other stuff right now, so I'm just going to forget worrying about 
LESSIGNORE.

I post the above output showing my less environment only for the benefit of 
anyone else encountering this in the future - perhaps it gives them something 
to go on.

I appreciate your assistance, 

Stroller.




Re: [gentoo-user] less file.html

2012-05-12 Thread Paul Colquhoun
On Sun, 13 May 2012 05:12:59 Stroller wrote:
 On 13 May 2012, at 00:22, Alex Schuster wrote:
  …
  
  You can set LESSIGNORE='*.htm*'. This environment variable is used by
  the lesspipe command, which is invoked by less and filters the input
  file before giving it to less itself.
  
  Contrary to my previous email, sent in error, that does NOT work.
  
  Did you check this yourself?
  
  Yes. I did not know about this mechanism before, but 'env|grep -i less'
  showed the LESS and LESSOPEN environment variable, so I learnt about the
  lesspipe command. lesspipe -h gives a little info, LESSIGNORE is shown
  there.
 
 I have here now:
 
 $ env | grep -i less
 PAGER=/usr/bin/less
 LESS=-R -M --shift 5
 LESSOPEN=|lesspipe %s
 LESSIGNORE=*.htm*
 $


On my system, I get this as the lesspipe help message:

#
[paulcol@bluering ~]
[Sun May 13 10:26:09]$ lesspipe --help
lesspipe: preproccess files before sending them to less

Usage: lesspipe file

lesspipe specific settings:
  LESSCOLOR env - toggle colorizing of output (no/yes/always)
  LESSCOLORIZER env - program used to colorize output (default:
  code2color)
  LESSIGNORE- list of extensions to ignore (don't do anything
 fancy)

You can create per-user filters as well by creating the executable file:
  ~/.lessfilter
One argument is passed to it: the file to display.

To use lesspipe, simply add to your environment:
  export LESSOPEN=|lesspipe %s

Run 'less --help' or 'man less' for more info
#

I would interpret the don't do anything fancy caveat on LESSIGNORE to mean 
that wildcards may not work.  Some experimenting on my system shows me that 
this version seems to do what you want:

LESSIGNORE=htm html

I don't normally have LESSOPEN set, so I havn't seen this situation before.

-- 
Reverend Paul Colquhoun, ULC.http://andor.dropbear.id.au/~paulcol
 Before you criticize someone, you should walk a mile in their shoes.
Then, when you do, you'll be a mile away, and you'll have their shoes.