BTS

Issue386

Title grml-etc-core::etc/zsh/zshrc: substitute most for $PAGER
Priority feature Status resolved
Superseder Nosy List ft, mika, z3ttacht
Assigned To Topics configs, grml-etc-core, zsh

Created on 2008-01-27.14:52:55 by z3ttacht, last changed 2008-02-11.17:15:24 by mika.

Files
File name Uploaded Type Edit Remove
grml-etc-core_zshrc_pager.patch z3ttacht, 2008-01-27.14:52:54 text/x-diff
Messages
msg1168 (view) Author: mika Date: 2008-02-11.17:15:21
We believe that your issue has been closed by the upload of
Version 0.3.48 of grml-etc-core from Michael Prokop <mika@grml.org>.
The explanation is attached below

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Mon, 11 Feb 2008 17:58:42 +0100
Source: grml-etc-core
Binary: grml-etc-core
Architecture: source all
Version: 0.3.48
Distribution: unstable
Urgency: low
Maintainer: Michael Prokop <mika@grml.org>
Changed-By: Michael Prokop <mika@grml.org>
Description: 
 grml-etc-core - core ecetera files for the grml system
Changes: 
 grml-etc-core (0.3.48) unstable; urgency=low
 .
   [ Alexander Steinböck ]
   * zshrc: use $PAGER in dchange(), uchange() and dnews() [Closes: issue386]
   * zshrc: adding whatwhen() for history queries [Closes: issue380]
 .
   [ Frank Terbeck ]
   * zshrc: add a check for ZSH_VERSION >= 3.1.7 [Closes: issue389]
 .
   [ Michael Prokop ]
   * zshrc: enable 'setopt longlistjobs' by default
   * zshrc: re-enable use of 'sudo su' instead of 'sudo -s' for alias su,
     otherwise it breaks "su - $USER". Thanks for bringing this up,
     Martin Yazdzik!
Files: 
 6be0fd2d17c9ead9563840024ff703b1 596 grml optional grml-etc-core_0.3.48.dsc
 66e70ab672205c0ed5ea4cb9ac81d42d 93953 grml optional grml-etc-core_0.3.48.tar.gz
 875ecf9abd3830a82454c72a11a55861 96316 grml optional grml-etc-core_0.3.48_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFHsH+R2N9T+zficugRApgvAJ9bntatOGTPEda4KrSnQM9Us0cYnQCePuMb
zrMV985Ogx3IIlAUcg2eGy8=
=qsrF
-----END PGP SIGNATURE-----
msg1142 (view) Author: z3ttacht Date: 2008-02-01.18:44:09
> It doesn't matter how it is done, check_com() should be used when it's
> needed. And if I recall the place we are talking about correctly, it
> *is* needed.
I guess, you're right. After more thinking about it, one can just not
be sure $PAGER^Wthe corresponding program is available on the
particular machine. Hence it's sane to check for it.

Thanks for making me think more about such things. (o;

Kind regards,
z3ttacht
msg1137 (view) Author: ft Date: 2008-01-31.17:56:59
Alexander Steinböck <bts@bts.grml.org>:
> Alexander Steinböck <z3ttacht@grml.org> added the comment:
> * ft <bts@bts.grml.org> [2008-01-31 10:55]:
> > check_com() checks if the command stored in $PAGER is available.
> > The latter snippet checks if $PAGER is empty and if so, sets it to
> > 'less'. My personal preference would be to use PAGER=${PAGER:-less}
> > there, because, IMHO it's a lot clearer.

> Maybe, but doesn't the current approach give $USER the ability to
> overwrite the setting?

Users are able to do a lot of things.
Overwriting this is possible, too.
It doesn't matter how it is done, check_com() should be used when it's
needed. And if I recall the place we are talking about correctly, it
*is* needed.

If it is not, you clearly failed to provide enough context, to see
what you where aiming at.

> I really can live with check_com - it's a great function - I was just
> curious how others were thinking about it. Since it came from the
> former functions with most(1) in it.

I don't see the problem at all.

> > However we should make sure that the 'export PAGER=${PAGER:-less}'
> > code is issued *before* the check_com() line.

> Isn't that down now, since the patch moved it to /etc/zsh/zshrc?

Probably, I didn't check it.

Regards, Frank

-- 
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925
msg1136 (view) Author: z3ttacht Date: 2008-01-31.10:39:46
* ft <bts@bts.grml.org> [2008-01-31 10:55]:
> check_com() checks if the command stored in $PAGER is available.
> The latter snippet checks if $PAGER is empty and if so, sets it to
> 'less'. My personal preference would be to use PAGER=${PAGER:-less}
> there, because, IMHO it's a lot clearer.
Maybe, but doesn't the current approach give $USER the ability to
overwrite the setting?
I really can live with check_com - it's a great function - I was just
curious how others were thinking about it. Since it came from the
former functions with most(1) in it.

> However we should make sure that the 'export PAGER=${PAGER:-less}'
> code is issued *before* the check_com() line.
Isn't that down now, since the patch moved it to /etc/zsh/zshrc?
msg1135 (view) Author: ft Date: 2008-01-31.09:55:45
Alexander Steinböck <bts@bts.grml.org>:
> Alexander Steinböck <z3ttacht@grml.org> added the comment:
> One thing I forgot to mention.
> 
> IMHO testing for $PAGER as in
> 
>   ,----[ /etc/skel/.zshrc ]-
>   |   +if check_com -c $PAGER ; then
>   `----
> 
> which originated from the same test with most, is _not_ necessary,
> since $PAGER gets definitely set.
> 
>   ,----[ /etc/zsh/zshrc ]-
>   | +(( ${+PAGER} )) || export PAGER="less"
>   `----
> 
> Arguments for keeping it? (o;

Sure, it's not the same thing.

check_com() checks if the command stored in $PAGER is available.
The latter snippet checks if $PAGER is empty and if so, sets it to
'less'. My personal preference would be to use PAGER=${PAGER:-less}
there, because, IMHO it's a lot clearer.

However we should make sure that the 'export PAGER=${PAGER:-less}'
code is issued *before* the check_com() line. Because check_com()
requires a command to be checked for. An empty string would be a
rather weird command name. :-)

Patch welcome, btw.
I'll be afk until the evening.

Regards, Frank

-- 
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925
msg1133 (view) Author: z3ttacht Date: 2008-01-31.07:55:10
One thing I forgot to mention.

IMHO testing for $PAGER as in

  ,----[ /etc/skel/.zshrc ]-
  |   +if check_com -c $PAGER ; then
  `----

which originated from the same test with most, is _not_ necessary,
since $PAGER gets definitely set.

  ,----[ /etc/zsh/zshrc ]-
  | +(( ${+PAGER} )) || export PAGER="less"
  `----

Arguments for keeping it? (o;
msg1128 (view) Author: ft1 Date: 2008-01-30.20:23:14
Michael Prokop <bts@bts.grml.org>:
> Michael Prokop <mika@grml.org> added the comment:
> * Frank Terbeck [20080130 10:46]:
> > Alexander Steinböck:
> > > [..use $PAGER..]
> >
> > This is fine by me, as long as the mentioned programs do *not* require
> > any of the special features most might have, that other possible
> > values of $PAGER don't...
> 
> > Any thoughts mika?
> > (As you were the one who wrote these functions, IIRC.)
> 
> Good idea, so please go ahead.  But please make sure, the functions
> really work as expected. :)

I took a look at the functions; The patch looks sane, so:

  Applied.
    <http://hg.grml.org/grml-etc-core/rev/ebd477ede5d7>
    <http://hg.grml.org/grml-etc-core/rev/e45247e14a6b>

Regards, Frank

-- 
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925
msg1127 (view) Author: mika Date: 2008-01-30.19:40:18
* Frank Terbeck [20080130 10:46]:
> Alexander Steinböck:

> > dchange(), uchange() and dnews() in etc/zsh/zshrc use most(1) for
> > displaying their results.
> > But since there's `(( ${+PAGER} )) || export PAGER="less"' set in
> > etc/skel/.zshrc I think it's better to use $PAGER than a fix program.

> > In association to that, less is more! (o;

> > According to that, I moved `(( ${+PAGER} )) || export PAGER="less"'
> > from /etc/skel/.zshrc to /etc/zsh/zshrc.

> This is fine by me, as long as the mentioned programs do *not* require
> any of the special features most might have, that other possible
> values of $PAGER don't...

> Any thoughts mika?
> (As you were the one who wrote these functions, IIRC.)

Good idea, so please go ahead.  But please make sure, the functions
really work as expected. :)

regards,
-mika-
msg1123 (view) Author: ft1 Date: 2008-01-30.09:46:16
Alexander Steinböck <bts@bts.grml.org>:
> dchange(), uchange() and dnews() in etc/zsh/zshrc use most(1) for
> displaying their results.
> But since there's `(( ${+PAGER} )) || export PAGER="less"' set in
> etc/skel/.zshrc I think it's better to use $PAGER than a fix program.
> 
> In association to that, less is more! (o;
> 
> According to that, I moved `(( ${+PAGER} )) || export PAGER="less"'
> from /etc/skel/.zshrc to /etc/zsh/zshrc.

This is fine by me, as long as the mentioned programs do *not* require
any of the special features most might have, that other possible
values of $PAGER don't...

Any thoughts mika?
(As you were the one who wrote these functions, IIRC.)

Regards, Frank

-- 
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925
msg1106 (view) Author: z3ttacht Date: 2008-01-27.14:52:54
dchange(), uchange() and dnews() in etc/zsh/zshrc use most(1) for
displaying their results.
But since there's `(( ${+PAGER} )) || export PAGER="less"' set in
etc/skel/.zshrc I think it's better to use $PAGER than a fix program.

In association to that, less is more! (o;

According to that, I moved `(( ${+PAGER} )) || export PAGER="less"'
from /etc/skel/.zshrc to /etc/zsh/zshrc.
History
Date User Action Args
2008-02-11 17:15:24mikasetstatus: chatting -> resolved
nosy: mika, ft, z3ttacht
messages: + msg1168
2008-02-01 18:44:12z3ttachtsetnosy: mika, ft, z3ttacht
messages: + msg1142
title: grml-etc-core::etc/zsh/zshrc: substitute most for $PAGER -> grml-etc-core::etc/zsh/zshrc: substitute most for $PAGER
2008-01-31 17:57:01ftsetnosy: mika, ft, z3ttacht
messages: + msg1137
title: grml-etc-core::etc/zsh/zshrc: substitute most for $PAGER -> grml-etc-core::etc/zsh/zshrc: substitute most for $PAGER
2008-01-31 10:39:46z3ttachtsetnosy: mika, ft, z3ttacht
messages: + msg1136
title: grml-etc-core::etc/zsh/zshrc: substitute most for $PAGER -> grml-etc-core::etc/zsh/zshrc: substitute most for $PAGER
2008-01-31 09:55:46ftsetnosy: mika, ft, z3ttacht
messages: + msg1135
title: grml-etc-core::etc/zsh/zshrc: substitute most for $PAGER -> grml-etc-core::etc/zsh/zshrc: substitute most for $PAGER
2008-01-31 07:55:11z3ttachtsetnosy: mika, ft, z3ttacht
messages: + msg1133
title: grml-etc-core::etc/zsh/zshrc: subsitute most for?$PAGER -> grml-etc-core::etc/zsh/zshrc: substitute most for $PAGER
2008-01-30 20:23:15ft1setnosy: mika, ft, z3ttacht
messages: + msg1128
title: grml-etc-core::etc/zsh/zshrc: subsitute most for $PAGER -> grml-etc-core::etc/zsh/zshrc: subsitute most for?$PAGER
2008-01-30 19:40:19mikasetnosy: mika, ft, z3ttacht
messages: + msg1127
2008-01-30 09:46:17ft1setstatus: unread -> chatting
nosy: mika, ft, z3ttacht
messages: + msg1123
title: grml-etc-core::etc/zsh/zshrc: subsitute most for $PAGER -> grml-etc-core::etc/zsh/zshrc: subsitute most for $PAGER
2008-01-27 15:58:16z3ttachtsettopic: + zsh, configs, grml-etc-core
nosy: mika, ft, z3ttacht
2008-01-27 14:52:55z3ttachtcreate