I am new to Emacs and I am trying to search for all words entered one by one using 'occur'. I am trying following code:
(defun occurlist (ss)
(interactive "s\Enter list of search items: ")
(let (lst (split-string ss))
(message "In let block; lst=%s" lst)
(while lst
(occur (pop lst)))))
I enter the search words, e.g.: world bank report
. It should search for these words one by one sequentially.
However, it is not working. There is no error message. Starting emacs with command "emacs --debug-init" also does not show any error message.
Where is the error and how can it be solved? Thanks for your help.
Edit: I added message in let block. It reveals that lst=nil at that location. Hence it is not entering the while loop. Why is lst not getting value of (split-string ss) in let block?
Correcting (let (lst (split-string ss)) to (let ((lst (split-string ss))) leads to function showing search for last word only.