mirror of https://github.com/skeeto/enchive.git
commit
b7ff1a4b24
2
Makefile
2
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:
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue