I want to understand why
(when (string= issue "")
(error "Issue number missing"))
doesn't throw an error when issue is empty, but
(when (= (length issue) 0)
(error "Issue number missing"))
works as expected.
Documentation of string= states that it compares content of both strings and returns t when they are identical. I'm pretty sure a string of length 0 and "" have identical contents.
The value of issue is set in the following code:
(string-match "\#\\([0-9]*\\)" text)
(setq issue (match-string 1 text))
I tried to replace when with if and added (print (concat "\"" issue "\"")) to the else clause, it printed "\"\"" as a result. I printed the POST query that uses issue as one of its inputs and it generated empty string in its place (the code constructing the query shouldn't even execute if string= returned the correct value). Not to mention that it's length is equal to 0. I'm certain that issue is equal to "".
(let ((issue "")) (string= issue ""))returnstfor me. Are you sureissueis an empty string?issueis set tonil, not to"".concatturnsnilinto"", try printing it withoutconcat, too.