emacs-sql-indent icon indicating copy to clipboard operation
emacs-sql-indent copied to clipboard

Please make it easy to define new products

Open dcolascione opened this issue 6 years ago • 1 comments

I work on a system with an extended version of the SQL language, and I'd like to be able to teach sql-indent to understand this system. There's no way to provide an external language definition, though, as one can with cc-mode. For example, we have functions that look like this. (Docstring snipped for concision.)

(defun sqlind-beginning-of-directive ()
  (let ((rx (cl-case (and (boundp 'sql-product) sql-product)
              (ms sqlind-ms-directive)
              (sqlite sqlind-sqlite-directive)
              (oracle sqlind-sqlplus-directive)
              (t nil))))
    (when rx
      (save-excursion
        (when (re-search-backward rx nil 'noerror)
          (forward-line 1)
          (point))))))

IMHO, it'd be better to just dispatch on the product somehow (with defgeneric, a function table, o something) instead of hardcoding the case here. This way, it'd be possible to much more easily customize the system.

dcolascione avatar Jun 14 '19 17:06 dcolascione

This sounds like a good improvement, but it is a large task and I don't have the time to work on it.

If you or anyone else wants to do it, I will accept the patches. Alternatively, it might be simpler just to update sql-indent directly.

alex-hhh avatar Jun 15 '19 06:06 alex-hhh