about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2025-01-29 14:15:14 +0000
committerArun Isaac2025-01-29 14:54:12 +0000
commit04cfb735e9e245f70cf549091f0d6b0decd7244a (patch)
treeb1e2e0b25d8291e975eb145ba49c13fc96a73cc3
parente7b865061843307f357dafe712b0dfd03c790269 (diff)
downloadennum-04cfb735e9e245f70cf549091f0d6b0decd7244a.tar.gz
ennum-04cfb735e9e245f70cf549091f0d6b0decd7244a.tar.lz
ennum-04cfb735e9e245f70cf549091f0d6b0decd7244a.zip
Inhibit certain file name handlers during ennum builds.
* ennum.el (ennum-inhibit-file-name-handlers): New variable.
(ennum--file-hash): Inhibit file name handlers in
ennum-inhibit-file-name-handlers when inserting file contents
literally.
-rw-r--r--ennum.el13
1 files changed, 12 insertions, 1 deletions
diff --git a/ennum.el b/ennum.el
index 522ac2d..e7ee9f0 100644
--- a/ennum.el
+++ b/ennum.el
@@ -141,6 +141,13 @@ to delete. If the store path is relative, it is interpreted
 relative to `:working-directory'. Defaults to \".ennum\"."
   :group 'ennum)
 
+(defvar ennum-inhibit-file-name-handlers
+  '(openwith-file-handler)
+  "List of file name handlers that should be disabled.
+
+List of file name handlers that should be temporarily disabled
+when ennum builds its output.")
+
 (defmacro ennum-with-file-contents (file &rest body)
   "Create a temporary buffer, insert contents of FILE into that
 buffer and evaluate BODY. The value returned is the value of the
@@ -209,7 +216,11 @@ respectively by - and _, and the pad character = is optional."
   (with-temp-buffer
     ;; TODO: Use ennum-with-file-contents
     (set-buffer-multibyte nil)
-    (insert-file-contents-literally file)
+    (let ((inhibit-file-name-operation 'insert-file-contents)
+          (inhibit-file-name-handlers
+           (append ennum-inhibit-file-name-handlers
+                   inhibit-file-name-handlers)))
+      (insert-file-contents-literally file))
     (insert file)
     (ennum--hash)))