3

Further sqlite-mode extensions

 1 year ago
source link: https://xenodium.com/further-sqlite-mode-extensions/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

27 August 2023 Further sqlite-mode extensions

I've continued poking at Emacs 29's sqlite-mode. Since my last post on extensions, I've experimented a little with adding a handful of interactive functions:

  • sqlite-mode-extras-compose-and-execute: Compose and execute a query.
compose-execute.gif
  • sqlite-mode-extras-execute: Execute a query.
execute.gif
  • sqlite-mode-extras-add-row: Add row to table at point.
add-row.gif
  • sqlite-mode-extras-delete-row-dwim: Similar to sqlite-mode-delete but also enables deleting range in region.
delete-rows.gif
  • sqlite-mode-extras-refresh: Refreshes the buffer re-querying the database.
  • sqlite-mode-extras-ret-dwim: If on table, toggle expansion. If on row, edit it.
  • sqlite-mode-extras-execute-and-display-select-query: Executes a query and displays results.
select-earth.gif

I've been playing with the following key bindings:

(use-package sqlite-mode-extras
  :bind (:map
         sqlite-mode-map
         ("n" . next-line)
         ("p" . previous-line)
         ("b" . sqlite-mode-extras-backtab-dwim)
         ("f" . sqlite-mode-extras-tab-dwim)
         ("+" . sqlite-mode-extras-add-row)
         ("D" . sqlite-mode-extras-delete-row-dwim)
         ("C" . sqlite-mode-extras-compose-and-execute)
         ("E" . sqlite-mode-extras-execute)
         ("S" . sqlite-mode-extras-execute-and-display-select-query)
         ("DEL" . sqlite-mode-extras-delete-row-dwim)
         ("g" . sqlite-mode-extras-refresh)
         ("<backtab>" . sqlite-mode-extras-backtab-dwim)
         ("<tab>" . sqlite-mode-extras-tab-dwim)
         ("RET" . sqlite-mode-extras-ret-dwim)))

The code lives in sqlite-mode-extras.el under my Emacs config repo. Beware, it's fairly experimental and hasn't been tested thoroughly.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK