patchGNU Octave - Patches: patch #9022, Allow paging of some but not all...


patch #9022: Allow paging of some but not all commands

Submitter:  Lachlan Andrew <lachlan>
Submitted:  Fri 10 Jun 2016 09:14:18 AM UTC
Category:  Core : new feature Priority:  5 - Normal
Status:  Postponed Privacy:  Public
Assigned to:  lachlan Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup

Jump to the original submission

Fri 15 Jul 2016 12:40:34 AM UTC, comment #13: 

Thanks for the review and revision, JWE.  I agree it can wait until after 4.2.  I'll try again to reproduce your error.

Lachlan Andrew <lachlan>
Fri 15 Jul 2016 12:22:40 AM UTC, comment #12: 

I just tried again with ./run-octave -cli --norc, then "more off" at the command line.  When I try

help svd, help help

the output doesn't go through the pager.  Maybe something changed recently that broke this changeset?

Although this might be a useful feature, I'm not sure it is worth the extra complexity.  Either way, I think it can wait until after 4.2.

Also, it needs a small fix to apply to the current sources.  I'm attaching a new version of the patch.

(file #37880)

John W. Eaton <jwe>
Group administrator
Thu 23 Jun 2016 12:54:30 PM UTC, comment #11: 

I've tried to reproduce the problem of not concatenating the output of the two commands, but can't.  I get the attached screenshot with an empty .octaverc -- what settings gave the problem?

Version 4 of the patch includes the new commands in io.txi.

Lachlan Andrew <lachlan>
Thu 23 Jun 2016 06:04:05 AM UTC, comment #10: 

No, it was not intentional :(

Thanks for looking at it.  I'll report back when it works for sequences of commands.

Lachlan Andrew <lachlan>
Thu 23 Jun 2016 05:26:49 AM UTC, comment #9: 

This cset seems to change the behavior of

help help, help help

so that the output from the first command is flushed and only the output of the second command is passed through the pager.  Is that intentional?

Previously, the output from both commands appeared together in the pager.

John W. Eaton <jwe>
Group administrator
Thu 23 Jun 2016 04:40:17 AM UTC, comment #8: 

Oops.  The first line of the commit message was still about the three original commands (help, ls, dir).  This one matches the current summary line.

(file #37555)

Lachlan Andrew <lachlan>
Wed 22 Jun 2016 09:51:42 AM UTC, comment #7: 

Here's an update that allows a list of "always page" and "never page" commands.

(file #37544)

Lachlan Andrew <lachlan>
Sun 19 Jun 2016 10:04:30 AM UTC, comment #6: 

Thanks Philip.  I know that "cat file.txt" can be replaced by "type file.txt", but in this context we need cat to take input from stdin.  I didn't think that "echo hello | cat" could be replaced by "echo hello | type".

Still, the point is moot if there is a different mechanism for explicitly turning paging on and off on a per-command basis, such as comment #4 allows.

Lachlan Andrew <lachlan>
Sat 18 Jun 2016 06:55:08 AM UTC, comment #5: 

FYI, Windows has the "type" command that mimics cat as regards listing files on the screen.  I don't know if it is useful, AFAIK it dates back from the pre-DOS era (CPM etc).

Philip Nienhuis <philipnienhuis>
Group Member
Wed 15 Jun 2016 04:40:48 PM UTC, comment #4: 

How about a list of strings of either "function_name" or "-function_name", where the case with a "-" says "don't page, even if paging is on", and the other one says "page, even if paging is off".

I assume that this would only affect commands entered on the command line, not in scripts.  For simplicity, I'd also make the whole sequence (possibly with semicolons) use the paging determined by the first command, even if subsequent commands after a semicolon would follow a different rule.

Does that sound suitable?

Lachlan Andrew <lachlan>
Wed 15 Jun 2016 01:47:38 AM UTC, comment #3: 

I think of the PAGER function in Octave as a local replacement for the environment variable. It defaults to the value from the environment, I can set it to a different value, but Octave expects that it will always point to some program that can act as the pager.

To me that's not a limitation, just an expectation that there will always be a pager, either the system default one, or one that the user prefers.

Thinking a little more about it now, I actually think some kind of global setting or preference that contains a cell array of function names that should always be paged could work. This could be treated as either an opt-in or opt-out, depending on how we want the value of Vpage_screen_output to interact with these per-function pager settings.

Mike Miller <mtmiller>
Group Member
Wed 15 Jun 2016 12:08:34 AM UTC, comment #2: 

Thanks for the feedback, Mike.  I'll look into pager.attend.

I had been thinking of having a variable that lets the user pick a set of commands whose output should be paged, but went for the simpler option.

I can see a case for paging large vectors, but my code (as I assume much code) outputs very many small values as it progresses.

I'm not sure what you mean by "Having an empty PAGER variable would usually mean that the program picks a default value for you. Which is exactly what Octave does."  That is sensible use of the PAGER environment variable.  This patch doesn't change that.  It just allows Octave's internal PAGER variable to be set explicitly to empty. If you want an empty value to be treated differently, perhaps we should modify "pager_cmd" so that it doesn't test for PAGER being empty.

My first thought was to suggest using "cat", but that doesn't seem to be available on Windows.

I won't lose any sleep if this patch is never applied to the main Octave codebase :) It just serves my needs, and I though others may benefit from it too.  That said, if some tweaks make it acceptable for the main codebase, I'll try to make it as useful as I can.

Lachlan Andrew <lachlan>
Sun 12 Jun 2016 06:09:55 PM UTC, comment #1: 

I'm not sure I agree with the distinction between paging arrays vs paging help texts. I don't see a bright line distinction between wanting some things to be paged and others not. What if I like to use the pager for scrolling through large vectors, but I don't want help text to be paged because it's only 50-100 lines at the most?

If you want to make this more flexible, maybe Octave needs some equivalent to Mercurial's pager.attend variable?

Setting PAGER to "cat" is usually the way to bypass screen paging with the man command for example. Having an empty PAGER variable would usually mean that the program picks a default value for you. Which is exactly what Octave does.

In short I don't know that I would be happy with this change as is, turning more off should affect all commands equally IMHO, so that the pager program is never executed.

Mike Miller <mtmiller>
Group Member
Fri 10 Jun 2016 09:14:18 AM UTC, original submission:  

This patch causes the output of "help", "ls" and "dir" to go through the pager, even when "more" is off.

My code typically outputs lots of progress information, and so I usually run with more off.  However, these commands are normally run interactively, and paginating them helps.

For those who want no paging at all, the patch also makes it possible to set 'pager ("")'.  If anyone knows why this was formerly disallowed, please let me know.

If anyone knows other commands that should override "more off", please let me know.

Lachlan Andrew <lachlan>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #37880:  patch_page_help_ls_dir.v5.cset added by jwe (9KiB - application/octet-stream)
file #37558:  help_help.png added by lachlan (188KiB - image/png)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by lachlan (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follow 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-07-15 lachlan StatusNone Postponed
    2016-07-15 jwe Attached File- Added patch_page_help_ls_dir.v5.cset, #37880
    2016-07-07 lachlan CategoryNone Core : new feature
    2016-06-23 lachlan Attached File- Added patch_page_help_ls_dir.v4.cset, #37559
    2016-06-23 lachlan Attached File- Added help_help.png, #37558
    2016-06-23 lachlan Attached File- Added patch_page_help_ls_dir.v3.cset, #37555
        SummaryPage help, ls, dir, even when &quot;more&quot; is off Allow paging of some but not all commands
    2016-06-22 lachlan Attached File- Added patch_page_help_ls_dir.v2.cset, #37544
    2016-06-10 lachlan Assigned toNone lachlan
    2016-06-10 lachlan Attached File- Added patch_page_help_ls_dir.cset, #37444

    Back to the top

    Powered by Savane 3.13-c54d.
    Corresponding source code