aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/lib
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2018-06-29 22:31:11 -0500
committerJesús <heckyel@hyperbola.info>2018-06-29 22:31:11 -0500
commit15ea85ee14a5c40a8ed40d66fe591fe528a8719d (patch)
treeecb241b06ffc1a3ab3e1b275c83d761d03b35fc8 /lisp/lib
downloademacs-base-15ea85ee14a5c40a8ed40d66fe591fe528a8719d.tar.lz
emacs-base-15ea85ee14a5c40a8ed40d66fe591fe528a8719d.tar.xz
emacs-base-15ea85ee14a5c40a8ed40d66fe591fe528a8719d.zip
first commit
Diffstat (limited to 'lisp/lib')
-rw-r--r--lisp/lib/myemacs.el18
-rw-r--r--lisp/lib/sachachua.el39
2 files changed, 57 insertions, 0 deletions
diff --git a/lisp/lib/myemacs.el b/lisp/lib/myemacs.el
new file mode 100644
index 0000000..6846bdc
--- /dev/null
+++ b/lisp/lib/myemacs.el
@@ -0,0 +1,18 @@
+;;----------------------------------------------------------------------------
+;; Some cool functions
+;;----------------------------------------------------------------------------
+;; These functions are made by me (Quitter: @heckyel) or
+;; heavily modified by me
+
+;;----------------------------------------------------------------------------
+;; Toggles fullscreen
+;;----------------------------------------------------------------------------
+(defun myemacs/toggle-fullscreen ()
+ (interactive)
+ (x-send-client-message nil 0 nil "_NET_WM_STATE" 32
+ '(2 "_NET_WM_STATE_FULLSCREEN" 0)))
+
+(defun myemacs/elapsed-time ()
+ (let ((elapsed (float-time (time-subtract (current-time)
+ emacs-start-time))))
+ (message "[STARTUP] Loading %s ... done (%.3fs)" load-file-name elapsed))) \ No newline at end of file
diff --git a/lisp/lib/sachachua.el b/lisp/lib/sachachua.el
new file mode 100644
index 0000000..c862223
--- /dev/null
+++ b/lisp/lib/sachachua.el
@@ -0,0 +1,39 @@
+;; Increase-decrease functions from Sacha Chua
+(defun sacha/increase-font-size ()
+ (interactive)
+ (set-face-attribute 'default
+ nil
+ :height
+ (ceiling (* 1.10
+ (face-attribute 'default :height)))))
+(defun sacha/decrease-font-size ()
+ (interactive)
+ (set-face-attribute 'default
+ nil
+ :height
+ (floor (* 0.9
+ (face-attribute 'default :height)))))
+
+;; Not original from Sacha. Taken from: http://emacsredux.com/blog/2013/05/22/smarter-navigation-to-the-beginning-of-a-line/
+(defun sacha/smarter-move-beginning-of-line (arg)
+ "Move point back to indentation of beginning of line.
+
+Move point to the first non-whitespace character on this line.
+If point is already there, move to the beginning of the line.
+Effectively toggle between the first non-whitespace character and
+the beginning of the line.
+
+If ARG is not nil or 1, move forward ARG - 1 lines first. If
+point reaches the beginning or end of the buffer, stop there."
+ (interactive "^p")
+ (setq arg (or arg 1))
+
+ ;; Move lines first
+ (when (/= arg 1)
+ (let ((line-move-visual nil))
+ (forward-line (1- arg))))
+
+ (let ((orig-point (point)))
+ (back-to-indentation)
+ (when (= orig-point (point))
+ (move-beginning-of-line 1))))