From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 8735 invoked from network); 17 Jul 2021 00:41:15 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 17 Jul 2021 00:41:15 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1626482475; b=1kLpc8GbwQ5mb3AiX8RKbmTUWBS+sUqxQcUrBKU07xoWHa85JhzGnkJ+mVqBzBlyHmnSChDFAW 8Q7P2ckstneCy0fkMTDCRY8fjCR9X85LVoW7Brz38yFoci7Bz8RHQ5169oYtwpgXz5yP1onVv+ 2tDsVQaWZhBMEPrkLJKr6Owoh6C6uz0s6hhz+LLyBRU/3OG84h5NHAkwCx2P1XxG7Xg2yikjnw Vnxpf3Xz64fOMuCZOhxYla/8zeqKq4oG88Dcefdb3Kh3P6YmwMY/yvHKLCukVAVyKVIt7MlufX Qjhue68l6y/3c17F3d7L0z89EMCJk1DIOPojZzoELqrotw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (out2.migadu.com) smtp.remote-ip=188.165.223.204; dkim=pass header.d=jade.fyi header.s=key1 header.a=rsa-sha256; dmarc=pass header.from=jade.fyi; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1626482475; bh=K5C7tWIZFk6xgalYcUYS97l0nq1d5Cn5zGt9TCOfVO8=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:MIME-Version:Date: Message-ID:Subject:From:DKIM-Signature:To:DKIM-Signature; b=Dy87WcwzNf6y1BeLSks6om/DhmTCgaSc5iNf5KO/7AlRPwxUbjZC2JUODsOLoqzhcLt6VDoPET WxKT9vHvbuM23uBpxIkOtWJEh/EnHukq+c3ij5zQ1yWhpu8Ry0oSWqdC5HaFPDAkPUd5Ev/K7t 6Db+teiblA/jfb/aPQhA0IwotLSLiq8gb+Af6kiQUtexXS3tZX8Fc54d5C1lh8UFBLfOpms62s OMYdiDZFL67L6J1pnm6pI4S/5vpidkiCkhnq+2irUVO2XLDGJyJATHI7367tOaeO33ZZ8KhTBt TTvaeaKE0CHwobbwEQVe8E+gLWzPnqLtQn88t2mrIz7EUw==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Date:Message-ID:Subject:From:To:Reply-To:Cc: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References; bh=r/bCmhLttPbQdoV8OPELEi2TZDNIrNNZCgp+OLnIoaE=; b=1lR5iGrbSj2w+2L2huoqNlKFlx p99KBv5gvXn5aauu3CI/nOhrlvo2mf/ToouLV+DZ/T2m3Lh2uRaCiPJy1R1cxBud86ww4d82rKCgh mSOtZ9T8IpVm/St6qYgImbmBcxtUHN+XBYp/dY7dPWWxGtrba4W+KOgCBn2ig2VJ8W3Ng5nwKWi6g CSQJA6RHAAPf2zqLHyNua7AkuF5tigayvFQTJJ/GQiqL2BbSRZZa0F//9HN8+eOZrs6QL7BsfeRu+ SdVYknx2ucxzytHntLTD7mAmuqm5jo23kCSsmlN9OGegDoLo4HRqwRZ7dm7/IY07i/dodfuqV0ehd BzluLp6Q==; Received: from authenticated user by zero.zsh.org with local id 1m4YOI-000O9g-7g; Sat, 17 Jul 2021 00:41:14 +0000 Authentication-Results: zsh.org; iprev=pass (out2.migadu.com) smtp.remote-ip=188.165.223.204; dkim=pass header.d=jade.fyi header.s=key1 header.a=rsa-sha256; dmarc=pass header.from=jade.fyi; arc=none Received: from out2.migadu.com ([188.165.223.204]:39241) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1m4YNj-000NpK-Mi; Sat, 17 Jul 2021 00:40:40 +0000 To: zsh-workers@zsh.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jade.fyi; s=key1; t=1626482437; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=r/bCmhLttPbQdoV8OPELEi2TZDNIrNNZCgp+OLnIoaE=; b=nc1fqFHkr78Xs5/FK5neMWeJHrzMFEV9Zn56oikN/uM5hE1enVN+OVrXeugwe95RSkQb5T FDLdgD+zITlqbR7T6OGkBEUrac0ZEx7Jt8rFtLI4r1vmQPM03kWq+TPypT70mcVT1LsV5L v/qVZ9ku92GL/2C0PT7oqTIN777Sqeg= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Jade Fink Subject: Allowing for replacing the history backing store? Message-ID: <6013019d-8746-ebf9-b7aa-e971e6741b7c@jade.fyi> Date: Fri, 16 Jul 2021 17:40:31 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: i@jade.fyi X-Seq: 49167 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Hi! There's a project I've been thinking about for a long while which is to make a new shell history system using Postgres, allowing for keeping better metadata such as working directory among other things with the history and eliminating the need to use a traditional history file. I want to implement it as a native-code ZSH module (maintained out of tree), ideally. From poking around the zsh codebase briefly, it seems like there is not really currently a way to do that as the history functions are built into zsh itself rather than a module. Before I write a patch, I want to run it past you to see if it's reasonable and there's not an easier way to do it otherwise. I was thinking of putting pointers to all the history functions that one might need to change out to implement a new back end in a structure and have a pointer to it so you can change it out for your own set (that may do something else to fulfil the request such as poke a database or something else), then replace all the functions with indirections, e.g.: struct histfuncs { char *(*hgetline)(void); // ... } mod_export struct histfuncs default_histfuncs = { .hgetline = default_hgetline, // ... } mod_export struct histfuncs *histfuncs = &default_histfuncs; char * hgetline(void) { return histfuncs->hgetline(); } If I implemented this approach, would such a patch be taken? Jade