mirror of
https://github.com/jimeh/.emacs.d.git
synced 2026-02-19 13:46:41 +00:00
I've taken a lot of inspiration from Emacs-Prelude when it came to the structure of this rewritten config. I didn't want to use Prelude as I don't agree with all it's defaults, nor do I want to have to deal with any future changes in Prelude that might break things for me. So instead I went down the fully custom path, but heavily inspired by Prelude, both in terms of file/code structure, and also some of it's features. Compared to my old config setup, it's got most of the same things, but nearly everything is in a module file now, making it easy to fully enable/disable certain features.
46 lines
1.2 KiB
EmacsLisp
46 lines
1.2 KiB
EmacsLisp
;;
|
|
;; core stuff - again shamelessly ripped from Emacs Prelude
|
|
;;
|
|
|
|
|
|
(defun siren-smart-open-line-above ()
|
|
"Insert an empty line above the current line.
|
|
Position the cursor at it's beginning, according to the current mode."
|
|
(interactive)
|
|
(move-beginning-of-line nil)
|
|
(newline-and-indent)
|
|
(forward-line -1)
|
|
(indent-according-to-mode))
|
|
|
|
(defun siren-wrap-with (s)
|
|
"Create a wrapper function for smartparens using S."
|
|
`(lambda (&optional arg)
|
|
(interactive "P")
|
|
(sp-wrap-with-pair ,s)))
|
|
|
|
(defun siren-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))))
|
|
|
|
|
|
(provide 'siren-core)
|