I'm trying to hook into find-file-literally to turn off some global minor modes when visiting a file literally (which I usually do for large files).

However, it does not appear that find-file-hook is run when vising a file literally. The documentation does not mention this, so I'm wondering if this is expected behavior. In any case, what's another way to accomplish the above?

I'm using Emacs 27.1.

  • 1
    Add an advice?
    – NickD
    Dec 3 '20 at 20:59
  • 1
    It is intentional, so please M-x report-emacs-bug to suggest a documentation improvement. Details are that find-file-noselect-1 only calls after-find-file if the rawfile value is nil (i.e. not "literally"), and it's after-find-file which runs find-file-hook.
    – phils
    Dec 3 '20 at 22:43
  • @NickD Yes, an advice should work. Thanks! Dec 3 '20 at 23:50
  • Not related to the OP, but 头像很赞!
    – TerryTsao
    Dec 4 '20 at 3:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.