emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/org-contrib dba097229e: lisp/org-eldoc.el: Fix propertizin


From: ELPA Syncer
Subject: [nongnu] elpa/org-contrib dba097229e: lisp/org-eldoc.el: Fix propertizing of non-string header args
Date: Thu, 11 Aug 2022 06:58:55 -0400 (EDT)

branch: elpa/org-contrib
commit dba097229e8909202fcb4f67766464e0fc13b321
Author: Samuel Culpepper <samuel@samuelculpepper.com>
Commit: Bastien Guerry <bzg@gnu.org>

    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))
---
 lisp/org-eldoc.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lisp/org-eldoc.el b/lisp/org-eldoc.el
index 1a4e67091b..5b4f66d059 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 " ")))))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]