leahneukirchen / mblaze

Unix utilities to deal with Maildir
Other
441 stars 48 forks source link

mless: Making use of the switch in the "main loop" #171

Closed xelxebar closed 4 years ago

xelxebar commented 4 years ago

Browsing mless's source, I notice a "main loop" with an inner case statement. It looks to be switching on the exit code of less, supposedly letting one do convenient things like mark messages read, toggle raw/html modes, etc. from within mless. The exit codes acting as ascii codes is nifty.

This behaviour is completely undocumented in mless(1) and, reading through less(1) I can find no way to produce the necessary exit codes. Am I simply missing something obvious?

leahneukirchen commented 4 years ago

See mlesskey.example. This is not yet documented, indeed.

xelxebar commented 4 years ago

Beautiful, thanks.

Apparently, I did miss something sort of obvious. Should have noticed the LESSKEY setting right above the loop!

Might be nice to document this in mless(1).

xelxebar commented 4 years ago

Also, where did you find out about the ability to give arguments to quit and noaction. The allowable commands aren't really documented all the well in lesskey(1). Directly from the source?

leahneukirchen commented 4 years ago
  An action may be followed by an "extra" string.  When such a command is
  entered while running less, the action is performed, and then the extra
  string is parsed, just as if it were typed in to less.  This feature
  can be used in certain cases to extend the functionality of a command.
  For example, see the "{" and ":t" commands in the example below.  The
  extra string has a special meaning for the "quit" action: when less
  quits, first character of the extra string is used as its exit status.
xelxebar commented 4 years ago

Sigh. I completely missed that in my skimming. Thanks.