summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranck Cuny <franck.cuny@gmail.com>2016-11-08 15:10:21 -0800
committerFranck Cuny <franck.cuny@gmail.com>2016-11-08 15:10:21 -0800
commita9d86118ae8da8413b48c76f4af658a241d29411 (patch)
tree800c44035c6ba508f3eef6a53ffe4b6177728f39
parent[bash] Small change to the prompt. (diff)
downloademacs.d-a9d86118ae8da8413b48c76f4af658a241d29411.tar.gz
[Emacs] Add a few custom functions.
Mostly stolen from spacemacs.
-rw-r--r--emacs.d/lib/my-functions.el46
1 files changed, 46 insertions, 0 deletions
diff --git a/emacs.d/lib/my-functions.el b/emacs.d/lib/my-functions.el
index 1281be3..3513a84 100644
--- a/emacs.d/lib/my-functions.el
+++ b/emacs.d/lib/my-functions.el
@@ -1,3 +1,49 @@
+;; these functions are for loading my configuration
+(defun fc/load-time (emacs-start-time)
+ "How long did it take to load the configuration."
+ (let ((load-time (float-time (time-subtract (current-time) emacs-start-time))))
+ (message (format "Emacs loaded in %.3fs" load-time))))
+
+(defun fc/system-info ()
+ "Display system informations"
+ (format
+ (concat "### System information :\n"
+ "- OS: %s\n"
+ "- Emacs: %s")
+ system-type
+ emacs-version))
+
+(defun fc/emacs-is-ready ()
+ "Emacs is ready"
+ (message "Emacs is ready."))
+
+;; font manipulation
+(defun fc/scale-up-or-down-font-size (direction)
+ "Scale the font. If DIRECTION is positive or zero the font is scaled up,
+otherwise it is scaled down."
+ (interactive)
+ (let ((scale 0.5))
+ (if (eq direction 0)
+ (text-scale-set 0)
+ (if (< direction 0)
+ (text-scale-decrease scale)
+ (text-scale-increase scale)))))
+
+(defun fc/scale-up-font ()
+ "Scale up the font."
+ (interactive)
+ (fc/scale-up-or-down-font-size 1))
+
+(defun fc/scale-down-font ()
+ "Scale up the font."
+ (interactive)
+ (fc/scale-up-or-down-font-size -1))
+
+(defun fc/reset-font-size ()
+ "Reset the font size."
+ (interactive)
+ (fc/scale-up-or-down-font-size 0))
+
;; jump to the scratch buffer
(defun fc/switch-to-scratch ()
"Switch to scratch, grab the region if it's active."