[pass] [PATCH] Re: contribute to password-store emacs-package

Cayetano Santos csantosb at inventati.org
Fri May 9 10:17:50 CEST 2014


Hi Svend,

   Here you have the patch. It includes:

   - variables password-length and timeout
   - password-store-contents returns all text in entry
   - password-store-url expects 'url : htt....'

   I included too a few comments to declare env variables for gpg-agent use.

C.

On 08-05-14 10:49:46, Svend Sorensen wrote:
>"Jason A. Donenfeld" <Jason-OnJsPKxuuEcAvxtiuMwx3w at public.gmane.org>
>writes:
>
>> On Wed, May 7, 2014 at 7:23 PM, cayetano Santos
>>
>> Svend -- maybe you want to check out Cayetano's commits and merge some
>> of his work?
>
>I'll take a look at Cayetano's GitHub emacs-password-store repo.
>
>Cayetano, could you send patches via email to me? You can include the
>pass mailing list as well.
>
>Jason, any issues with publishing another author's commits to
>contrib/emacs?
-------------- next part --------------
6,7c6
< ;; Version: 20140507.1555
< ;; X-Original-Version: 0.1
---
> ;; Version: 0.1
30a30,40
> ;; In order to make it work, declare the following in your init.el
> ;;
> ;; (setenv "PASSWORD_STORE_DIR" "/path/to/.password-store")
> ;; (setenv "PASSWORD_STORE_X_SELECTION" "primary") ;; "clipboard"
> ;;
> ;; and then
> ;;
> ;; (setenv "GPG_AGENT_INFO" (car (split-string (shell-command-to-string "echo $GPG_AGENT_INFO") "\n")))
> ;;
> ;; to use a running gpg-agent
> ;;
43c53
< (defconst password-store-password-length 8
---
> (defvar password-store-password-length 8
46c56
< (defconst password-store-timeout 45
---
> (defvar password-store-timeout 45
56,59c66,69
< 	   (apply 'call-process
< 		  (append
< 		   (list password-store-executable nil (current-buffer) nil)
< 		   (-reject 'null args)))))
---
>        (apply 'call-process
>           (append
>            (list password-store-executable nil (current-buffer) nil)
>            (-reject 'null args)))))
61,62c71,72
< 	  (s-chomp (buffer-string))
< 	(error (s-chomp (buffer-string)))))))
---
>       (s-chomp (buffer-string))
>     (error (s-chomp (buffer-string)))))))
145,146c155,163
< 	(mapcar 'password-store--file-to-entry
< 		(f-files dir (lambda (file) (equal (f-ext file) "gpg")) t)))))
---
>     (mapcar 'password-store--file-to-entry
>         (f-files dir (lambda (file) (equal (f-ext file) "gpg")) t)))))
> 
> (defun password-store-contents (entry)
>   "Return all contents of ENTRY.
> 
> Returns all contents of the password data as a list of strings,
> one by line."
>   (s-lines (password-store--run-show entry)))
170,172c187,189
< 	(setcar password-store-kill-ring-pointer "")
< 	(setq password-store-kill-ring-pointer nil)
< 	(message "Password cleared."))))
---
>     (setcar password-store-kill-ring-pointer "")
>     (setq password-store-kill-ring-pointer nil)
>     (message "Password cleared."))))
201c218
< 		     (read-passwd "Password: " t)))
---
>              (read-passwd "Password: " t)))
210,211c227,228
< 		     (when current-prefix-arg
< 		       (abs (prefix-numeric-value current-prefix-arg)))))
---
>              (when current-prefix-arg
>                (abs (prefix-numeric-value current-prefix-arg)))))
241,242c258,260
< This will only browse URLs that start with http:// or http:// to
< avoid sending a password to the browser."
---
> This will only browse URLs in lines with a \"url: \" prefix and
> starting with http:// or https:// or www. to avoid sending a password
> to the browser."
244,248c262,276
<   (let ((url (password-store-get entry)))
<     (if (or (string-prefix-p "http://" url)
< 	    (string-prefix-p "https://" url))
< 	(browse-url url)
<       (error "%s" "String does not look like a URL"))))
---
>   (let ((url (password-store-contents entry))
>         (url_line nil))
>     (while url
>       (when (string-prefix-p "url: " (car url))
>         (setq url_line (nth 1 (s-split " " (car url)))))
>       (setq url (cdr url))
>       )
>     (if (or (string-prefix-p "http://" url_line)
>             (string-prefix-p "https://" url_line)
>             (string-prefix-p "www." url_line)
>             )
>         (browse-url url_line)
>       (error "%s" "No url found or string does not look like a URL"))
>     )
>   )


More information about the Password-Store mailing list