From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Byung-Hee HWANG Newsgroups: gmane.emacs.devel Subject: Re: sqlite3 Date: Mon, 06 Dec 2021 20:46:19 +0900 Organization: =?utf-8?B?6YeR6Zm1ICjsl7Dsm5DsnZgg66eI7J2MKQ==?= Message-ID: <87lf0y3qic.fsf@penguin> References: <87tufmjyai.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24089"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Dec 06 12:54:53 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 1muCa4-00065s-Kf for ged-emacs-devel@m.gmane-mx.org; Mon, 06 Dec 2021 12:54:52 +0100 Original-Received: from localhost ([::1]:45040 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1muCa2-0001be-QU for ged-emacs-devel@m.gmane-mx.org; Mon, 06 Dec 2021 06:54:50 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:38030) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1muCZA-0000jn-53 for emacs-devel@gnu.org; Mon, 06 Dec 2021 06:54:00 -0500 Original-Received: from [2607:f8b0:4864:20::22a] (port=43763 helo=mail-oi1-x22a.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1muCZ7-0006pb-TK for emacs-devel@gnu.org; Mon, 06 Dec 2021 06:53:55 -0500 Original-Received: by mail-oi1-x22a.google.com with SMTP id o4so20936110oia.10 for ; Mon, 06 Dec 2021 03:53:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=doraji.xyz; s=yw; h=from:to:subject:organization:references:mail-followup-to:date :in-reply-to:message-id:user-agent:mime-version :content-transfer-encoding; bh=fy3RjBsDXwjDnnNpW3fgawPs6S+Jr6ZfGgKmdPi6NhE=; b=H64VksOfonPQhrPIDhN3QsPTmbtJBm5LNDDYjT+GL/qpwcjGnb/ovG5D3acAZpAuK+ gzdBUbJX5D09wZlci+thxDj9yVWt67kJN7EDwAC6xHD2Azt0GRIzV134HB8awCUAmn6X TNEY4YA/aUZ7KWMU785E6r+9Q7BVlO9/UttACda/fuN3PP4YWH2UmWO6mE5usYI7YpG0 6sN9a9LyNJ/GoV2cQYcH0ujxQYNKn64gQLPoVDzy3WXiDe7HuQeGBpggGNBJkTDOtCFZ 4GNKjLoPSh2G05cuggZszHf9dMcYlV56+2bkc/baEiVdaUZ7T9EfPw84H5mOMSj5hmYB f7NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:organization:references :mail-followup-to:date:in-reply-to:message-id:user-agent :mime-version:content-transfer-encoding; bh=fy3RjBsDXwjDnnNpW3fgawPs6S+Jr6ZfGgKmdPi6NhE=; b=U2srU0NWcT8hIWjEVW2l7kfb0r3dopv9MsjlLzIF7bR9+MPrT6ZRlx7s+lLwflCpc5 WXh0Pqi7jIaAs3wljHMVrLtow+erW77YJP/fTxErHOyhiBaDBZszmJtyiXAUvebf+Yza lgFQ6QiuOePW5CaaKdOIWfj3Gu7ysOb9O9AHI+PYXnXwjdEFIuMe/G6K1kwmdmAmhuDk gIcwwpD4a68f7t4Uc9t0mHG6UcVZzup4LYfOj/9r7RfHcC2iB3wQb2wRFI9ncieb5ljM cei1PbPP7Dv/t/G2G638pe90R3ggdQjvSaMDwzHoYWHJMJlUTREL8rDR0+glVlBheV/a aI7w== X-Gm-Message-State: AOAM530+5kGvjIgOOQCsE6nSoAM9cxfd/oma6l4HOVLDfAPEA3S7Ps/i JJsU6XtzAIz3SdSeN3i+zFgB470IH7vsk84i X-Google-Smtp-Source: ABdhPJxqXz4jSbljahyvnEMgjviSq0hI0KejBW+pJqXf7Hc2o6GboDt0UPLfCwWa68qFDqGjlf+yMg== X-Received: by 2002:a17:90b:1a87:: with SMTP id ng7mr37032590pjb.230.1638791190230; Mon, 06 Dec 2021 03:46:30 -0800 (PST) Original-Received: from penguin ([2001:2d8:6690:e538:216:3eff:fe15:56c0]) by smtp.gmail.com with ESMTPSA id w19sm9816118pjh.10.2021.12.06.03.46.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Dec 2021 03:46:29 -0800 (PST) Original-Received: by penguin (sSMTP sendmail emulation); Mon, 06 Dec 2021 20:46:20 +0900 X-Thanks-Thanks-Thanks: =?utf-8?B?7LKc7ZWY7LC97IOd7J2EIOuBneq5jOyngCDri6Qg?= =?utf-8?B?7IK066as7Iuc66Ck64qUIOuniOydjC4uLl5eXg==?= X-Thanks-Right-Mindset: 'toothless' & 'hiccup' X-Thanks-Absolete-Coding-System: UTF-8 X-Operating-System: =?utf-8?B?4omqZGluZ+KJqw==?= -- The Gnus X-Gnus-Motto: In a cloud bones of steel. X-Gnus-Desktop: Debian GNU/Linux 11 (bullseye) ^^^ wayland-0 Mail-Followup-To: emacs-devel@gnu.org In-Reply-To: (Arthur Miller's message of "Mon, 06 Dec 2021 11:25:36 +0100") X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::22a (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::22a; envelope-from=soyeomul@doraji.xyz; helo=mail-oi1-x22a.google.com X-Spam_score_int: 10 X-Spam_score: 1.0 X-Spam_bar: + X-Spam_report: (1.0 / 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, FROM_SUSPICIOUS_NTLD=0.499, PDS_HP_HELO_NORDNS=0.001, PDS_OTHER_BAD_TLD=1.854, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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:281080 Archived-At: Arthur Miller writes: > 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--favor= ites) >> >> 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--favor= ites) > > looks to me like something one would use customize for. > > Also in general since we can read/write lisp objects easily in elisp it i= s 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 use= d it > myself, and it felt trivial to use in my app. Objects that are not serial= izable > will not be serializable to sql either, without some extra work, so there= is not > much win to use sqllite db instead of hashmap.=20 > > Anyway I still think sqlite in core would be nice; I have thought of it s= everal > 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:=20 > > (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. +1, very much!!! Sincerely, Gnus fan Byung-Hee --=20 ^=EA=B3=A0=EB=A7=99=EC=8A=B5=EB=8B=88=EB=8B=A4 _=E5=92=8C=E5=90=88=E5=9C=98= =E7=B5=90_ =EA=B0=90=EC=82=AC=ED=95=A9=EB=8B=88=EB=8B=A4_^))//