<<< Date Index >>>     <<< Thread Index >>>

Re: save_history not working



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Monday, November  5 at 12:42 PM, quoth dv1445@xxxxxxxxx:
>> $save_history only affects the limit placed on the file, not the 
>> limit mutt places on itself. Thus, $save_history is only used if 
>> $save_history < $history (AND if $save_history > 0, but for an 
>> entirely different reason).
>
> OK, I will fiddle with $history.  I did read that part of the 
> manual, but $history has been around, while $save_history is new (I 
> think),

Relatively new, yes.

> so I thought $save_history superceded $history, as a massive 
> improvement (as in, "hey, now you're not limited to 10 commands, you 
> can have as many as you want").

You've never been limited to only 10 commands; that's just the default 
setting. You can set $history as big as you want.

> Also, the docs say that $history clears itself every time it's set, 
> so I thought that with "set history=100" in the .muttrc, it would 
> get cleared every time I started mutt,

Yes, the history *buffer* gets cleared whenever the variable is set.

> and would therefore behave exactly as I've been used to before 
> rather than in the way I thought the new feature would work (i.e., 
> saving as many commands as you want even when you quit mutt and 
> start up again).

It's a question of whether the $history_file is read into the history 
buffer before or after the muttrc is read and executed. Of course, 
reading $history_file BEFORE the muttrc is read and executed makes no 
sense, because the muttrc is supposed to be able to tell mutt what 
file to read. Thus, if the history file is only read AFTER the muttrc 
is read, then the history buffer will be filled AFTER the $history 
variable has been set. Thus, setting $history in your muttrc does NOT 
(and cannot) empty the history buffer that was read in from the 
$history_file.

>> Ah, well, the thing the documentation leaves out here is that if 
>> $save_history is 0, there is no limit to the size of the 
>> $history_file (I think). Probably worth checking by setting 
>> save_history to 1, but I *think* that's the way it works.
> 
> I also noticed that not only does :set &save_history ?save_history 
> return 0 when I set it to 100, but also, :set $history returns 10 
> even when I set it to 100.  Either I've screwed up or mutt isn't 
> reporting values correctly.

Just what do you think ":set &save_history" does? Just FYI, that's the 
same as ":reset save_history". It sets the variable back to the 
default value. So whenever you do ":set &save_history ?save_history" 
mutt is going to first set $save_history to its default value (0) and 
then print whatever $save_history is set to, namely, the default value 
(0). In other words this sequence of commands:

     :set save_history=100
     :set &save_history ?save_history

Is exactly equivalent to this sequence of commands:

     :set save_history=100
     :reset save_history
     :set ?save_history

The default value of $history is 10. Thus, if you do this:

     :set history=100
     :set &history ?history

Then OF COURSE it's going to tell you that $history is 10, because you 
just told mutt to reset it back to its default value.

To find out what a variable is set to, all you need to do is this:

     :set ?history

Or, my personal favorite, type ":set history=" and then hit the tab 
key.

~Kyle
- -- 
Mathematicians stand on each other's shoulders while computer 
scientists stand on each other's toes.
                                                       -- R. W. Hamming
-----BEGIN PGP SIGNATURE-----
Comment: Thank you for using encryption!

iD8DBQFHL1qcBkIOoMqOI14RAsPzAJ9LG8T7TUuahZtwAZyQwjqKE/74OQCg9n0w
Yo5GDwEQzgxa1pCIiPMGAKc=
=t1hY
-----END PGP SIGNATURE-----