1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-25 17:20:25 +02:00

31872: zshaddhistory hook example needs options.

Only works with INCAPPENDHISTORY or SHAREHISTORY set.
This commit is contained in:
Peter Stephenson 2013-10-16 09:49:55 +01:00
parent f6967bb745
commit 441c19c161
2 changed files with 12 additions and 4 deletions

View file

@ -1,3 +1,8 @@
2013-10-16 Peter Stephenson <p.stephenson@samsung.com>
* 31827: Doc/Zsh/func.yo: options needed for example. Only
works with INCAPPENDHISTORY or SHAREHISTORY.
2013-10-15 Peter Stephenson <p.stephenson@samsung.com>
* unposted: Doc/Zsh/func.yo: trivial typo in zshaddhistory doc.

View file

@ -274,10 +274,13 @@ that in the global tt(HISTFILE) parameter. This is handled specially:
the history context is automatically restored after the processing
of the history line is finished.
The following example function first adds the history line to the normal
history with the newline stripped, which is usually the correct behaviour.
Then it switches the history context so that the line will
be written to a history file in the current directory.
The following example function works with one of the options
tt(INC_APPEND_HISTORY) or tt(SHARE_HISTORY) set, in order that the line
is written out immediately after the history entry is added. It first
adds the history line to the normal history with the newline stripped,
which is usually the correct behaviour. Then it switches the history
context so that the line will be written to a history file in the
current directory.
example(zshaddhistory+LPAR()RPAR() {
print -sr -- ${1%%$'\n'}