Move idm related functions to the Org config
This commit is contained in:
parent
7ee19f492a
commit
1cc81ac9d3
@ -421,6 +421,33 @@ Copied from https://ryuslash.org/posts/C-d-to-close-eshell.html
|
|||||||
(signal (car err) (cdr err))))))
|
(signal (car err) (cdr err))))))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
** ~idm~ (ID manager) related functions
|
||||||
|
|
||||||
|
*** Get specific fields from a record in ~idm~
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defun gpolonkai/idm-record-get-field (record field)
|
||||||
|
"Get FIELD of an id-manager RECORD."
|
||||||
|
(let ((funcname (intern (concat "idm-record-" (symbol-name field)))))
|
||||||
|
(when (fboundp funcname)
|
||||||
|
(funcall funcname record))))
|
||||||
|
|
||||||
|
(defun gpolonkai/idm-get-field-for-account (account field)
|
||||||
|
"Get id-manager password for ACCOUNT."
|
||||||
|
(let ((db (idm-load-db))
|
||||||
|
(lookup-record nil))
|
||||||
|
(dolist (record (funcall db 'get-all-records) password)
|
||||||
|
(when (string= account (idm-record-name record))
|
||||||
|
(setq lookup-record (gpolonkai/idm-record-get-field record field))))
|
||||||
|
lookup-record))
|
||||||
|
|
||||||
|
(defmacro gpolonkai/idm-get-password-for-account (account)
|
||||||
|
`(gpolonkai/idm-get-field-for-account ,account 'password))
|
||||||
|
|
||||||
|
(defmacro gpolonkai/idm-get-id-for-account (account)
|
||||||
|
`(gpolonkai/idm-get-field-for-account ,account 'account-id))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
* UI preferences
|
* UI preferences
|
||||||
|
|
||||||
** Tweak window chrome
|
** Tweak window chrome
|
||||||
|
1
init.el
1
init.el
@ -539,7 +539,6 @@
|
|||||||
|
|
||||||
(use-package id-manager
|
(use-package id-manager
|
||||||
:config
|
:config
|
||||||
(load "idm")
|
|
||||||
(setq idm-database-file (expand-file-name "idm-db.gpg" user-emacs-directory))
|
(setq idm-database-file (expand-file-name "idm-db.gpg" user-emacs-directory))
|
||||||
:bind
|
:bind
|
||||||
(:map gpolonkai/pers-map
|
(:map gpolonkai/pers-map
|
||||||
|
22
lisp/idm.el
22
lisp/idm.el
@ -1,22 +0,0 @@
|
|||||||
;; id-manager extensions
|
|
||||||
|
|
||||||
(defun gpolonkai/idm-record-get-field (record field)
|
|
||||||
"Get FIELD of an id-manager RECORD."
|
|
||||||
(let ((funcname (intern (concat "idm-record-" (symbol-name field)))))
|
|
||||||
(when (fboundp funcname)
|
|
||||||
(funcall funcname record))))
|
|
||||||
|
|
||||||
(defun gpolonkai/idm-get-field-for-account (account field)
|
|
||||||
"Get id-manager password for ACCOUNT."
|
|
||||||
(let ((db (idm-load-db))
|
|
||||||
(lookup-record nil))
|
|
||||||
(dolist (record (funcall db 'get-all-records) password)
|
|
||||||
(when (string= account (idm-record-name record))
|
|
||||||
(setq lookup-record (gpolonkai/idm-record-get-field record field))))
|
|
||||||
lookup-record))
|
|
||||||
|
|
||||||
(defmacro gpolonkai/idm-get-password-for-account (account)
|
|
||||||
`(gpolonkai/idm-get-field-for-account ,account 'password))
|
|
||||||
|
|
||||||
(defmacro gpolonkai/idm-get-id-for-account (account)
|
|
||||||
`(gpolonkai/idm-get-field-for-account ,account 'account-id))
|
|
Loading…
Reference in New Issue
Block a user