New paste Repaste Download
;; You probably already have this, but I'm pulling it in for the -compose function.
(use-package dash
  :ensure t)
(use-package sql
  :ensure nil
  :config
  ;; [2025-05-13 Tue 06:27] MariaDB prompts were getting accidentally deleted without this.
  ;; https://emacs.stackexchange.com/a/14158/37580
  (setopt comint-prompt-read-only t)
  (add-to-list
   'sql-product-alist
   '(sqlite :name               "SQLite"
            :free-software      t
            :font-lock          sql-mode-sqlite-font-lock-keywords
            :sqli-program       sql-sqlite-program
            :sqli-options       sql-sqlite-options
            :sqli-login         sql-sqlite-login-params
            :sqli-comint-func   sql-comint-sqlite
            :list-all           ".tables"
            :list-table         ".schema  %s"
            :completion-object  sql-sqlite-completion-object
            :prompt-regexp      "^sqlite> "
            :prompt-length      8
            :prompt-cont-regexp "^   \\.\\.\\.> "
            :input-filter       sql-placeholders-filter))
  (add-to-list
   'sql-product-alist
   '(mariadb :name               "MariaDB"
             :free-software      t
             :font-lock          sql-mode-mariadb-font-lock-keywords
             :sqli-program       sql-mariadb-program
             :sqli-options       sql-mariadb-options
             :sqli-login         sql-mariadb-login-params
             :sqli-comint-func   sql-comint-mariadb
             :list-all           "SHOW TABLES;"
             :list-table         "DESCRIBE %s;"
             :prompt-regexp      "^MariaDB \\[.*]> "
             :prompt-cont-regexp "^    [\"'`-]> "
             :syntax-alist       ((35 . "< b"))
             :input-filter       (-compose sql-remove-tabs-filter sql-placeholders-filter)))
  )
;; Perfect And Aesthetic SQL Indentation
;; highly recommended
(use-package sql-indent
  :ensure t
  :hook ((sql-mode . sqlind-minor-mode)))
;; Not everyone will like sql-up-mode because it's imperfect and buggy.
;; However, when it works, it's nice.
;; Uninstall it if you don't like it.
(use-package sqlup-mode
  :ensure t
  :hook ((sql-mode . sqlup-mode)
(sql-interactive-mode . sqlup-mode))
  :config
  (setq sqlup-blacklist '("name" "user" "binary" "changes"
  "check" "connection" "open" "output"
  "parameter" "read" "schema" "session"
  "system")))
Filename: sql-setup.el. Size: 2kb. View raw, , hex, or download this file.

This paste expires on 2025-07-03 19:03:15.794380. Pasted through web.