Is there an easy way to highlight all the words in a line with just one command? I'm trying to write an elisp function to achieve this but my knowledge is pretty rudimentary. So far, I can only move the point to the beginning of the line and highlight the word there:
(defun hx () "Highlight all words in a line." (interactive) (beginning-of-line) ;; Split string based on comma-separator (let ((mylist (split-string (thing-at-point 'line t) ",")))) (highlight-symbol-at-point) )
I was hoping to iterate over
mylist and use
re-search-forward to find the first occurrence of each word in the list, move the point to that word and then highlight it. However,
mylist contains an empty list. Even if
mylist contained a list of words, I don't know if the above approach would actually work.