This feature is now present in development version of AUCTeX and will be available in the next ELPA release (presumably 11.89.2) and in the next official stable version (presumably 11.90). There are two options controlling the behavior:
TeX-suppress-ignored-warnings. With the former you set the regexp matching warnings to be ignored, with the second you actually tell AUCTeX to hide the warnings. For your case you'd have to add the following code to your init file
"LaTeX Warning: Command \\\\mark\\(both\\|right\\) has changed."
You can show or hide these warnings with C-C C-t C-x (
In the error overview you can open with M-x
TeX-error-overview RET, it's possible to toggle visibility of such ignored warnings with x. BTW, you can also toggle visibility of all bad boxes and generic warnings with b and w, respectively.
In previous versions of AUCTeX, the best way to accomplish what you ask is be to hack into
TeX-parse-error and skip warnings to be ignored there. But this function was fairly large and is changed fairly often, then a redefinition would overwrite these changes, so I advise against redefining
Instead, if you have AUCTeX 11.88 or later you can hack into
TeX-parse-all-errors: after parsing the whole compilation log remove the unwanted warnings. Add the following code to your init file
"LaTeX Warning: Command \\\\mark\\(both\\|right\\) has changed.")
(defun mg-remove-ignored-warnings (&rest args)
"Remove unwanted warnings from `TeX-error-list'."
(let ((list TeX-error-list)
(while (setq entry (pop list))
(unless (and mg-ignored-warnings
(string-match mg-ignored-warnings (nth 3 entry)))
(push entry new-list)))
(setq TeX-error-list (reverse new-list))))
(advice-add #'TeX-parse-all-errors :after #'mg-remove-ignored-warnings)
You only have to set
mg-ignored-warnings to a regexp matching warnings you want to skip and you're done.
Please note also that since version 11.88 it's available a nice formatted list of all errors and warnings reported in the compilation log, M-x
TeX-error-overview RET, that makes navigating through such messages much easier.