Hi, 1. The manpages for less and lesskey are not in sync. lesskey mentions $HOME/.lesskey, while less mentions $HOME/.less. ~/.less seems correct (peeking at both binaries with Emacs). http://www.sourcentral.org/man/debian-unstable/1+less http://www.sourcentral.org/man/debian-unstable/1+lesskey 2. The manpage for less is not very understandable to the casual user w.r.t. the location of the system-wide lesskey file. It mentions /usr/local/etc/sysless and a sysconf directory. The user not used to building packages him/herself won't know that this translates to /etc/sysless. Possibly the Debian manpage could be more explicit. 3. Possibly Debian should switch the system wide conf file to /etc/default/xyz (and then mention this Debian-specific location in the manpage). 4. Creating a .less file results in Cannot use lesskey file "/home/hoehle/.less" message touch ~/.less Rename it to .lesskey and it gets ignored. Invoking $ cp -p .less .lesskey $ less -k ~/.lesskey Bugs.txt produces Cannot use lesskey file "/home/hoehle/.less" Cannot use lesskey file "/home/hoehle/.lesskey" (Press RETURN) Afterwards, hitting return once returns to the prompt but produces garbage on the last line of my Gnome-terminal: URN) is left displayed in front of the prompt (if you have a short prompt). The prompt then always appears on the bottommost line of the tty, even when started via $ clear $ less -k ~/.lesskey .bashrc This is unusual. Normally less restores the tty completely, and the prompt is one line below the previous command line. Here's a snapshot: [last commands were: $ PS1='\u$ '; clear; ] hoehle $ less -k ~/.lesskey .bashrc ~20 empty lines... hoehle$ (press RETURN) -- in inverse video I tried to create a .less file according to the syntax describe in man lesskey, but I always got the above error. I went to http://www.greenwoodsoftware.com/less but found no mention of these bugs. Regards, Jörg Höhle. Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.15-27-686 Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) As you can see, I'm running Ubuntu Debian. To me, an Ubuntu system is a kind of Debian system, and I prefer to submit bugs that I'm sure affect both upstream directly, instead of going through a heavy hierarchy.
Hi,
I found this bug report from 2006 after thinking that I had run into the
same problem. But then I noticed that parts #1 and #4 of the bug report
are not actually bugs, except maybe in that the documentation could be
more clear.
Apparently less has a slightly unusual way of reading its configuration:
less reads ~/.less but this is _not_ a text file containing settings;
instead, the user should write settings in ~/.lesskey and then run the
lesskey command which reads ~/.lesskey and generates ~/.less (which
appears to be in some binary format).
For instance, these commands make less -M the default option (which I
used to always set in my .profile until now):
$ echo -e '#env\nLESS=-M' >.lesskey
$ lesskey
This is documented in the first (long) paragraph of the lesskey(1)
manual page, but it appears that I didn't read the paragraph to the end
before trying to write a ~/.less file and wondering why it doesn't
work...
Parts #2 and #3 of the original bug report (location of /etc/sysless)
still exist, though. Perhaps the Debian manual page (less(1), KEY
BINDINGS section) could be edited to mention that the file is
/etc/sysless on Debian. (However, since /etc/sysless is also not a text
file but generated by lesskey, possibly Debian should also specify a
default location for the corresponding lesskey input file, e.g.,
/etc/syslesskey.)
Actually, for some reason less seems to look at /usr/bin/.sysless as
well, but that doesn't normally exist so I guess it doesn't matter:
$ strace -eopen less xxxxx
open("/etc/ld.so.cache", O_RDONLY) = 3
open("/lib/x86_64-linux-gnu/libtinfo.so.5", O_RDONLY) = 3
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY) = 3
open("/lib/terminfo/x/xterm", O_RDONLY) = 3
open("/usr/bin/.sysless", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/sysless", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/rjs/.less", O_RDONLY) = 3
open("/home/rjs/.less", O_RDONLY) = 3
open("/usr/lib/locale/locale-archive", O_RDONLY) = 3
open("/home/rjs/.lesshst", O_RDONLY) = 3
open("/dev/tty", O_RDONLY) = 3
open("xxxxx", O_RDONLY) = 5
$
I assume the reason for this unusual way of reading configuration is to
make less start up faster because it doesn't have to parse a text file;
but I'm not sure how relevant that is nowadays when CPUs are fast.