Code Monkey home page Code Monkey logo

emacs-sqlite3-api's People

Contributors

ikappaki avatar pekingduck avatar reflektoin avatar tarsius avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

emacs-sqlite3-api's Issues

I get some warnings when did make'

Hi,
I did followings:
git clone https://github.com/pekingduck/emacs-sqlite
cd emacs-sqlite3-api/
make
gcc -g3 -Wall -std=c99 -I. -fPIC -c sqlite3-api.c
In file included from sqlite3-api.c:1041:0:
consts.c: In function ‘emacs_module_init’:
consts.c:266:55: warning: passing argument 2 of ‘env->make_integer’ makes integer from pointer without a cast [-Wint-conversion]
defconst(env, "sqlite-static", env->make_integer(env, SQLITE_STATIC));
^~~~~~~~~~~~~
consts.c:266:55: note: expected ‘intmax_t {aka long int}’ but argument is of type ‘void (*)(void )’
consts.c:267:58: warning: passing argument 2 of ‘env->make_integer’ makes integer from pointer without a cast [-Wint-conversion]
defconst(env, "sqlite-transient", env->make_integer(env, SQLITE_TRANSIENT));
^~~~~~~~~~~~~~~~
consts.c:267:58: note: expected ‘intmax_t {aka long int}’ but argument is of type ‘void (
)(void *)’
gcc -shared -o sqlite3-api.so sqlite3-api.o -lsqlite3
rm sqlite3-api.o

Is this normal?

Best, Pal

emacsql urges to install sqlite3 for magit what crashes Emacs

I swim upstream from here syl20bnr/spacemacs#15992. Read at the end for extra details.

Description :octocat:

I recently performed a clean install of Spacemacs (because of reasons) with rm -rf ~/.emacs.d && git clone [...] && emacs. After that, when accessing the status of a git repository, a message would urge me to install sqlite3 (reported at r/spacemacs). Doing so and issuing M-m g s crashes Emacs.

Reproduction guide 🪲

  1. Clean install Spacemacs with git layer enabled
  2. Start Emacs (everything is installed)
  3. Install sqlite3
    • OS' dynamic library: in a shell type sudo apt install libsqlite3-{0,dev}
    • Emacs' pacakge, add sqlite3 to dotspacemacs-additional-packages (M-m f e d)
  4. Restart Emacs, issue M-m q R
    • If not installed yet, Emacs will download sqlite3
  5. Open a git repository
  6. Check status, issue M-m g s
    • If not built yet, Emacs will compile sqlite3.el
  7. Repeat steps 4-5-6

Observed behaviour: 👀 💔

  • Emacs should crash after completing step 7.
  • If in a first round steps 3-4 are omitted, emacsql will eventually print the the following message.
Warning (emacsql): Since your Emacs does not come with
built-in SQLite support [1], but does support C modules, the best
EmacSQL backend is provided by the third-party `sqlite3' package
[2].

Please install the `sqlite3' Elisp package using your preferred
Emacs package manager, and install the SQLite shared library
using your distribution's package manager.  That package should
be named something like `libsqlite3' [3] and NOT just `sqlite3'.

In the current Emacs instance the legacy backend is used, which
uses a custom SQLite executable.  Using an external process like
that is less reliable and less performant, and in a few releases
support for that might be removed.

[1]: Supported since Emacs 29.1, provided it was not disabled
     with `--without-sqlite3'.
[2]: https://github.com/pekingduck/emacs-sqlite3-api
[3]: On Debian https://packages.debian.org/buster/libsqlite3-0 Disable showing Disable logging

Expected behaviour: ❤️ 😄

  • Emacs should not crash.
  • Installation of sqlite3 should be taken care of by the git layer or at least be documented.
    • In this sense,libsqlite3-dev is only needed at compile time.

System Info 💻

  • sqlite3: libsqlite3-dev 3.37.2-2ubuntu0.1
  • OS: Ubuntu 22.04 LTS
  • Emacs: 28.1
  • Spacemacs: 0.999.0
  • Spacemacs branch: develop (rev. 0bbb41ec9)
  • Graphic display: t
  • Running in daemon: nil
  • Distribution: spacemacs
  • Editing style: emacs
  • Completion: helm
  • Layers:
(auto-completion better-defaults bibtex
                 (c-c++ :variables c-c++-backend 'lsp-clangd)
                 emacs-lisp epub git helm html
                 (julia :variables julia-backend 'lsp julia-repl-switches "--threads 8")
                 (latex :variables latex-enable-auto-fill nil latex-enable-magic nil)
                 (lsp :variables lsp-julia-default-environment "~/.julia/environments/v1.8")
                 markdown mu4e multiple-cursors octave org pdf
                 (shell :variables shell-default-position 'right shell-default-shell 'vterm)
                 shell-scripts spacemacs-org spell-checking syntax-checking version-control treemacs
                 (yaml :variables yaml-enable-lsp t))
  • System configuration features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM XWIDGETS GTK3 ZLIB

Backtrace 🐾

I don't know.

Extra details ➕

Under Arch Linux / Emacs 28.2, things are ok. Therefore, I guess there must be something distro related. Moreover, pay attention to the steps to reproduce: at the first run, there is no crash. I have to go through step 7 to trigger the crash, which means to have to restart Emacs after sqlite3-api.so has been built.

Adding this package to NonGNU Elpa

I am preparing for the release of emacsql 4.0.0.

This adds two new SQLite backends. The new preferred backend uses the new built-in SQLite support in Emacs 29. If that cannot be used, then the other new backend, which uses your module, should be used. Only if that isn't available either should the old backend be used, which uses a custom sqlite binary.

(Also see magit/emacsql#113)

Since emacsql is also available from NonGNU-devel Elpa, and will be available from NonGNU Elpa once I release 4.0.0, it would be good to add this package there as well. Otherwise users that aren't yet on Emacs 29 would be stuck on the old backend, which uses the binary.

If you agree, I can take care of proposing that in emacs-devel and add the necessary metadata.

Add version & tag

Hello @pekingduck,

I'm packaging this repository for GNU Guix. Could you please help me with this and add a version to this Emacs package and create a Git tag for it? This would allow me to get rid of these warnings when linting this package via guix lint.

/home/roman/workspace/guix/gnu/packages/emacs-xyz.scm:5741:14: warning: no tags were found for emacs-sqlite3-api
/home/roman/workspace/guix/gnu/packages/emacs-xyz.scm:5741:14: [email protected]: updater 'github' failed to find upstream releases

Thanks, Roman.

sqlite3-api module not loaded after first time compilation from MELPA

Hi,

the sqlite3-api module is not loaded after it is first build from MELPA and throws an error when trying to use any of the module functions:

Symbol's function definition is void: sqlite3-set-log-level

To reproduce

  1. Create a file issue.el that will install sqlite3 from MELPA in a temporary package directory, load the package and then try to call the sqlite3-set-log-level fn
(let* ((tmp-dir (make-temp-file "" t))
       (package-user-dir tmp-dir))
  (message "::Initializing package system in %s" tmp-dir)
  (unwind-protect
      (progn 
        (require 'package)
        (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
        (package-initialize)

        (message "::Installing SQLite3 package...")
        (package-install 'sqlite3)
        (message "::Loading SQLite3...")
        (require 'sqlite3)
        ;; (require 'sqlite3-api)
        (message "::Setting SQLite3 log level...")
        (sqlite3-set-log-level 0)
        (message "::Done"))

    ;; remove temp dir
    (delete-directory tmp-dir t)))
  1. Execute above with Emacs on the command line, an error is raised that it can't find the sqlite3-set-log-level fn. Even though loading the sqlite3 package was successful.
 $  emacs -Q --batch -l issue.el
::Initializing package system in c:/Users/xyz/AppData/Local/Temp/WflbzL
::Installing SQLite3 package...
Importing package-keyring.gpg...
Importing package-keyring.gpg...done
Contacting host: elpa.gnu.org:443
Package refresh done
Contacting host: elpa.nongnu.org:443
Contacting host: elpa.nongnu.org:443
Package refresh done
Contacting host: melpa.org:443
Package refresh done
Setting `package-selected-packages' temporarily since "emacs -q" would overwrite customizations
Setting `package-selected-packages' temporarily since "emacs -q" would overwrite customizations
Contacting host: melpa.org:443
Parsing tar file...
Parsing tar file...done
Extracting... \
Extracting...done
  INFO     Scraping files for loaddefs...
  INFO     Scraping files for loaddefs...done
  GEN      sqlite3-autoloads.el
Checking c:/Users/xyz/AppData/Local/Temp/WflbzL/sqlite3-20230315.1221...
Compiling c:/Users/xyz/AppData/Local/Temp/WflbzL/sqlite3-20230315.1221/sqlite3-autoloads.el...
Compiling c:/Users/xyz/AppData/Local/Temp/WflbzL/sqlite3-20230315.1221/sqlite3-pkg.el...
Compiling c:/Users/xyz/AppData/Local/Temp/WflbzL/sqlite3-20230315.1221/sqlite3.el...
Done (Total of 1 file compiled, 2 skipped)
Package `sqlite3' installed.
::Loading SQLite3...
::Setting SQLite3 log level...

Error: void-function (sqlite3-set-log-level)
...
Symbol's function definition is void: sqlite3-set-log-level

What happened here is that the package compiled the sqlite-api.c file but it has not loaded.

Contrast that if we uncommented the (require 'sqlite3-api) line, and run the same command on the shell, the sqlite3-set-log-level` is found and no exception is thrown:

$ emacs -Q --batch -l issue.el
::Initializing package system in c:/Users/xyz/AppData/Local/Temp/uCgL0E
::Installing SQLite3 package...
Importing package-keyring.gpg...
Importing package-keyring.gpg...done
Contacting host: elpa.gnu.org:443
Contacting host: elpa.gnu.org:443
Package refresh done
Contacting host: elpa.nongnu.org:443
Package refresh done
Contacting host: melpa.org:443
Contacting host: melpa.org:443
Package refresh done
Setting `package-selected-packages' temporarily since "emacs -q" would overwrite customizations
Setting `package-selected-packages' temporarily since "emacs -q" would overwrite customizations
Contacting host: melpa.org:443
Parsing tar file...
Parsing tar file...done
Extracting... \
Extracting...done
  INFO     Scraping files for loaddefs...
  INFO     Scraping files for loaddefs...done
  GEN      sqlite3-autoloads.el
Checking c:/Users/xyz/AppData/Local/Temp/uCgL0E/sqlite3-20230315.1221...
Compiling c:/Users/xyz/AppData/Local/Temp/uCgL0E/sqlite3-20230315.1221/sqlite3-autoloads.el...
Compiling c:/Users/xyz/AppData/Local/Temp/uCgL0E/sqlite3-20230315.1221/sqlite3-pkg.el...
Compiling c:/Users/xyz/AppData/Local/Temp/uCgL0E/sqlite3-20230315.1221/sqlite3.el...
Done (Total of 1 file compiled, 2 skipped)
Package `sqlite3' installed.
::Loading SQLite3...
::Setting SQLite3 log level...
::Done

The expectation here is that the module is loaded even when sqlite3 is required and has to do the compilation, providing a seamless experience to the user.

patch to follow.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.