diff --git a/Makefile b/Makefile index 13782bb..1aa1b07 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ clean: install: enchive enchive.1 mkdir -p $(DESTDIR)$(PREFIX)/bin mkdir -p $(DESTDIR)$(PREFIX)/share/man/man1 - cp -f enchive $(DESTDIR)$(PREFIX)/bin + install -m 755 enchive $(DESTDIR)$(PREFIX)/bin gzip < enchive.1 > $(DESTDIR)$(PREFIX)/share/man/man1/enchive.1.gz uninstall: diff --git a/enchive-mode.el b/enchive-mode.el index 97f6e40..cd29168 100644 --- a/enchive-mode.el +++ b/enchive-mode.el @@ -24,19 +24,24 @@ (defun enchive-file-handler (operation &rest args) "Handler for `file-name-handler-alist' for automatic encrypt/decrypt." - (let ((file-name-handler-alist ())) - (cond ((eq operation 'insert-file-contents) - (let ((file (car args))) - (unless (= 0 (call-process enchive-program-name file '(t nil) nil - "--pinentry" "--agent" "extract")) - (error "Enchive subprocess failed")) - (setf buffer-file-name file) - (list file (buffer-size)))) - ((eq operation 'write-region) - (call-process-region (nth 0 args) (nth 1 args) - enchive-program-name nil nil nil - "archive" "/dev/stdin" (nth 2 args))) - ((apply operation args))))) + (cond ((eq operation 'insert-file-contents) + (let ((file (car args))) + (unless (= 0 (call-process enchive-program-name file '(t nil) nil + "--pinentry" "--agent" "extract")) + (error "Enchive subprocess failed")) + (setf buffer-file-name file) + (list file (buffer-size)))) + ((eq operation 'write-region) + (call-process-region (nth 0 args) (nth 1 args) + enchive-program-name nil nil nil + "archive" "/dev/stdin" (nth 2 args))) + ;; Handle any operation we don’t know about. + (t (let ((inhibit-file-name-handlers + (cons 'enchive-file-handler + (and (eq inhibit-file-name-operation operation) + inhibit-file-name-handlers))) + (inhibit-file-name-operation operation)) + (apply operation args))))) ;;;###autoload (define-minor-mode enchive-mode