I am trying to add a new comment character in fundamental mode, but I can't get it to work.
Let me rephrase that, because I think it's an xy-problem.
What I really would like to have is the possibility, in Fundamental mode, to give certain swaths of text a different face (1).
For instance, mark a region, then with a key-combo or menu-item, give that marked text a very light grey background.
I was starting out by the assumption that you can only do this by setting a custom comment character, and thus have the swath text be treated a s a comment and hence a different face.
Going on that assumption, in Fundamental mode, I would like to have all lines that start with the sequence "pipe character and a space" i.e. in regex something like
'[[:space:]]*| .*' to be treated as comments (and thus have a different face).
But I cannot get it to work even in its simplest iteration; I thought this would work, but it doesn't:
(defun fundamental-mode-set-comment() (font-lock-add-keywords 'fundamental-mode '(("\\(| .*$\\)" 1 'font-lock-comment-face t)) ) ) (add-hook 'fundamental-mode-hook 'fundamental-mode-set-comment)
Even though my mode line says ('Fundamental' ...), i.e. Fundamental mode is in effect, I cannot get the face change to work.
Is there a way to get what I want without resorting to a new comment type? Am I going about this the right way, given (1)?
(I am using emacs 25.3.2.)