octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Interest in selectively deleting history entries.


From: Daniel J Sebald
Subject: Re: Interest in selectively deleting history entries.
Date: Sun, 21 Sep 2014 14:17:55 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16

On 09/21/2014 12:50 PM, Philip Nienhuis wrote:
Daniel Sebald wrote
I'm curious what people's thoughts are on the ability to selectively
delete individual lines of history.  What I see it used for, in
particular, is removing a password the user accidentally types and hits
return.  That could happen if the user thinks the account is locked but
it is actually the monitor's screen saver.

Yep - recognized, but maybe not so urgent as -I suppose- it rarely happens.

It's not common, but at the same time I wouldn't call it rare. When someone (I) concentrate on a problem, typing away, it's pretty easy to type a screen password because it's something done so often, almost habitual.


And it doesn't only hold for Octave but also for shells etc.

Yes, I know. At least in that case one can clear the screen fairly quickly. With Octave GUI one's password would sit plain as day in the history window. And as you pointed out regarding shells, with so many windows open the history is fragmented and only good for about the last five lines. But with Octave, people might have a complex sequence of commands they want to remember/retrieve down the road.


Octave's
history file is an editable text file so there is a way out.

Yes, but hardly convenient to save, exit, edit, launch.


While we are at history, another nice thing would be the ability to delete
multiple identical history entries and only retain the last one - ideally as
a configurable setting. At times I have countless "dbstep"/"dbnext" entries
that just clobber up the history.

I hear you there. Keep hitting up arrow and re-running a command and there's a big string of the same command in history. I see history as a very configurable thing. There is the way that lines are stored in history. There is also the way they are displayed and retrieved. For example, one could save every line in history while only display (and step through) lines that are contiguously unique. Say I hit the up-arrow and retrieve the previous command three times. History might be displayed as:

x = 1;
y = x + 1;
y = y^2;
y = y^2;
y = y^2;
history

...
1003 x = 1;
1004 y = x + 1;
1007 y = y^2;

That is, every line has a unique number, but not all are displayed.


If the relevant code is in .m-shape (rather than C++) I could have a look
myself.

history is a builtin command.  It would need to be C++.


I think I saw that the internal list code has the ability to delete
individual lines.  So that part is straightforward.  The question is
what to do with the numbering.  If a line is deleted, should there just
be a hole in the numbering sequence where the line used to be?  I think
it is probably preferred to not change the number of a line in history
once it is assigned.  So that would make an extra level of mapping the
list number to a command-line number.

Is there a use for numbered history if there is nothing in the history
command that can act on the line number?

I suppose the history "memory" is limited?
How does the numbering work? Does it start counting from the very first item
in the history list (after having read<history_file>) or just at the first
command of the newly started Octave session?

The history list loads at 1, so when starting the session it's likely your first command will be number 1001, if your history length is 1000.


In case of the former, what happens when two or more Octave sessions run
simultaneously on the same box (happens regularly here) and write their
history to file (same file!) when closed down?

All of this makes me assume that the history entry number makes most sense
as a per-session counter. But that's just me.

It is per-session, yes.


Thinking about it, relying on a history entries' number, while without doubt
potentially useful, sounds quite fragile to me.

I agree, but if one were to have a line-deleting feature, the history would have to have a number associated with it...and not change, otherwise that gets confusing. It would be nice to have absolute history line referencing

"history -D 1003"

and relative number referencing, say,

"history -D -2"

because if one is working in the GUI it's easy to see the history window and count backward from the present command.

And I've always been philosophically conflicted with whether the history command itself should go into history. If I delete a line of code, do I really want "history -D -2" to take it's place? Just seems defeating.

History with the pager isn't as convenient as it could be. Is there a way to make the pager go to the bottom (most recent) of the list rather than start at the top (oldest) when running the history command?

Sounds picky, but the things that are used most often should function the most efficiently.

Dan



Philip




--
View this message in context: 
http://octave.1599824.n4.nabble.com/Interest-in-selectively-deleting-history-entries-tp4666612p4666615.html
Sent from the Octave - Maintainers mailing list archive at Nabble.com.



--

Dan Sebald
email: daniel(DOT)sebald(AT)ieee(DOT)org
URL: http://www(DOT)dansebald(DOT)com



reply via email to

[Prev in Thread] Current Thread [Next in Thread]