From 441c19c16147f6ce9d0748b4495892ea353a30fb Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 16 Oct 2013 09:49:55 +0100 Subject: 31872: zshaddhistory hook example needs options. Only works with INCAPPENDHISTORY or SHAREHISTORY set. --- Doc/Zsh/func.yo | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'Doc/Zsh/func.yo') diff --git a/Doc/Zsh/func.yo b/Doc/Zsh/func.yo index 78bdfc0fa..1f58df86a 100644 --- a/Doc/Zsh/func.yo +++ b/Doc/Zsh/func.yo @@ -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'} -- cgit 1.4.1