emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ivan Sokolov <ivan-p-sokolov@ya.ru>
To: emacs-orgmode@gnu.org
Subject: [PATCH] ob-sql: blocks without :engine get stuck in org-edit-src-code on indent
Date: Tue, 20 Apr 2021 18:41:06 +0300	[thread overview]
Message-ID: <877dkxc6b1.fsf@ya.ru> (raw)

[-- Attachment #1: Type: text/plain, Size: 260 bytes --]

user-error in sql-set-product interrupts normal execution flow in
org-indent-line for sql blocks without :engine.

Provided patch is not the best solution, but I do not have the time or
inclination to mess around with anything outside of the org-mode itself.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ob-sql-do-not-stuck-on-user-error-in-sql-set-product.patch --]
[-- Type: text/x-patch, Size: 891 bytes --]

From 8768e1c245ab0c0d2d8f8ac830f39ac89d23a839 Mon Sep 17 00:00:00 2001
From: Ivan Sokolov <ivan-p-sokolov@ya.ru>
Date: Tue, 20 Apr 2021 18:22:21 +0300
Subject: [PATCH] ob-sql: do not stuck on user-error in sql-set-product

---
 lisp/ob-sql.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-sql.el b/lisp/ob-sql.el
index 7c359b988..4e61253bf 100644
--- a/lisp/ob-sql.el
+++ b/lisp/ob-sql.el
@@ -98,7 +98,9 @@
 Set `sql-product' in Org edit buffer according to the
 corresponding :engine source block header argument."
   (let ((product (cdr (assq :engine (nth 2 info)))))
-    (sql-set-product product)))
+    (condition-case _error
+        (sql-set-product product)
+      (user-error))))
 
 (defun org-babel-sql-dbstring-mysql (host port user password database)
   "Make MySQL cmd line args for database connection.  Pass nil to omit that arg."
-- 
2.31.1


             reply	other threads:[~2021-04-20 15:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-20 15:41 Ivan Sokolov [this message]
2021-04-30  7:16 ` Bastien
2021-04-30 11:40   ` Ivan Sokolov
2021-05-01 10:29     ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877dkxc6b1.fsf@ya.ru \
    --to=ivan-p-sokolov@ya.ru \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).