From: Andreas Gerler <baron@bundesbrandschatzamt.de>
To: Daniel Kraus <daniel@kraus.my>
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG] ob-sql sql-connection-alist
Date: Fri, 20 Jan 2023 18:24:41 +0100 [thread overview]
Message-ID: <CA3B77D5-E81E-4475-940B-8533AA69BCF8@bundesbrandschatzamt.de> (raw)
In-Reply-To: <87cz7ebwig.fsf@kraus.my>
[-- Attachment #1.1: 0001-lisp-ob-eval.el-Display-error-fix.patch --]
[-- Type: application/octet-stream, Size: 1873 bytes --]
From db391f4123a62aa214741d6b1eb43b0a1e06f1b9 Mon Sep 17 00:00:00 2001
From: Andreas Gerler <baron@bundesbrandschatzamt.de>
Date: Sat, 7 Jan 2023 14:04:03 +0100
Subject: [PATCH] * lisp/ob-eval.el: Display error fix
* lisp/ob-eval.el: (org-babel-eval-error-notify): Display standard
error only if command exits non zero.
The problem is that sql connections might give warnings.
Now the information is available in the *Org-Babel Error* buffer
without displaying.
If you need always display toggle org-babel-eval-error-display-notify.
Signed-off-by: Andreas Gerler <baron@bundesbrandschatzamt.de>
---
lisp/ob-eval.el | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/lisp/ob-eval.el b/lisp/ob-eval.el
index 6f6edb949..f4659fe96 100644
--- a/lisp/ob-eval.el
+++ b/lisp/ob-eval.el
@@ -36,6 +36,12 @@
(defvar org-babel-error-buffer-name "*Org-Babel Error Output*")
(declare-function org-babel-temp-file "ob-core" (prefix &optional suffix))
+(defcustom org-babel-eval-error-display-notify nil
+ "Display org-babel-eval-errors always or only if exit code is not 0."
+ :group 'org-babel
+ :version "29.1"
+ :type 'boolean)
+
(defun org-babel-eval-error-notify (exit-code stderr)
"Open a buffer to display STDERR and a message with the value of EXIT-CODE."
(let ((buf (get-buffer-create org-babel-error-buffer-name)))
@@ -45,7 +51,10 @@
(unless (bolp) (insert "\n"))
(insert stderr)
(insert (format "[ Babel evaluation exited with code %S ]" exit-code))))
- (display-buffer buf))
+ (when (or org-babel-eval-error-display-notify
+ (or (not (numberp exit-code))
+ (> exit-code 0)))
+ (display-buffer buf)))
(message "Babel evaluation exited with code %S" exit-code))
(defun org-babel-eval (command query)
--
2.39.0
[-- Attachment #1.2: Type: text/plain, Size: 1108 bytes --]
> On 16. Jan 2023, at 11:25, Daniel Kraus <daniel@kraus.my> wrote:
>
> Hi!
>
> Andreas Gerler <baron@bundesbrandschatzamt.de> writes:
>
>> Last week I heard about using ob-sql with credentials stored in the variable used by isql.
>> However I had to modify ob-sql to get it actually working.
>> Can somebody test the pach before I send in a commit?
>>
>> #+begin_src sql :engine mysql :dbconnection testdb
>> show tables;
>> #+end_src
>
> I actually use this feature daily.
> You have to quote the dbconnection. So this works currently:
>
>> #+begin_src sql :engine mysql :dbconnection 'testdb
>
> but I would agree that not needing the quote makes sense.
> And since `assoc-string` works with symbol and string (i.e. it's backwards compatible)
> I would install the patch if you send it.
>
>> I was considering writing another patch to map the sql-product to engine.
>> That way we could get rid of another parameter in the src block.
>> Opinions?
>
> I agree. Specifying :engine when it's already in the connection-alist is unnecessary.
>
> Thanks,
> Daniel
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 874 bytes --]
next prev parent reply other threads:[~2023-01-20 17:25 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-15 16:00 [BUG] ob-sql sql-connection-alist Andreas Gerler
2023-01-16 10:25 ` Daniel Kraus
2023-01-20 17:24 ` Andreas Gerler [this message]
2023-01-20 17:30 ` Andreas Gerler
2023-01-20 20:41 ` Daniel Kraus
2023-01-20 21:03 ` Andreas Gerler
2023-01-21 8:48 ` Ihor Radchenko
2023-01-21 12:15 ` Andreas Gerler
2023-01-22 10:58 ` Bastien Guerry
2023-01-26 10:44 ` Bastien Guerry
2023-01-27 13:13 ` Ihor Radchenko
2023-01-27 13:18 ` Ihor Radchenko
2023-01-27 16:58 ` Andreas Gerler
2023-01-28 14:13 ` Andreas Gerler
2023-01-30 16:59 ` Daniel Kraus
2023-01-16 10:33 ` Ihor Radchenko
2023-01-16 10:45 ` Daniel Kraus
2023-01-16 11:05 ` Ihor Radchenko
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=CA3B77D5-E81E-4475-940B-8533AA69BCF8@bundesbrandschatzamt.de \
--to=baron@bundesbrandschatzamt.de \
--cc=daniel@kraus.my \
--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).