I have written a small function to search MDN docs and display them on the browser.
However, sometimes the function does not work and an empty query is made.
My code is as follows:
(defun search-mdn (&optional querystring)
(interactive)
(if (not querystring)
(search-mdn (read-string "What do you want to look up on MDN? "))
)
(let* ( (header "https://developer.mozilla.org/en-US/search?q=")
(footer "&topic=api&topic=css&topic=canvas&topic=html&topic=http&topic\
=js&topic=mobile&topic=apps&topic=svg&topic=webdev&topic=webext&topic=webgl")
(searchurl (concat header querystring footer)))
(browse-url searchurl)
)
)
Every time I call the function without parameters (search-mdn (read-string "What ...")) runs, however sometimes it does not call the search-mdn function with a parameter, although I enter one.
interactive
rather than calling the same function, because it will return, and then the first call will continune (withquerystring
set tonil
.) – user12563 Nov 20 '17 at 15:35