Why is (string-match "lisp" major-mode)
not working, while (string-equal "lisp-interaction-mode" major-mode)
is working?
string-match
results in debugger message: (wrong-type-argument stringp lisp-interaction-mode)
But help states:
(string-equal S1 S2)
(string-match REGEXP STRING &optional START)
(S1
and S2
is a placeholder for STRING
, right?)
I already know that (string-match "lisp" (prin1-to-string major-mode))
can be used to get the expected result.
(string-match "lisp" (symbol-name major-mode))
would be more precise, depending on what you want(derived-mode-p 'emacs-lisp-mode)
might make sense.string-match-p
instead ofstring-match
.