org-board icon indicating copy to clipboard operation
org-board copied to clipboard

org-board-open failing with error "wrong-type-argument stringp nil" when extra line between heading and properties drawer

Open Jdogzz opened this issue 3 years ago • 0 comments

Hi, I found that one of my previous links saved was failing to open with the error "wrong-type-argument stringp nil" and the debugger gave the below result:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  string-match("^\\[\\[file:\\(.*\\)\\]\\[.*\\]\\]$" nil)
  (progn (string-match "^\\[\\[file:\\(.*\\)\\]\\[.*\\]\\]$" link) (match-string-no-properties 1 link))
  (expand-file-name (progn (string-match "^\\[\\[file:\\(.*\\)\\]\\[.*\\]\\]$" link) (match-string-no-properties 1 link)) (file-name-directory (or buffer-file-name "")))
  (let* ((link (car (last (org-entry-get-multivalued-property (point) "ARCHIVED_AT")))) (folder (expand-file-name (progn (string-match "^\\[\\[file:\\(.*\\)\\]\\[.*\\]\\]$" link) (match-string-no-properties 1 link)) (file-name-directory (or buffer-file-name "")))) (urls (org-entry-get-multivalued-property (point) "URL"))) (let ((--dolist-tail-- urls) url-string) (while --dolist-tail-- (setq url-string (car --dolist-tail--)) (let* ((url-parsed (url-generic-parse-url url-string)) (url-host-string (progn (or (and (memq (type-of url-parsed) cl-struct-url-tags) t) (signal 'wrong-type-argument (list 'url url-parsed))) (aref url-parsed 4))) (url-path-string (progn (or (and (memq (type-of url-parsed) cl-struct-url-tags) t) (signal 'wrong-type-argument (list 'url url-parsed))) (aref url-parsed 6))) (url-combined-string (concat folder url-host-string url-path-string)) (url-filesystem-guess (if (string= (substring url-combined-string -1) "/") (org-board-extend-default-path url-combined-string) url-combined-string))) (if (eq (org-board-open-with url-filesystem-guess arg) 0) nil (let* ((url-html-appended-string (concat url-combined-string ".html"))) (if (eq (org-board-open-with url-html-appended-string arg) 0) nil (find-name-dired folder "*.html"))))) (setq --dolist-tail-- (cdr --dolist-tail--)))))
  org-board-open(nil)
  funcall-interactively(org-board-open nil)
  call-interactively(org-board-open record nil)
  command-execute(org-board-open record)
  execute-extended-command(nil "org-board-open" "org-board-open")
  funcall-interactively(execute-extended-command nil "org-board-open" "org-board-open")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

I've been reading through the source code again and I'm guessing that the line of code:

(link (car (last
                     (org-entry-get-multivalued-property
                      (point) "ARCHIVED_AT"))))

must somehow be missing the value of the string since the debug log shows the following block of code, making use of string-match, is passed a nil value. After some troubleshooting I found out that this was due to an unnecessary extra line between the heading and the properties drawer. I read through the readme again just to make sure I didn't miss something important about this, but didn't find something specific. It would probably be good to make the above piece of code slightly more robust for figuring out if there's a valid org-board save, and short of that then including a clear notice in the readme that the property drawer should directly follow the headline.

Jdogzz avatar Jan 04 '21 19:01 Jdogzz