How to stop emacs from asking "file is read only on disk make buffer read only, too?"

This happens when I have opened git-annex locked file with read-only-mode off and then open the file again.

Similar to this question:

PS: I used plain-org-wiki to keep note, it’s more convenient to open a file than switching to an opened buffer.

That’s a warning from find-file-noselect.


(defun my-file-writable-p (orig-fun file-name)
 (let ((file-list (list file-name)))
   (or (apply orig-fun file-list)
       (string-match "\\.git/annex/" (file-symlink-p file-name)))))

(advice-add 'file-writable-p :around #'my-file-writable-p)