The `stringp` is redundant as this is either `nil` or a string, so you can simplify it to `(and (buffer-file-name) ...`.