mirror of https://github.com/skeeto/enchive.git
commit
b7ff1a4b24
2
Makefile
2
Makefile
|
@ -26,7 +26,7 @@ clean:
|
||||||
install: enchive enchive.1
|
install: enchive enchive.1
|
||||||
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
||||||
mkdir -p $(DESTDIR)$(PREFIX)/share/man/man1
|
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
|
gzip < enchive.1 > $(DESTDIR)$(PREFIX)/share/man/man1/enchive.1.gz
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
|
|
|
@ -24,19 +24,24 @@
|
||||||
|
|
||||||
(defun enchive-file-handler (operation &rest args)
|
(defun enchive-file-handler (operation &rest args)
|
||||||
"Handler for `file-name-handler-alist' for automatic encrypt/decrypt."
|
"Handler for `file-name-handler-alist' for automatic encrypt/decrypt."
|
||||||
(let ((file-name-handler-alist ()))
|
(cond ((eq operation 'insert-file-contents)
|
||||||
(cond ((eq operation 'insert-file-contents)
|
(let ((file (car args)))
|
||||||
(let ((file (car args)))
|
(unless (= 0 (call-process enchive-program-name file '(t nil) nil
|
||||||
(unless (= 0 (call-process enchive-program-name file '(t nil) nil
|
"--pinentry" "--agent" "extract"))
|
||||||
"--pinentry" "--agent" "extract"))
|
(error "Enchive subprocess failed"))
|
||||||
(error "Enchive subprocess failed"))
|
(setf buffer-file-name file)
|
||||||
(setf buffer-file-name file)
|
(list file (buffer-size))))
|
||||||
(list file (buffer-size))))
|
((eq operation 'write-region)
|
||||||
((eq operation 'write-region)
|
(call-process-region (nth 0 args) (nth 1 args)
|
||||||
(call-process-region (nth 0 args) (nth 1 args)
|
enchive-program-name nil nil nil
|
||||||
enchive-program-name nil nil nil
|
"archive" "/dev/stdin" (nth 2 args)))
|
||||||
"archive" "/dev/stdin" (nth 2 args)))
|
;; Handle any operation we don’t know about.
|
||||||
((apply operation args)))))
|
(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
|
;;;###autoload
|
||||||
(define-minor-mode enchive-mode
|
(define-minor-mode enchive-mode
|
||||||
|
|
Loading…
Reference in New Issue