|
From: Daniel J S. <dan...@ie...> - 2007-06-08 18:11:59
|
Before I make changes, lets agree on behavior. Below is a rewrite of the
documentation. Basically, the rule is never discard anything from history,
simply display and next/previous through it according to one of three modes
resembling the bash shell options.
Two unresolved things.
1) What should be the default for {full|ignoredups|condensed}? And why?
2) Can we deprecate "historysize". (I've currently programmed "set history <n>"
and "set historysize <n>" to be the same.)
Dan
-----------
?commands set history
?set history
?unset history
Note: the command `set history` is only available when gnuplot has been
gnuplot has been configured with the GNU readline or its own history feature.
Syntax:
set history {<int>} {numbered|quiet} {full|ignoredups|condensed}
unset history
The value <int> indicates the value of history size when leaving gnuplot. It
is used for truncating the history to at most that many lines. The default
is 666. The option `quiet` will suppress numbers alongside the history, which
is useful for mouse copy and paste.
Options `full`, `ignoredups` and `condensed` control the manner in which
history is displayed and the way in which next/previous step through history.
In `full` mode, gnuplot shows every history entry. In `ignoredups` mode,
whenever there are back-to-back duplicate entries only one is listed. It is
similar in appearance to bash shell history with the "ignoredups" option, but
no commands are actually discarded from gnuplot's history list. `condensed`
mode results in a displayed history with only the most recent unique entries
and is similar in appearance to bash shell history with the "erasedups"
configuration. Again, no commands are actually discarded from history in any
of the modes. This ensures that repeated recall from history by number with
the same number produces the same command.
`unset history` will set history operation to its default settings: no history
truncation at exit and thus allow indefinite number of lines, `full`, and
`numbered`.
----------------
?commands history
?history
`history` command lists, saves or executes previous entries in the history of
the command line editing. The history list is retained in full and as typed
by the user. However, gnuplot may be configured (see `set history`) to display
the history in a variety of abbreviated and quiet formats. In quiet format, no
numbers are listed next to the history commands. In condensed format, only the
most recent of any repeated commands is shown. In ignoredups format, only one
of a succession of duplicate entries is show. The examples below illustrate
several other features:
history # show the history
history 5 # show last 5 entries in the history
history quiet 5 # show last 5 entries without entry numbers
history numbered 5 # show last 5 entries with entry numbers
history "hist.gp" # write the complete history to file hist.gp
history "hist.gp" append # append the complete history to file hist.gp
history 10 "hist.gp" # write last 10 commands to file hist.gp
history 10 "|head -5 >>diary.gp" # write 5 history commands using pipe
history ?load # show all history entries starting with "load"
history ?"set c" # like above, several words enclosed in quotes
hi !reread # execute last entry starting with "reread"
hist !"set xr" # like above, several words enclosed in quotes
hi !hi # possibly recursive, see note below
hi !123 # execute entry numbered 123 in the history list
history full 10 # show every line of last 10 entries
history condensed # show only most recent unique history entries
history ignoredups # show just one of contiguous duplicate entries
hi clear # clear all entries from the history
On systems which support a popen function (Unix), the output of history can be
piped through an external program by starting the file name with a '|', as one
of the above examples demonstrates.
Use of ! to execute old commands in the history list have the potential to be
recursive. For example "hi !hi" may be directly recursive if it itself was
the most recent command. However, there are more indirect, non-obvious ways
to an infinite recursion. For this reason, gnuplot will stop if in any series
of history commands the same line is executed twice.
|
|
From: Daniel J S. <dan...@ie...> - 2007-06-08 18:37:30
|
Ethan Merritt wrote:
> On Friday 08 June 2007 11:11, Daniel J Sebald wrote:
>
>>2) Can we deprecate "historysize". (I've currently programmed "set history <n>"
>>and "set historysize <n>" to be the same.)
>
>
> ??
> I don't understand the question.
> For as far back as I have sources for, "set history" has always been
> shorthand for "set historysize". What, exactly, would you be deprecating?
> If you just mean:
>
> tables.c
> 182: - { "his$torysize", S_HISTORYSIZE },
> 182: + { "his$tory", S_HISTORYSIZE },
>
> I don't see any point.
Well, the following would be kind of awkward:
Syntax:
set historysize {<int>} {numbered|quiet} {full|ignoredups|condensed}
unset historysize
(We're changing the properties of the history. Not the historysize.)
I've changed the table to
{ "hid$den3d", S_HIDDEN3D },
- { "his$torysize", S_HISTORYSIZE },
+ { "his$tory", S_HISTORY },
+ { "historys$ize", S_HISTORYSIZE },
{ "is$osamples", S_ISOSAMPLES },
so that
set his #
set historys #
do the same thing. I'm fine with leaving it like that, but just wonder if
retaining "historysize" as duplicate behavior is that important.
Dan
|
|
From: Daniel J S. <dan...@ie...> - 2007-06-08 18:46:31
|
Daniel J Sebald wrote:
> Ethan Merritt wrote:
>
>>On Friday 08 June 2007 11:11, Daniel J Sebald wrote:
>>
>>
>>>2) Can we deprecate "historysize". (I've currently programmed "set history <n>"
>>>and "set historysize <n>" to be the same.)
>>
>>
>>??
>>I don't understand the question.
>>For as far back as I have sources for, "set history" has always been
>>shorthand for "set historysize". What, exactly, would you be deprecating?
>>If you just mean:
>>
>>tables.c
>>182: - { "his$torysize", S_HISTORYSIZE },
>>182: + { "his$tory", S_HISTORYSIZE },
>>
>>I don't see any point.
Oh, I see what you are saying. Under the gnuplot.doc entry for
?commands set historysize
?set historysize
?unset historysize
?historysize
?nohistorysize
just change every 'historysize' to 'history' and no one will know the
difference. Is that what you meant?
Dan
|
|
From: Petr M. <mi...@ph...> - 2007-06-10 14:56:48
|
> Two unresolved things.
>
> 1) What should be the default for {full|ignoredups|condensed}? And why?
condensed -- it is the current behaviour, and it speeds us browsing and
mouse-copying previous commands
> 2) Can we deprecate "historysize". (I've currently programmed "set history
> <n>" and "set historysize <n>" to be the same.)
change it to 'set history size'
---
PM
|
|
From: Daniel J S. <dan...@ie...> - 2007-06-10 20:49:06
|
Petr Mikulik wrote:
>>Two unresolved things.
>>
>>1) What should be the default for {full|ignoredups|condensed}? And why?
>
>
> condensed -- it is the current behaviour, and it speeds us browsing and
> mouse-copying previous commands
There's an updated patch on SourceForge. "condensed" is default.
>>2) Can we deprecate "historysize". (I've currently programmed "set history
>><n>" and "set historysize <n>" to be the same.)
>
>
> change it to 'set history size'
As Ethan pointed out, just leaving the match string "his$storysize" allows both
set historysize <n>
set history <n>
to work. Of course, that means "set historysize {<n>} {quiet|numbered}
{condensed|ignoredups|full}" works, but because the options are documented as
"set history", the user will not be inclinde to type "set historysize ignoredups".
BTW, I didn't use the phrase "erasedups" (i.e., "condensed") because we aren't
technically erasing anything.
Dan
|
|
From: <pl...@pi...> - 2007-06-13 07:53:33
|
On Sun, 10 Jun 2007 16:56:39 +0200, Petr Mikulik <mi...@ph...>
wrote:
>> Two unresolved things.
>>
>> 1) What should be the default for {full|ignoredups|condensed}? And why?
>
> condensed -- it is the current behaviour, and it speeds us browsing and
> mouse-copying previous commands
I would have said full should be the natural default and users wanting
condenced should set ~/gnuplot.conf or whatever it is. HOWEVER, to save
yet another change to the way things work I'd have to agree with Petr.
Keep current as default. It's important to maintain backwards compat.
>
>> 2) Can we deprecate "historysize". (I've currently programmed "set
>> history
>> <n>" and "set historysize <n>" to be the same.)
>
> change it to 'set history size'
One of my big bugbears with Linux is that every time I need something it
seems someone has done some insignificant little tweek and broken the way
it works. I then have to find out what/why/where and fix it. This is a
futile , mind-blowing waste of time.
This is a good example. If historysize is established in current release
please leave it. The dupe will cost virtually nothing and will save users
with established scipts being faced with extra work and breakage which
serves no real purpose.
There are those of us who like to fiddle with code and others who rely on
it to do a job. We should not reduce the usefulness of the software by
unnecessary changes to the commands.
The history clean up and new features is great but please dont break what
works.
;)
|