Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
xelxebar opened this issue Feb 6, 2020 · 5 comments
Closed

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

xelxebar opened this issue Feb 6, 2020 · 5 comments

Comments

@xelxebar
Copy link

xelxebar commented Feb 6, 2020

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
Copy link
Owner

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

@xelxebar
Copy link
Author

xelxebar commented Feb 6, 2020

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
Copy link
Author

xelxebar commented Feb 6, 2020

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
Copy link
Owner

  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
Copy link
Author

xelxebar commented Feb 6, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants