zsh-users
 help / color / mirror / code / Atom feed
* clear terminal after display of less, <, and apropos
@ 1998-10-14 21:33 Roland Jesse
  1998-10-15  1:25 ` Bart Schaefer
  0 siblings, 1 reply; 11+ messages in thread
From: Roland Jesse @ 1998-10-14 21:33 UTC (permalink / raw)
  To: ZSH Users

Hello,

At first, many thanks of those who responded immediatetly to my last
question.

As I am currently in the process of completely rewriting my configuration
from scratch, another problem just popped up:

Whenever I display some information with '< blurb' the terminal gets
cleared immediately after I quit the pager (more). The same happens after
executing an 'apropos' command.

The situation is a bit different for less:

j.wh4-422 ~ % less blurb
zsh: command not found: lesspipe.sh
j.wh4-422 ~ %

The error message shows up after I quit less, not right after initiating
the command.

Any hints of what I am doing wrong are appreciated a lot. Send comments
and flames about dull questions please either to /dev/null or directly to
me but not to the list.

Regards,
		Roland


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

* Re: clear terminal after display of less, <, and apropos
  1998-10-14 21:33 clear terminal after display of less, <, and apropos Roland Jesse
@ 1998-10-15  1:25 ` Bart Schaefer
  1998-10-15  2:22   ` Geoff Wing
  1998-10-15  9:11   ` Mircea Damian
  0 siblings, 2 replies; 11+ messages in thread
From: Bart Schaefer @ 1998-10-15  1:25 UTC (permalink / raw)
  To: Roland Jesse, ZSH Users

On Oct 14, 11:33pm, Roland Jesse wrote:
} Subject: clear terminal after display of less, <, and apropos
}
} Whenever I display some information with '< blurb' the terminal gets
} cleared immediately after I quit the pager (more). The same happens after
} executing an 'apropos' command.

This is a termcap thing.  Often the "start visual mode" sequence in the
termcap will include a "switch to alternate screen" escape code; this
is often true for xterm.  Programs like vi (and clones), more, and less
may read this sequence from the termcap and send it to the terminal
before they begin display.  The "end visual mode" sequence then switches
back to the original screen.  This is to avoid having your scrollback
buffer filled up with the output from the pager program, but it is
sometimes annoying.  You can try setting TERM to a more primitive type
(say, vt100 instead of xterm) to prevent it from happening:

% TERM=vt100 apropos intro

You can change TERM permanently:

[[ "$TERM" == xterm* ]] && TERM=vt100

Or you can alias specific commands to use the primitive terminal type:

[[ "$TERM" == xterm* ]] && {
    alias less='TERM=vt100 less'
    alias more='TERM=vt100 more'
    alias apropos='TERM=vt100 apropos'
    alias man='TERM=vt100 man'
}

(That won't help with '< blurb' because READNULLCMD has to be a single
word.  So you can also do (after creating the above aliases):

function readnullcmd { less $* }
READNULLCMD=readnullcmd

to get the terminal setting there as well.)

Or you can read up on termcap and terminfo and figure out how to create
a new description for your terminal that omits the start/end visual mode
sequences.

} The situation is a bit different for less:
} 
} j.wh4-422 ~ % less blurb
} zsh: command not found: lesspipe.sh

It looks from that error as if "less" on your system is not an actual
executable, but instead is some kind of a shell script.  There's not
much help we can give you in that case.  Try:

% whence -a less

to see if there's already an alias or function causing your confusion.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


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

* Re: clear terminal after display of less, <, and apropos
  1998-10-15  1:25 ` Bart Schaefer
@ 1998-10-15  2:22   ` Geoff Wing
  1998-10-15  9:11   ` Mircea Damian
  1 sibling, 0 replies; 11+ messages in thread
From: Geoff Wing @ 1998-10-15  2:22 UTC (permalink / raw)
  To: zsh-users

Bart Schaefer <schaefer@brasslantern.com> typed:
:On Oct 14, 11:33pm, Roland Jesse wrote:
:} The situation is a bit different for less:
:} j.wh4-422 ~ % less blurb
:} zsh: command not found: lesspipe.sh
:It looks from that error as if "less" on your system is not an actual
:executable, but instead is some kind of a shell script.  There's not
:much help we can give you in that case.  Try:
:% whence -a less
:to see if there's already an alias or function causing your confusion.

% echo $LESSOPEN
% echo $LESSCLOSE
% man less
-- 
Geoff Wing   <gcw@pobox.com>            Mobile : 0412 162 441
Work URL: http://www.primenet.com.au/   Ego URL: http://pobox.com/~gcw/


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

* Re: clear terminal after display of less, <, and apropos
  1998-10-15  1:25 ` Bart Schaefer
  1998-10-15  2:22   ` Geoff Wing
@ 1998-10-15  9:11   ` Mircea Damian
  1998-10-15 13:22     ` Paul Lew
  1998-10-15 14:58     ` clear terminal after display of less, <, and apropos Greg Badros
  1 sibling, 2 replies; 11+ messages in thread
From: Mircea Damian @ 1998-10-15  9:11 UTC (permalink / raw)
  To: Roland Jesse, ZSH Users

On Wed, Oct 14, 1998 at 06:25:16PM -0700, Bart Schaefer wrote:
> On Oct 14, 11:33pm, Roland Jesse wrote:
> } Subject: clear terminal after display of less, <, and apropos
> }
> } Whenever I display some information with '< blurb' the terminal gets
> } cleared immediately after I quit the pager (more). The same happens after
> } executing an 'apropos' command.
> 
> This is a termcap thing.  Often the "start visual mode" sequence in the
> termcap will include a "switch to alternate screen" escape code; this
> is often true for xterm.  Programs like vi (and clones), more, and less
> may read this sequence from the termcap and send it to the terminal
> before they begin display.  The "end visual mode" sequence then switches
> back to the original screen.  This is to avoid having your scrollback
> buffer filled up with the output from the pager program, but it is
> sometimes annoying.  You can try setting TERM to a more primitive type
> (say, vt100 instead of xterm) to prevent it from happening:
> 
> % TERM=vt100 apropos intro
> 
> You can change TERM permanently:
> 
> [[ "$TERM" == xterm* ]] && TERM=vt100
> 
> Or you can alias specific commands to use the primitive terminal type:
> 
> [[ "$TERM" == xterm* ]] && {
>     alias less='TERM=vt100 less'
>     alias more='TERM=vt100 more'
>     alias apropos='TERM=vt100 apropos'
>     alias man='TERM=vt100 man'
> }

This may be a terminfo "problem" too. If you are using an xterm then you
can use it's option titeInhibit by adding it to your Xresources file(which
btw I never managed to make it work even if the option is documented in
xterm's man page.. hints?).

The other way which I use is to hack a bit the termcap/terminfo files by
removing those entries(ti,te in termcap and smcup, rmcup in terminfo).

> 
> (That won't help with '< blurb' because READNULLCMD has to be a single
> word.  So you can also do (after creating the above aliases):
> 
> function readnullcmd { less $* }
> READNULLCMD=readnullcmd
> 
> to get the terminal setting there as well.)
> 
> Or you can read up on termcap and terminfo and figure out how to create
> a new description for your terminal that omits the start/end visual mode
> sequences.
> 
> } The situation is a bit different for less:
> } 
> } j.wh4-422 ~ % less blurb
> } zsh: command not found: lesspipe.sh

You have LESSOPEN defined as "|lesspipe.sh %s" and the shell file is not in
your search PATH or is not available at all. Try removing this variable
from your startup files or better(if you want to open tar, gz,zip files
with less) add this script to your exec path.

-- 
Mircea Damian
Network Manager
dmircea@roedu.net, dmircea@lbi.ro, dmircea@kappa.ro
MD65-RIPE, MD2225, MD1-6BONE
Phone: +40-1-4115246


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

* Re: clear terminal after display of less, <, and apropos
  1998-10-15  9:11   ` Mircea Damian
@ 1998-10-15 13:22     ` Paul Lew
  1998-10-15 14:46       ` Zoltan Hidvegi
  1998-10-15 18:09       ` Bart Schaefer
  1998-10-15 14:58     ` clear terminal after display of less, <, and apropos Greg Badros
  1 sibling, 2 replies; 11+ messages in thread
From: Paul Lew @ 1998-10-15 13:22 UTC (permalink / raw)
  To: Roland Jesse; +Cc: ZSH Users

Roland> On Oct 14, 11:33pm, Roland Jesse wrote:
Roland> Subject: clear terminal after display of less, <, and apropos
Roland>
Roland> Whenever I display some information with '< blurb' the
Roland> terminal gets cleared immediately after I quit the pager
Roland> (more). The same happens after executing an 'apropos' command.

I have been using the following zsh function to get rid off the 'ti'
and the 'te' feature from the termcap definition.

function notite {
	 TERMCAP=$(printenv TERMCAP | sed 's/:ti=[^:]*//; s/:te=[^:]*//;')
	 }

So if you're using something like color_xterm, you will not lose other
features by switching TERM to vt100.


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

* Re: clear terminal after display of less, <, and apropos
  1998-10-15 13:22     ` Paul Lew
@ 1998-10-15 14:46       ` Zoltan Hidvegi
  1998-10-15 18:09       ` Bart Schaefer
  1 sibling, 0 replies; 11+ messages in thread
From: Zoltan Hidvegi @ 1998-10-15 14:46 UTC (permalink / raw)
  To: Paul Lew; +Cc: jesse, zsh-users

> Roland> Subject: clear terminal after display of less, <, and apropos
> Roland>
> Roland> Whenever I display some information with '< blurb' the
> Roland> terminal gets cleared immediately after I quit the pager
> Roland> (more). The same happens after executing an 'apropos' command.
> 
> I have been using the following zsh function to get rid off the 'ti'
> and the 'te' feature from the termcap definition.

As someone previously suggested, you should read the less manual:

       -X     Disables sending  the  termcap  initialization  and
              deinitialization  strings to the terminal.  This is
              sometimes desirable if the deinitialization  string
              does   something  unnecessary,  like  clearing  the
              screen.

You can set it in the LESS variable so that you do not always have to
give it on the command line.

Obviously this subject has nothing to do with zsh.

Zoli


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

* Re: clear terminal after display of less, <, and apropos
  1998-10-15  9:11   ` Mircea Damian
  1998-10-15 13:22     ` Paul Lew
@ 1998-10-15 14:58     ` Greg Badros
  1 sibling, 0 replies; 11+ messages in thread
From: Greg Badros @ 1998-10-15 14:58 UTC (permalink / raw)
  To: Mircea Damian; +Cc: Roland Jesse, ZSH Users

Mircea Damian <dmircea@secu.kappa.ro> writes:

> On Wed, Oct 14, 1998 at 06:25:16PM -0700, Bart Schaefer wrote:
> > On Oct 14, 11:33pm, Roland Jesse wrote:
> > } Subject: clear terminal after display of less, <, and apropos
> > }
> > } Whenever I display some information with '< blurb' the terminal gets
> > } cleared immediately after I quit the pager (more). The same happens after
> > } executing an 'apropos' command.

Most "more" programs I've seen don't do terminal clearing -- "less" does 
(and some sysadmins have more just point at less, so maybe less is
really being run).

Anyway, the "less" I have installed on my RedHat-like linux system uses
the environment variable LESS to pass default arguments to the binary,
and an option -X to disable sending of termcap init and deinit strings.
So I do:

export LESS=-X

and less stops clearing my screen on exit.

Greg


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

* Re: clear terminal after display of less, <, and apropos
  1998-10-15 13:22     ` Paul Lew
  1998-10-15 14:46       ` Zoltan Hidvegi
@ 1998-10-15 18:09       ` Bart Schaefer
  1998-10-15 19:29         ` Bart Schaefer
  1998-12-15  2:08         ` problem with prompt Brian Harvell
  1 sibling, 2 replies; 11+ messages in thread
From: Bart Schaefer @ 1998-10-15 18:09 UTC (permalink / raw)
  To: Roland Jesse, zsh-users

On Oct 15,  9:22am, Paul Lew wrote:
} Subject: Re: clear terminal after display of less, <, and apropos
}
} function notite {
} 	 TERMCAP=$(printenv TERMCAP | sed 's/:ti=[^:]*//; s/:te=[^:]*//;')
} 	 }

Unfortunately, that doesn't work for programs that use the terminfo
database.  For example, on my RedHat Linux 4.2 system, changing TERMCAP
affects "less" but does not affect "vim".  The only way to be sure of
getting the effect is to change either the terminal type or both the
termcap and terminfo definitions for it.

However -- and to keep this discussion relevant to zsh-users -- I just
remembered a little zsh script called "fixinfo" that I wrote long ago
to clean up a braindamaged terminfo database.  I had to tweak it a bit
because, contrary to the documentation, my "captoinfo" program ignores
$TERMCAP and always process the entire /etc/termcap file, unles you
give it an explicit file name.  With the above function and the one
below:
	notite ; fixinfo ${TERM}-notite
should deal with everything.

I wrote this before zsh had getopts, so there's other modernizing that
could be done.

#! /usr/local/bin/zsh -f
function fixinfo() {
# Temporarily fix up a bad terminfo database
# This is designed to make a terminfo entry match the termcap entry,
# or to add a missing terminfo entry by compiling the termcap entry.
# It requires "tic" and "captoinfo" e.g. from the ncurses package.
#
# If the termcap entry is correct but terminfo is wrong or missing:
#	fixinfo
# If the /etc/termcap entry is wrong but $TERMCAP is correct, use:
#	fixinfo newtermname
# where "newtermname" is a name that doesn't appear in /etc/termcap, so
# ill-behaved programs can't accidentally get the old description.
#
# This is intended to be an autoloaded function.  If you can't autoload
# it, or want to use it from some shell other than zsh (still requires
# that zsh be installed) then use:
#	eval `fixinfo`
# or:
#	eval `fixinfo newtermname`
#
# Add the -f option to forcibly replace descriptions previously written
# by this program.

[[ -n "${TERMCAP:-}" ]] || { echo TERMCAP not set 1>&2; return 1 }
local force=false newterm=$TERM
while (($# > 0))
do
    case $1 in
    -f) force=true;;
    *-help)
        echo "Usage: fixinfo [newname [newname ...]]" 2>&1
        return 0
        ;;
    *)
        if [[ ! -f "$TERMCAP" ]]
        then
            TERMCAP=$(echo "$TERMCAP" | sed -e 's/\\$//' -e "s/^/$1|/")
            newterm="$1"
        fi
        ;;
    esac
    shift
done
TERMINFO=${TERMINFO:-/tmp/tinfo-$EUID}
[[ -d $TERMINFO ]] || mkdir -p $TERMINFO || return 1
[[ -w $TERMINFO ]] || return 1
export TERMCAP TERMINFO
if [[ -f $TERMINFO/$newterm[1]/$newterm ]]
then
    export TERM="$newterm"
    $force || return 0
fi
if [[ -f "$TERMCAP" ]]
then tic =(captoinfo)
else tic =(captoinfo =(<<<"$TERMCAP"))	# Requires 3.0.something for <<<
fi
export TERM="$newterm"
[[ -t 1 ]] || echo export TERM=\""$newterm"\"\; export TERMCAP=\""$TERMCAP"\"
return 0
}

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


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

* Re: clear terminal after display of less, <, and apropos
  1998-10-15 18:09       ` Bart Schaefer
@ 1998-10-15 19:29         ` Bart Schaefer
  1998-12-15  2:08         ` problem with prompt Brian Harvell
  1 sibling, 0 replies; 11+ messages in thread
From: Bart Schaefer @ 1998-10-15 19:29 UTC (permalink / raw)
  To: Roland Jesse, zsh-users

On Oct 15, 11:09am, Bart Schaefer wrote:
> Subject: Re: clear terminal after display of less, <, and apropos
> However -- and to keep this discussion relevant to zsh-users -- I just
> remembered a little zsh script called "fixinfo" that I wrote long ago

I just noticed that there's an omission in the output intended for use
with "eval `fixinfo`":

> [[ -t 1 ]] || echo export TERM=\""$newterm"\"\; export TERMCAP=\""$TERMCAP"\"

There should also be an "export TERMINFO=..." in that output, like so:

[[ -t 1 ]] || echo export TERM=\""$newterm"\"\;\
		   export TERMCAP=\""$TERMCAP"\"\;\
		   export TERMINFO=$TERMINFO


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

* problem with prompt
  1998-10-15 18:09       ` Bart Schaefer
  1998-10-15 19:29         ` Bart Schaefer
@ 1998-12-15  2:08         ` Brian Harvell
  1998-12-15  3:50           ` Bart Schaefer
  1 sibling, 1 reply; 11+ messages in thread
From: Brian Harvell @ 1998-12-15  2:08 UTC (permalink / raw)
  To: zsh-users


This is for zsh-3.1.5

When using %c (or %.) in your PROMPT you get the literal text "~PWD" except 
when you are in your home you get ~ (A pwd of ~/bin also returns the literal 
text "~PWD")

Brian


Brian Harvell                harvell@aol.net             http://ToolBoy.com/
echo '[q]sa[ln0=aln256%Pln256/snlbx]sb3135071790101768542287578439snlbxq'|dc




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

* Re: problem with prompt
  1998-12-15  2:08         ` problem with prompt Brian Harvell
@ 1998-12-15  3:50           ` Bart Schaefer
  0 siblings, 0 replies; 11+ messages in thread
From: Bart Schaefer @ 1998-12-15  3:50 UTC (permalink / raw)
  To: Brian Harvell, zsh-users

On Dec 14,  9:08pm, Brian Harvell wrote:
} Subject: problem with prompt
}
} When using %c (or %.) in your PROMPT you get the literal text "~PWD"

This occurs when the AUTO_NAME_DIRS option is set, because PWD is no
longer a "special" paramter in 3.1.5.  A patch to special-case PWD to
change this has been posted to zsh-workers and may appear in the next
release.

Meanwhile, you can either turn off the AUTO_NAME_DIRS option, or use

	precmd() {
	    unhash -d PWD
	    # ... other commands ...
	}

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


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

end of thread, other threads:[~1998-12-15  3:53 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-10-14 21:33 clear terminal after display of less, <, and apropos Roland Jesse
1998-10-15  1:25 ` Bart Schaefer
1998-10-15  2:22   ` Geoff Wing
1998-10-15  9:11   ` Mircea Damian
1998-10-15 13:22     ` Paul Lew
1998-10-15 14:46       ` Zoltan Hidvegi
1998-10-15 18:09       ` Bart Schaefer
1998-10-15 19:29         ` Bart Schaefer
1998-12-15  2:08         ` problem with prompt Brian Harvell
1998-12-15  3:50           ` Bart Schaefer
1998-10-15 14:58     ` clear terminal after display of less, <, and apropos Greg Badros

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).