Skip to content

Please make it easy to define new products #86

Open
@dcolascione

Description

@dcolascione

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions