-
Notifications
You must be signed in to change notification settings - Fork 0
/
open-image.el
43 lines (34 loc) · 1.25 KB
/
open-image.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
(defun open-image--detect-file-path ()
(save-excursion
(beginning-of-defun)
(re-search-forward "(comment (image ")
(thing-at-point 'sexp t)))
(defun open-image--fix-to-absolute-path (path)
(s-concat default-directory "../../" path))
(defun open-image--detect-width ()
(-let (((x1 y1 x2 y2) (window-inside-pixel-edges
(get-buffer-window (current-buffer)))))
(/ (- x2 x1) 2)))
(defun open-image--replace-image (start end path)
(put-text-property
start (1- end)
'display
(cons 'image
`(:type imagemagick
:file ,path
:width ,(open-image--detect-width)))))
(defun open-image ()
(interactive)
(-let (((s . e) (bounds-of-thing-at-point 'defun)))
(open-image--replace-image
s e
(open-image--fix-to-absolute-path (open-image--detect-file-path)))))
(define-key clojure-mode-map (kbd "s-n") 'open-image)
(defun change-mini-buffer-font-size ()
(dolist
(buf (list " *Minibuf-0*" " *Minibuf-1*" " *Echo Area 0*" " *Echo Area 1*" "*Quail Completions*"))
(when (get-buffer buf)
(with-current-buffer buf
(setq-local face-remapping-alist '((default (:height 2.0))))))))
(require 'cider-eval-sexp-fu)
(setq eval-sexp-fu-flash-duration 0.4)