summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Culpepper <samuel@samuelculpepper.com>2022-08-11 11:28:17 +0200
committerBastien Guerry <bzg@gnu.org>2022-08-11 12:15:30 +0200
commitdba097229e8909202fcb4f67766464e0fc13b321 (patch)
tree06a9abdab24ffe4366013ea3203c97af39fe7731
parentc6aef31ccfc7c4418c3b51e98f7c3bd8e255f5e6 (diff)
lisp/org-eldoc.el: Fix propertizing of non-string header args
sql-mode exposes a header-arg ~:dbport~, which accepts only number args[fn:1], yet ~org-eldoc-get-src-header~ uses ~string=~ to quick-exit in the propertizing lambda, which operates directly on the header args given by ~org-babel-get-src-block-info~; in which there is no value normalisation, thus can yield /any/ type, given that a header arg may some arbitrary elisp expression. Here we cast all objects to their printed representation using the string directive ~%s~. [fn:1] this numeric arg however, is only enforced by ~org-babel-sql-dbstring-*~ for most vendors, as: (when port (format "-p%d" port))
-rw-r--r--lisp/org-eldoc.el6
1 files changed, 4 insertions, 2 deletions
diff --git a/lisp/org-eldoc.el b/lisp/org-eldoc.el
index 1a4e670..5b4f66d 100644
--- a/lisp/org-eldoc.el
+++ b/lisp/org-eldoc.el
@@ -81,11 +81,13 @@
": "
(mapconcat
(lambda (elem)
- (when (and (cdr elem) (not (string= "" (cdr elem))))
+ (when-let* ((val (and (cdr elem)
+ (format "%s" (cdr elem))))
+ (_ (not (string-empty-p val))))
(concat
(propertize (symbol-name (car elem)) 'face 'org-list-dt)
" "
- (propertize (format "%s" (cdr elem)) 'face 'org-verbatim)
+ (propertize val 'face 'org-verbatim)
" ")))
hdr-args " ")))))))