summaryrefslogtreecommitdiffstats
path: root/ymh-emacs/ymh-common.el
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2022-11-27 12:08:11 +0000
committerYann Herklotz <git@yannherklotz.com>2022-11-27 12:08:11 +0000
commitad161b70c317cc766c6ec42064cb6410136c7905 (patch)
tree56b914aabe00e6526e7ba1cdd5aeb9a3ab4da732 /ymh-emacs/ymh-common.el
parent3cc9791003364c338cc6d219c5f144210aa76bef (diff)
downloadymh-emacs-ad161b70c317cc766c6ec42064cb6410136c7905.tar.gz
ymh-emacs-ad161b70c317cc766c6ec42064cb6410136c7905.zip
Take more configuration into packages
Diffstat (limited to 'ymh-emacs/ymh-common.el')
-rw-r--r--ymh-emacs/ymh-common.el53
1 files changed, 53 insertions, 0 deletions
diff --git a/ymh-emacs/ymh-common.el b/ymh-emacs/ymh-common.el
new file mode 100644
index 0000000..005f39b
--- /dev/null
+++ b/ymh-emacs/ymh-common.el
@@ -0,0 +1,53 @@
+;;; ymh-common.el --- Some common functions -*- lexical-binding: t; -*-
+
+;; Author: Yann Herklotz <git@yannherklotz.com>
+;; Package-Requires: ((emacs "24.3"))
+
+;;; Commentary:
+
+;; This file contains some common code.
+
+;;; Code:
+
+(defun ymhg/prev-window ()
+ "Go to the previous window using `other-window'."
+ (interactive)
+ (other-window -1))
+
+(defun ymhg/reset-coq-windows ()
+ "Resets the Goal and Response windows."
+ (interactive)
+ (other-frame 1)
+ (delete-other-windows)
+ (split-window-below)
+ (switch-to-buffer "*goals*")
+ (other-window 1)
+ (switch-to-buffer "*response*")
+ (other-frame 1))
+
+(defun ymhg/pass (query)
+ "Return the password as a string from QUERY."
+ (s-trim (shell-command-to-string (concat "pass show " query))))
+
+(defun ymhg/apply-theme (appearance)
+ "Load theme, taking current system APPEARANCE into consideration."
+ (mapc #'disable-theme custom-enabled-themes)
+ (pcase appearance
+ ;;('light (load-theme 'modus-operandi t))
+ ;;('dark (load-theme 'modus-vivendi 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 ymhg/electric-space ()
+ (interactive)
+ (if (looking-back (sentence-end))
+ (insert "%\n")
+ (self-insert-command 1)))
+
+(provide 'ymh-common)
+
+;;; ymh-common.el ends here