eless

A Better 'less' - A bash script that loads emacs with minimal view-mode config - Created with Org mode

MIT License

Stars
132

#+title: Eless - A Better Less #+author: Kaushal Modi [[https://github.com/kaushalmodi/eless/actions][https://github.com/kaushalmodi/eless/actions/workflows/test.yml/badge.svg]]

[[https://eless.scripter.co][Documentation]]


[[https://github.com/kaushalmodi/eless][eless]] is a combination of Bash script and a minimal emacs =view-mode= config.

This script is designed to:

  • Be portable -- Just one bash script to download to run
  • Be independent of a user's emacs config
    • /You can still [[https://eless.scripter.co/#user-config-override][customize]] the =eless= config if you like./
  • Not require an emacs server to be already running

It was created out of a need to have something /like/ =less= (in the sense of /launch quickly, do, and quit/), but /better/ in these ways:

  • Syntax highlighting
  • Org-mode file rendering
  • A better navigable man page viewer
  • A better Info viewer
  • Dired, especially =wdired= (batch edit symbolic links, for
    example?)
  • Colored diffs, =git diff=, =git log=, =ls=, etc. (auto ANSI
    detection)
  • Filter log files to only show (or not show) lines matching a regexp
  • Auto-revert log files when I want (like =tail -f=)
  • Quickly change frame and font sizes
  • .. and more; basically everything that emacs has to offer!

I call it =eless= and here's a little taste of what it looks like:

[[https://raw.githubusercontent.com/kaushalmodi/eless/master/docs/images/eless-examples.png][https://raw.githubusercontent.com/kaushalmodi/eless/master/docs/images/eless-examples.png]]

/Shown above, starting from top left image and proceeding clock-wise../

  • =eless eless.org=
  • =rg --color=ansi 'man pages' | eless= (rg[[https://github.com/BurntSushi/ripgrep][?]])
  • =man grep= (I have set my =PAGER= env var to =eless=.)
  • =info eless= (I have aliased =info= to ='\info !* | eless'= in my
    tcsh shell.)
  • =eless .= (Shows the current directory contents in =dired=.)
  • =diff= of =eless.org= with an older saved version and piping the
    result to =eless=

Meta Features

  • This script passes [[https://www.shellcheck.net][ShellCheck]], and
  • Unofficial Bash /strict mode/[fn:1] is enabled.
  • Always-in-sync documentation as the =eless= script and
    documentation are generated using Org Babel from [[https://github.com/kaushalmodi/eless/blob/master/eless.org][one file]] (even this
    README).
  • The [[https://eless.scripter.co][documentation site]] is generated on-the-fly on Netlify using
    that same /one file/.
  • This bash script has tests too!

[fn:1] http://redsymbol.net/articles/unofficial-bash-strict-mode/

  • Requirements
    |-----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
    | Software | Details |
    |-----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
    | =emacs= | If only running the =eless= script, the mininum required emacs version is 22.1 (manually tested). If developing (running =make all html test=), the minimum required version is 25.3. |
    | =bash= | This is a =bash= script. So even if you don't use =bash= shell, you need to have the =bash= binary discoverable through your environment variable =PATH=. /Tested to work in =tcsh= shell on RHEL 6.6./ |
    | =perl= | Perl is used to replace =grep -Po= and case-insensitive =sed= based replacements (using =/I=) as those features are available only in GNU versions of =grep= and =sed= (which are not present by default on /macOS/ systems). /Tested with Perl v5.16.3 on RHEL 6.6./ |
    | =texinfo= | Required to generate the eless Info manual (when doing =make install=) |
    |-----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
  • NOTE 1 :: If the environment variable =EMACS= is set, =eless= uses
    that as the emacs binary, else it defaults to using =emacs= as emacs
    binary.
  • NOTE 2 :: eless is known to not work with /info (texinfo) 6.1/ (see
    =eless= issue #[[https://github.com/kaushalmodi/eless/issues/35][35]]). If you want to use eless to view Info manuals,
    ensure that it is at least version 6.5.
  • Installation
    ** Manual installation
    *** Clone this rep
    For the following instructions, let's assume that you clone this repo
    to =~/downloads/eless=.
    #+begin_src shell
    git clone https://github.com/kaushalmodi/eless ~/downloads/eless
    #+end_src
    *** Run make
    #+begin_src shell
    cd /downloads/eless
    make install PREFIX=
    /.local
    #+end_src
    *** Installation Directory Structure
    The above make install will install the eless script and
    documentation in a directory structure like this:
    #+begin_example