all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* sqlite library
@ 2022-12-10  0:35 Ag Ibragimov
  2022-12-10  7:42 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ag Ibragimov @ 2022-12-10  0:35 UTC (permalink / raw)
  To: emacs-devel

I wrote a prototype of a package that queries a sqlite DB, but only
later realized that built-in support for it was added in Emacs 29 (the version
I use).
I want to make the package compatible with older versions of Emacs (at
least down to 27). I checked package repositories, it seems there are a
few packages out there (and I don't know which one to use).

What's the best and most straightforward option here for me?

Can you someone advise me what should I use, what should I put in
`Package-Requires:`; maybe the best would be to point to a simple
package with a similar problem?

If I use an external package anyway, does it make sense to check for the
availability of the built-in functions? Or I should somehow load the
external package only when it detects Emacs version prior to 29?

Thank you.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: sqlite library
  2022-12-10  0:35 sqlite library Ag Ibragimov
@ 2022-12-10  7:42 ` Eli Zaretskii
  2022-12-10 15:14 ` Daniel Kraus
  2022-12-10 15:27 ` Stefan Monnier
  2 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2022-12-10  7:42 UTC (permalink / raw)
  To: Ag Ibragimov; +Cc: emacs-devel

> From: Ag Ibragimov <agzam.ibragimov@gmail.com>
> Date: Fri, 09 Dec 2022 18:35:07 -0600
> 
> I wrote a prototype of a package that queries a sqlite DB, but only
> later realized that built-in support for it was added in Emacs 29 (the version
> I use).
> I want to make the package compatible with older versions of Emacs (at
> least down to 27). I checked package repositories, it seems there are a
> few packages out there (and I don't know which one to use).
> 
> What's the best and most straightforward option here for me?

Use the function sqlite-available-p to find out whether the current
Emacs session has built-in support for SQLite.  If sqlite-available-p
is not fboundp, you know it's an Emacs version older than 29;
otherwise call it to see if it returns non-nil to see if SQLite
support was compiled in.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: sqlite library
  2022-12-10  0:35 sqlite library Ag Ibragimov
  2022-12-10  7:42 ` Eli Zaretskii
@ 2022-12-10 15:14 ` Daniel Kraus
  2022-12-10 15:27 ` Stefan Monnier
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel Kraus @ 2022-12-10 15:14 UTC (permalink / raw)
  To: Ag Ibragimov; +Cc: emacs-devel

Hi!

Ag Ibragimov <agzam.ibragimov@gmail.com> writes:

> What's the best and most straightforward option here for me?
>
> Can you someone advise me what should I use, what should I put in
> `Package-Requires:`; maybe the best would be to point to a simple
> package with a similar problem?

I know forge uses a defcustom to decide which connector to use
with the `emacsql` package.

https://github.com/magit/forge/blob/3ab86bb44073e48ff7e6e432b6b4d2af12e45295/lisp/forge-db.el#L40-L63

Maybe this helps.
Cheers,
  Daniel



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: sqlite library
  2022-12-10  0:35 sqlite library Ag Ibragimov
  2022-12-10  7:42 ` Eli Zaretskii
  2022-12-10 15:14 ` Daniel Kraus
@ 2022-12-10 15:27 ` Stefan Monnier
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2022-12-10 15:27 UTC (permalink / raw)
  To: Ag Ibragimov; +Cc: emacs-devel

> Can you someone advise me what should I use, what should I put in
> `Package-Requires:`; maybe the best would be to point to a simple
> package with a similar problem?

See https://elpa.gnu.org/packages/triples.html

It does not announce any dependency in its `Package-Requires:` (other
than Emacs≥25 and `seq`).  Instead it checks at runtime whether/which
kind of sqlite support is available:

  (unless (pcase-exhaustive triples-sqlite-interface
              ('builtin
               (and (fboundp 'sqlite-available-p) (sqlite-available-p)))
              ('emacsql (require 'emacsql nil t)))
    (error "The triples package requires either Emacs 29 or the emacsql package to be installed."))

`Package-Requires:` is just a tool to help users install the package;
it doesn't have to be "exact".


        Stefan




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-12-10 15:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-10  0:35 sqlite library Ag Ibragimov
2022-12-10  7:42 ` Eli Zaretskii
2022-12-10 15:14 ` Daniel Kraus
2022-12-10 15:27 ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.