[Utils] Minor cleanup

This commit is contained in:
Daniel - 2017-11-18 11:11:37 +01:00
parent eab5764a96
commit f85b40e2bb
Signed by: dbo
GPG Key ID: 4F63DB96D45AA9C6
1 changed files with 1 additions and 23 deletions

View File

@ -83,7 +83,7 @@ If already in `*ansi-term*' buffer, bury it."
(shell)))
;;; helpers
;;; general utilities
(defun db/get-url-from-link ()
"Copy url of link under point into clipboard."
@ -164,28 +164,6 @@ major mode MODE."
(eq major-mode mode)))
(window-list-1)))
(defun db/ssh-keys ()
"Return list of private ssh keys available on the system."
(cl-flet ((file-ssh-key-p (file)
(string-suffix-p ": PEM RSA private key\n"
(shell-command-to-string (format "file %s" file)))))
(cl-remove-if-not #'file-ssh-key-p (directory-files "~/.ssh/" t))))
(defun db/add-to-keyring (&optional file)
"Add FILE to local keyring.
If FILE is not given, prompt for one."
(interactive)
(if file
(let ((return-value (call-process "ssh-add" nil nil nil "-t" "86400" (expand-file-name file))))
(unless (zerop return-value)
(error "Aborted: %s" return-value)))
(let ((ssh-keys `((name . "SSH Keys")
(candidates . ,(mapcar (lambda (file)
(cons (file-name-nondirectory file) file))
(db/ssh-keys)))
(action . (("Add to keyring" . db/add-to-keyring))))))
(helm :sources (list ssh-keys)))))
(defun db/show-current-org-task ()
"Show title of currently clock in task in modeline."
(interactive)