Set modes and run appropriate hooks when visiting a file via magic
authorSteve Youngs <steve@sxemacs.org>
Fri, 28 Feb 2020 08:34:48 +0000 (18:34 +1000)
committerSteve Youngs <steve@sxemacs.org>
Fri, 28 Feb 2020 08:34:48 +0000 (18:34 +1000)
This little change makes a big difference and now it should be quite
safe to add `(magic:find-file-magic-files-alist)' into your init.el.

* lisp/ffi/ffi-magic.el (magic:find-file-noselect):
  Call #'after-find-file to ensure modes and hooks are done
  right.

Signed-off-by: Steve Youngs <steve@sxemacs.org>
lisp/ffi/ffi-magic.el

index b44ecca..312d371 100644 (file)
@@ -579,7 +579,8 @@ As reported by libmagic. If so, the text type is returned."
       (when (and coding (not (eq coding codesys)))
        (let ((coding-system-for-read coding))
          (set-buffer-file-coding-system coding)
-         (insert-file-contents file t nil nil t))))
+         (insert-file-contents file t nil nil t)))
+      (after-find-file nil t))
     buf))
 
 ;;;###autoload