blob: c372764c827f7fc6d695e05427a93f3a08700177 (
plain)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
;;; ymh-common.el --- Some common functions -*- lexical-binding: t; -*-
;;; Commentary:
;; This file contains some common code.
;;; Code:
(defun ymh/prev-window ()
"Go to the previous window using `other-window'."
(interactive)
(other-window -1))
(defun ymh/reset-coq-windows (&optional prefix)
"Resets the Goal and Response windows."
(interactive (list (when current-prefix-arg
(prefix-numeric-value current-prefix-arg))))
(message prefix)
(cond
((and prefix (> prefix 0))
(other-frame 1)
(delete-other-windows)
(split-window-below)
(switch-to-buffer "*goals*")
(other-window 1)
(switch-to-buffer "*response*")
(other-frame 1))
(t
(delete-other-windows)
(split-window-right)
(other-window 1)
(switch-to-buffer "*goals*")
(split-window-below)
(other-window 1)
(switch-to-buffer "*response*")
(other-window 1))))
(defun ymh/pass (query)
"Return the password as a string from QUERY."
(s-trim (shell-command-to-string (concat "pass show " query))))
(defun ymh/apply-theme (appearance)
"Load theme, taking current system APPEARANCE into consideration."
(mapc #'disable-theme custom-enabled-themes)
(pcase appearance
('light (load-theme 'modus-operandi-tinted t))
('dark (load-theme 'modus-vivendi-tinted t))
;;('light (load-theme 'ef-spring t))
;;('dark (load-theme 'ef-dark t))
))
(defadvice load-theme
(before theme-dont-propagate activate)
(mapc #'disable-theme custom-enabled-themes))
(defun ymh/electric-space ()
(interactive)
(let ((sentence-end-double-space nil))
(if (looking-back (sentence-end))
(insert "\n")
(self-insert-command 1))))
;;; Stefan Monnier: It is the opposite of fill-paragraph.
(defun ymh/unfill-paragraph (&optional region)
"Takes a multi-line paragraph and makes it into a single line of text."
(interactive (progn (barf-if-buffer-read-only) '(t)))
(let ((fill-column (point-max))
;; This would override `fill-column' if it's an integer.
(emacs-lisp-docstring-fill-column t))
(fill-paragraph nil region)))
(provide 'ymh-common)
;;; ymh-common.el ends here
|