branch: elpa/emacsql commit ed86b098ce341997058e6fa4c06a84c96ed7ee2d Author: Christopher Wellons <well...@nullprogram.com> Commit: Christopher Wellons <well...@nullprogram.com>
Add prefix arg to emacsql-show-last-sql. --- emacsql.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/emacsql.el b/emacsql.el index 623c340a25..e8f4a36a02 100644 --- a/emacsql.el +++ b/emacsql.el @@ -272,9 +272,13 @@ A statement can be a list, containing a statement with its arguments." collect (intern (format "$%d" i)))))) ;;;###autoload -(defun emacsql-show-last-sql () - "Display the compiled SQL of the s-expression SQL expression before point." - (interactive) - (emacsql-show-sql (emacsql-flatten-sql (preceding-sexp)))) +(defun emacsql-show-last-sql (&optional prefix) + "Display the compiled SQL of the s-expression SQL expression before point. +A prefix argument causes the SQL to be printed into the current buffer." + (interactive "P") + (let ((sql (emacsql-flatten-sql (preceding-sexp)))) + (if prefix + (insert sql) + (emacsql-show-sql )))) ;;; emacsql.el ends here