zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: An example of writing a custom history file?
Date: Mon, 15 Dec 2014 00:37:17 -0800	[thread overview]
Message-ID: <141215003717.ZM24212@torch.brasslantern.com> (raw)
In-Reply-To: <CANCp2gYhs8S863OfkMb824QHPx0xPq2cYqJ_8sB8qd-2N91CHg@mail.gmail.com>

On Dec 15,  2:09am, Rocky Bernstein wrote:
}
} Thanks for the pointer. That program is too complicated and there is too
} much going on for me to understand which parts add to the history file. I'm
} guessing it has something to do with the
} zle .push-line.

Well, no, it doesn't have anything to do with that at all.

} Here is the 138 line program boiled down to less than 10,  the parts I'd
} like to focus on:
} 
}     #!/usr/bin/zsh
}     fc -ap /tmp/example_history 1000
}     # Read lines and add them to history
}     local sticky
}     while vared -h -p "hey: "  sticky
}     do
}         print $sticky
}         sticky=''
}     done

You've missed the important bit, which is the -s option to print.  THAT
is what adds lines to the history.

I probably should have pointed you to the example zshaddhistory hook in
the documentation.

} Additionally what I would like to do in the body of the loop decide whether
} or not to add this to the history.

    # Pseudo-code
    if this_line should be added to the history
    then print -sR "$this_line"
    fi


  reply	other threads:[~2014-12-15  8:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-15  1:38 Rocky Bernstein
2014-12-15  2:53 ` Bart Schaefer
2014-12-15  7:09   ` Rocky Bernstein
2014-12-15  8:37     ` Bart Schaefer [this message]
2014-12-15 14:26       ` Rocky Bernstein
2014-12-15 16:14         ` Bart Schaefer
2014-12-15 17:05           ` Rocky Bernstein
2014-12-15 17:46             ` Peter Stephenson
2014-12-15 18:22             ` Mikael Magnusson
2014-12-16  3:58               ` Rocky Bernstein
2014-12-15 18:26             ` Bart Schaefer
2014-12-15 18:34               ` Mikael Magnusson
2014-12-16 11:36                 ` Peter Stephenson
2014-12-16  5:57               ` Rocky Bernstein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=141215003717.ZM24212@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).