[GRASS-dev] Re: [GRASS-user] g.list pager

[CC to grass-dev]

Hamish wrote:

> > I recall that some time ago, when I issued "g.list rast" I would get
> > the list of rasters and the command prompt right after it. Now, when
> > I run the command I get the raster list and no command prompt. I
> > have to hit q to get back to the prompt and the raster list is gone,
> > just like when reading a man page. I tried to change GRASS_PAGER env
> > to more, cat but nothing happened. What am I doing wrong? I'm using
> > Debian

Paul Kelly wrote:
> Yes, setting GRASS_PAGER to cat should give you the behaviour you
> describe, I think. Are you sure it was set properly?

Debian packaging rules state that the default pager will be 'less', not
GRASS's default of 'more'.

IMHO, the default value of GRASS_PAGER ought to be $PAGER, if that is
set.

My personal preference is if not using 'more'
then use 'cat' or rip out the pager code all together.

Some people might actually need the pager, so I wouldn't recommend
removeing the code. Those who don't want a pager can always use
GRASS_PAGER=cat (as I do).

> Funny thing is that the pager is set correctly at the .grassrc6 file
> but grass ignores it. Will have to put it on bashrc

.grassrc6 is not what you expect. It holds the g.gisenv GIS variables,
it's not a shell script containing commands like .bashrc is.

We should change the name for 7.x. It isn't an "rc" file in the
conventional sense.

Use .grass.bashrc for setting shell enviro variables instead. (or .bashrc)

Note that ~/.grass.bashrc only affects the interactive shell which is
spawned from Init.sh; it doesn't affect the operation of Init.sh
itself. For that, use ~/.bashrc (or similar).

It might be worth having a separate rc file which is sourced from the
top of Init.sh. Also, on the subject of potential Init.sh changes, I'd
suggest getting rid of the $HOME "games" and just setting HISTFILE to
put the history file in the mapset directory (AFAICT, that is the
primary purpose of the $HOME stuff).

--
Glynn Clements <glynn@gclements.plus.com>

Hamish wrote:
> Debian packaging rules state that the default pager will be 'less',
> not GRASS's default of 'more'.

Glynn:

IMHO, the default value of GRASS_PAGER ought to be $PAGER, if that is
set.

On the DebianGIS list Francesco corrected me (again), it's actually
patched to use the default system `pager` (set in /usr/bin with a
symlink). The default alternative just happens to be a symlink to
/usr/bin/less. So in practice YHO is already in force on Debian.
If GRASS_PAGER is set it is respected.

H:

> .grassrc6 is not what you expect. It holds the g.gisenv GIS
> variables, it's not a shell script containing commands like .bashrc
> is.

G:

We should change the name for 7.x. It isn't an "rc" file in the
conventional sense.

Name change gets my vote. -> .grass_env or .grass7_env?
Is the major version needed in the filename?

> Use .grass.bashrc for setting shell enviro variables instead. (or
> .bashrc)

Note that ~/.grass.bashrc only affects the interactive shell which is
spawned from Init.sh; it doesn't affect the operation of Init.sh
itself. For that, use ~/.bashrc (or similar).

It might be worth having a separate rc file which is sourced from the
top of Init.sh.

is there a point to having two rc files? ie when would you want to use
the second one if you have the first? better to just source
.grass.bashrc at the start of Init.sh and dispense with the idea of a
second script?

Also, on the subject of potential Init.sh changes, I'd suggest getting
rid of the $HOME "games" and just setting HISTFILE to put the history
file in the mapset directory (AFAICT, that is the primary purpose of
the $HOME stuff).

I agree. You say "primary purpose", what else does it touch?

Hamish

Hamish wrote:

> > Use .grass.bashrc for setting shell enviro variables instead. (or
> > .bashrc)
>
> Note that ~/.grass.bashrc only affects the interactive shell which is
> spawned from Init.sh; it doesn't affect the operation of Init.sh
> itself. For that, use ~/.bashrc (or similar).
>
> It might be worth having a separate rc file which is sourced from the
> top of Init.sh.

is there a point to having two rc files? ie when would you want to use
the second one if you have the first? better to just source
.grass.bashrc at the start of Init.sh and dispense with the idea of a
second script?

You might want to run commands which only make sense for an
interactive shell. rc files aren't limited to environment variables.

> Also, on the subject of potential Init.sh changes, I'd suggest getting
> rid of the $HOME "games" and just setting HISTFILE to put the history
> file in the mapset directory (AFAICT, that is the primary purpose of
> the $HOME stuff).

I agree. You say "primary purpose", what else does it touch?

bash reads various files under $HOME at startup. All of these will be
read from the mapset directory, as that is the value of $HOME when the
interactive shell is spawned.

The changes to $HOME are also used to force bash to read the generated
.bashrc file instead of the user's ~/.bashrc, although you can use
--rcfile for that.

--
Glynn Clements <glynn@gclements.plus.com>