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

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

[elpa] externals/denote e42f590f1f: Fix: denote-extract-keywords-from-fr


From: ELPA Syncer
Subject: [elpa] externals/denote e42f590f1f: Fix: denote-extract-keywords-from-front-matter should always return a list
Date: Tue, 7 Nov 2023 03:57:49 -0500 (EST)

branch: externals/denote
commit e42f590f1f26b5d70cc72f79e2d77933f1a3f1d2
Author: Vedang Manerikar <ved.manerikar@gmail.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Fix: denote-extract-keywords-from-front-matter should always return a list
    
    I hit this bug when I called `M-x
    denote-change-file-type-and-front-matter` on an Org file with empty
    filetags, to convert it to Markdown-YAML format.
    
    This is the front-matter of the original file:
    ```
       #+title:      Great Content is the Heart of Audience Building
       #+filetags:
       #+date:       [2023-03-08 Wed 18:51]
       #+identifier: 20230308T185100
    ```
    
    The stack-trace is as follows:
    ```
    Debugger entered--Lisp error: (error "‘’ is not a list")
      signal(error ("‘’ is not a list"))
      error("`%s' is not a list" "")
      denote-sluggify-keywords("")
      denote--format-front-matter-keywords("" markdown-yaml)
      denote--format-front-matter("Great Content is the Heart of Audience 
Building" "2023-03-08T18:51:00+05:30" "" "20230308T185100" markdown-yaml)
      denote--add-front-matter("/.../20230308T18..." "Great Content is the 
Heart of Audience Building" "" "20230308T185100" markdown-yaml)
      denote-change-file-type-and-front-matter("/.../20230308T18..." 
markdown-yaml)
    ```
    
    Following the chain of commands shows that the culprit is the line
    ```
    (denote-retrieve-keywords-value file old-file-type)
    ```
    in `denote-change-file-type-and-front-matter`, which returns an
    empty string when the rest of the functions expect a list of strings.
    
    I looked at where `denote-extract-keywords-from-front-matter` is being
    used and why the code was originally returning an empty string, and it
    looks to me that returning an empty list from it now is the right
    thing to do.
---
 denote.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/denote.el b/denote.el
index b9e3264fea..c816269535 100644
--- a/denote.el
+++ b/denote.el
@@ -1120,11 +1120,11 @@ for how this is used."
 (defun denote-extract-keywords-from-front-matter (keywords-string)
   "Extract keywords list from front matter KEYWORDS-STRING.
 Split KEYWORDS-STRING into a list of strings.  If KEYWORDS-STRING
-satisfies `string-blank-p', return an empty string.
+satisfies `string-blank-p', return an empty list.
 
 Consult the `denote-file-types' for how this is used."
   (if (string-blank-p keywords-string)
-      ""
+      '()
     (split-string keywords-string "[:,\s]+" t "[][ \"']+")))
 
 (defvar denote-file-types



reply via email to

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