aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/init-utils.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/init-utils.el')
-rw-r--r--lisp/init-utils.el56
1 files changed, 41 insertions, 15 deletions
diff --git a/lisp/init-utils.el b/lisp/init-utils.el
index 0490986..20e20a3 100644
--- a/lisp/init-utils.el
+++ b/lisp/init-utils.el
@@ -1,21 +1,47 @@
;; Loads functions from libs
-(defun load-directory (dir)
- (let ((load-it (lambda (f)
- (load-file (concat (file-name-as-directory dir) f)))
- ))
- (mapc load-it (directory-files dir nil "\\.el$"))))
+;;------------------------------------------------------------------------------
+;; Sachachua
+;;------------------------------------------------------------------------------
+;; 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)))))
-;; Load lib functions
-(load-directory (expand-file-name "~/.emacs.d/lisp/lib/" user-emacs-directory))
+;; 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.
-;; This is borrowed from https://github.com/purcell/emacs.d/blob/master/lisp/init-utils.el by Steve Purcell but I have added some stuff.
+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 (fboundp 'with-eval-after-load)
- (defalias 'after-load 'with-eval-after-load)
- (defmacro after-load (feature &rest body)
- "After FEATURE is loaded, evaluate BODY."
- (declare (indent defun))
- '(eval-after-load ,feature
- '(progn ,@body))))
+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))))
+;;------------------------------------------------------------------------------
(provide 'init-utils)