diff options
Diffstat (limited to 'files/.emacs.d/jd/jd-misc.el')
-rw-r--r-- | files/.emacs.d/jd/jd-misc.el | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/files/.emacs.d/jd/jd-misc.el b/files/.emacs.d/jd/jd-misc.el new file mode 100644 index 0000000..2b7d1bd --- /dev/null +++ b/files/.emacs.d/jd/jd-misc.el | |||
@@ -0,0 +1,34 @@ | |||
1 | ;;; Dotfiles --- Jakub Dlugosz emacs config | ||
2 | ;;; Commentary: | ||
3 | |||
4 | ;;; Code: | ||
5 | |||
6 | (defun jd/generete-qr-from-clipboard () | ||
7 | (interactive) | ||
8 | (let ((clipboard-value (x-get-clipboard)) | ||
9 | (clipboard-file-path "/tmp/clipboard_value.txt") | ||
10 | (clipboard-out-image "/tmp/qr.png")) | ||
11 | (with-temp-file clipboard-file-path | ||
12 | (insert clipboard-value)) | ||
13 | (shell-command (concat | ||
14 | "qrencode -o " | ||
15 | clipboard-out-image | ||
16 | " < " | ||
17 | clipboard-file-path)) | ||
18 | (find-file clipboard-out-image))) | ||
19 | |||
20 | (defun jd/dired-open-file-in-kill-ring () | ||
21 | (interactive) | ||
22 | (let* ((last-killed (car kill-ring)) | ||
23 | (exists-p (file-exists-p last-killed)) | ||
24 | (dir-p (file-directory-p last-killed))) | ||
25 | (cond | ||
26 | ((not exists-p) (message "File doesn't exists!")) | ||
27 | (dir-p (dired last-killed)) | ||
28 | ((not dir-p) (find-file last-killed))))) | ||
29 | |||
30 | (global-set-key (kbd "C-c O") #'jd/dired-open-file-in-kill-ring) | ||
31 | |||
32 | (provide 'jd-misc) | ||
33 | |||
34 | ;;; jd-misc.el ends here | ||