This question already has an answer here:
I would like emacs to switch to
gnuplot-mode when I open a file ending in
;; gnuplot mode-name (add-to-list 'gnuplot-mode '("\\.g\\'" . gnuplot-mode))
;; gnuplot mode-name (add-to-list 'gnuplot '("\\.g\\'" . gnuplot))
Neither works. How do I make Emacs behave this way?