From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arthur Miller Newsgroups: gmane.emacs.devel Subject: Re: sqlite3 Date: Mon, 06 Dec 2021 11:25:36 +0100 Message-ID: References: <87tufmjyai.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31287"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Dec 06 12:00:03 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1muBiz-0007oC-Vy for ged-emacs-devel@m.gmane-mx.org; Mon, 06 Dec 2021 12:00:03 +0100 Original-Received: from localhost ([::1]:48278 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1muBiy-0006x6-7M for ged-emacs-devel@m.gmane-mx.org; Mon, 06 Dec 2021 06:00:00 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:46058) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1muBWK-0001Vm-HU for emacs-devel@gnu.org; Mon, 06 Dec 2021 05:46:57 -0500 Original-Received: from mail-oln040092068017.outbound.protection.outlook.com ([40.92.68.17]:17379 helo=EUR02-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1muBWH-0006eC-In for emacs-devel@gnu.org; Mon, 06 Dec 2021 05:46:55 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MtDhk3Xh44X3mM0fuR+UeCnuWHBe+pLvYdI8aqiOcDshuboppA4lQ885eDI6+cHewsOEx6tDH5XYPX2Ja3zgNzvNTj/FtbZx7wwT55wwgCy6STBS/fgM51PJUzuyDgZZv/J8J2UoSV1ipwjsQZK5Ku4medRpx0pz+2iRHtlMOIhce+18ZBDw6GfkRv6ano5bc+iLzqYqQQhlmgmNcFScN689LHS0VaoJH8HOH5Lg7FdOjk61toZtBOOcsMY7H9NBpTYWEdp/wMmczb8Vo0hCuRaCcVQrD4aXPb5OE9sk1sSOJkIzLjYX1/MIj4+IfCUkSvg5qx57M7CYX+XAf56ugg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5Yj3ic97JVOkIvVXHtc0LTr2A307TwOKoEvGe/SERRI=; b=DZmvrNUaNHEb1MvYVE3B/9PSjL70ZQDkF5tlY9eVpe/HFhmVPoLpjtaSprI/oKhYi+JEYcIJ+r292qQ8w9BUxynwQambEt9Uy49NJWR+dSbGI20s7beCqK2ZY5cXQebLT6qYR5J0VMjiAhVCZjZgmRDeuo/S5pRD0Tl4jP+pyIRBGYIVLnJhdU2N8FtEGepdcPZHy61FJTlLAi9GQPLE8fmLUjKq8AKjwuoZGW3sHXlTdz/m3csoWh5WUbi0fovmm9E3EcEe3n5etQNTUMMdHBpUSaSgWlAx/2KdiwRTJWLGuo+EpT6YguWgR6IAyskqNIBYTrOTHaTYdcKJ8rjxZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5Yj3ic97JVOkIvVXHtc0LTr2A307TwOKoEvGe/SERRI=; b=NaSjA7G16P+ZpTVf9Zr0UFoiqaVkQNMUu2GHh0zqNdJ3a4UchIo+QLY8hgRRGGt5sEwyredjGU3rRSwKqQ2IUyCHJIFginbAn8MmMwEBPRZtcTxtubOeb4mexjYpy8rqqLQT6wnNWqVXo+95bCPx5zhtARfx2su5NQLozFx6RFo6kJ1pXwq7XRV+w558en1AXcgfSPDRXVK/1TB4MAIC45MZPcIdtkm9zMphr14ahIpIsLJ20Om43exG2zES0AuH23ff1F8/pEcfknO3yi6GZgSnYyvizzF4bG0FH2VR70LniVVCz914xR+1L8cR5+7BTV077z/X1KaQS2o4/bYKzw== Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) by AM0PR09MB3777.eurprd09.prod.outlook.com (2603:10a6:208:188::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.11; Mon, 6 Dec 2021 10:25:48 +0000 Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::b012:5fd9:9447:d64a]) by AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::b012:5fd9:9447:d64a%4]) with mapi id 15.20.4755.021; Mon, 6 Dec 2021 10:25:46 +0000 In-Reply-To: <87tufmjyai.fsf@gnus.org> (Lars Ingebrigtsen's message of "Mon, 06 Dec 2021 02:51:33 +0100") X-TMN: [TYijAkMqwa3mJfxJeaGP/Pkn/x60H4y2] X-ClientProxiedBy: GV3P280CA0116.SWEP280.PROD.OUTLOOK.COM (2603:10a6:150:8::15) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <87tufmav33.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (81.232.177.30) by GV3P280CA0116.SWEP280.PROD.OUTLOOK.COM (2603:10a6:150:8::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.11 via Frontend Transport; Mon, 6 Dec 2021 10:25:46 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b587658f-940f-461e-6c75-08d9b8a2c404 X-MS-TrafficTypeDiagnostic: AM0PR09MB3777:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0ICaa4lLI5S49Dg61naC+TS60tyLCZGgJMmrtfQucsifL7l7biJnYc4+QH6Eq/qG1VntTSSILMPdBa8MCzIVvgfZbp20PosnxCPhZYl3CAsBVdRq+EpwmqubotV5XqgR4Rv0dwO5laNKYslLR8rUcOZxTXtFMNVqTbZeau/pD1oQNgXjEVCIE9S3W388pun6hL3wtLM1/MMkhcrH8HPLXeMIRTK+x8LJ3cB4f8hxGt+ojr5HJFOHaO7wMBfF3KluHqskQku+jGA0q6oTSH4YTOaEjfGd2GUTErfspLkLzWGrsxLxveDKicy/prpDej4ynEXSkTQBpd+fW91+MGX7qwbz7AuSdzOY3BldrrNLVAIXdfhwyQB/CNtGgCqwg8gxXG+pG0iv0sZDXAaO2nlsd7WjLeRsRZvP6fRlvqH7J7AenbNL3+yD04g72VYSwveUuMuwaXg81bB8MNFhtTAxgLQmSWFq2bOIZj83H3R3eoj4T2KB3KP5Cjojcq1LHAtyNSrioMfCGlpl5CBNCF21MaRJCTWthMFg1hy2VdsGroq5nAqR76U77F053qSw7M9kwjVm5GQSAPkKTzeS8vfBtU6PvPcQbFFwV3rg3QJlM8wnI0CtznZA7vJ68Zma/yyr X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?lIpIZWqePqaEa90XqbZ2OuEeKyWXLxsr55hiN2hTHS6COwS8MjYHxHVEQbI4?= =?us-ascii?Q?RlrFK911+UUaOXHOrlgsJwPt82hurmXjt1ouhAgF9QVocJQ17NGESsTmV0KL?= =?us-ascii?Q?Y869OEF6c9XAWmgRLrtjni2KRoJaxaxhFTnONxNzj8lyKqSsydr0D6/khdAP?= =?us-ascii?Q?LpSa9yksJzhrlcgr+IABmm3W6n2YM9+f1yEUKObrWNhYIviggObMGuoUkakd?= =?us-ascii?Q?dTcXoqWGkg3uvAXbfsadfkU1TYUf2lk5zkiNxp9N6C0B+/RD5oxTMB2gX/qW?= =?us-ascii?Q?8KDpxMLd/KkmNCRo6nLRhkOOzT08Qr7AIVYGnhZFhHnorEzRp/ra1IqTrse/?= =?us-ascii?Q?fk3uWlQzMxVWpSDqQ9GggWz02w0h5vCbO4LPW4R8RaaV/auZeKGg0DrIKg07?= =?us-ascii?Q?V7Hf931ySK/k/oIFXxT7IIGbNdZnDqpnLq6gnnMiNTTJDFrKI+dPEiGdKuey?= =?us-ascii?Q?H/PGABQF5k+iuRgPuA7o9wEgjT+iAxE9PJ3aWr7oRPiEYeNaXZyVy4LHYu4E?= =?us-ascii?Q?W2Nn9NiEFvIKU/m1UD5R0crBHuppTuhIklf/JfbG7Axi/fHRDhQI8Ya8L/UR?= =?us-ascii?Q?qmnvUmRWiEPctpDZIoExJP+YqadPG00lSVEt6/LuC8UYz+SwWf4p/CvcGDs0?= =?us-ascii?Q?ZI X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-64da6.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: b587658f-940f-461e-6c75-08d9b8a2c404 X-MS-Exchange-CrossTenant-AuthSource: AM9PR09MB4977.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2021 10:25:46.7471 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR09MB3777 Received-SPF: pass client-ip=40.92.68.17; envelope-from=arthur.miller@live.com; helo=EUR02-HE1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:281078 Archived-At: Lars Ingebrigtsen writes: > I think many user experience things in Emacs would be better if Emacs > remembered more. > > The bigger systems don't have this problem -- Gnus needs a large > .newsrc.eld file, and it maintains that. > > The tiny things don't really have this problem, either: You save options > with `customize-save-variable', and that fine. > > It's the many things that fall between these two extremes that have the > problem: Where you want to store some state, but figuring it's just too > much work to figure out Yet Another Storage Format, but the data is too > messy to stash in somebody's .emacs file via Customize (like lists of > stuff). > > So there's a bunch of stuff that Emacs just forgets when you shut down, > where it perhaps shouldn't. I would definitely like to see sqlite in core and avialable by default. I really love it and think it is a great as application/desktop database. I think it would open for some nice applications people could write. > I've brought this up before, but I didn't really have a solution then, > but I think I do now: sqlite3. > > sqlite3 is supported on more platforms than Emacs is, the interface is > small and stable, and (best of all) somebody has already created > interface functions for Emacs (via a module): > > https://github.com/syohex/emacs-sqlite3 > > I think it'd be good to bring that into core, and then write a small > wrapper library (well, a trivial ORM) for the rest of Emacs to use, so > that we don't have to write SQL all over the place. That is: > > (setf (persistent-data :namespace "emoji" :key "favorites") emoji--favorites) > > I.e., what Emacs needs is a persistent key/value store, and this would > give us that. > In addition, if somebody really wants to write SQL stuff (it can be very > handy for some things), having sqlite3 in there gives us that in > addition for free. > > This comes with questions about how the users are supposed be able to > clear out the data, for instance, but we could have a `M-x > list-persistent-data' where the users could blow out whatever they want > to. My only remark is that sqlite is usually used for exactly same purpose as what Emacs already has: customize. Your example: > (setf (persistent-data :namespace "emoji" :key "favorites") emoji--favorites) looks to me like something one would use customize for. Also in general since we can read/write lisp objects easily in elisp it is not hard to serialize/deserialize a hashmap or an assoc list as an application key-value db. I don't know how many application does this, but I have used it myself, and it felt trivial to use in my app. Objects that are not serializable will not be serializable to sql either, without some extra work, so there is not much win to use sqllite db instead of hashmap. Anyway I still think sqlite in core would be nice; I have thought of it several times myself. Back to your example, I also wonder if api, as suggested in your example could be done so it in addition also can automatically take applications prefix as namespace and variable name as key, so your example could look like: (defgroup my-app nil "My cool app." :prefix 'my-app- :group 'applications) (defcustom my-app-emoji-favorites nil "List of most used emojis." :persist t :type 'list :group 'my-app) (setf (persistent-data 'my-app-emoji-favorites) my-app-emoji--favorites) And if we could also have more declarative api for defvars: (defvar my-app-foo 'bar "Foo property of my-app." :persist t) Just thoughts.