summaryrefslogtreecommitdiffstats
path: root/emacs
diff options
context:
space:
mode:
authorGravatar Tom Willemse2015-12-18 00:13:16 +0100
committerGravatar Tom Willemse2015-12-18 00:13:16 +0100
commitfa0b9c87eb9599ad83729e34c989919a70748472 (patch)
treed6c2339ad9d7888853a0ad34e181a394b1bc5c17 /emacs
parent355b452a4cd0aeb2e86e13946c65f7a3ce47c69d (diff)
downloaddotfiles-fa0b9c87eb9599ad83729e34c989919a70748472.tar.gz
dotfiles-fa0b9c87eb9599ad83729e34c989919a70748472.zip
Move some commands to editing library
Diffstat (limited to 'emacs')
-rw-r--r--emacs/.emacs.d/init.el26
-rw-r--r--emacs/.emacs.d/site-lisp/oni-editing.el28
2 files changed, 28 insertions, 26 deletions
diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el
index ed13646..8d3b3de 100644
--- a/emacs/.emacs.d/init.el
+++ b/emacs/.emacs.d/init.el
@@ -141,32 +141,6 @@ MODE1 is enabled and vice-versa."
"Set the `disabled' property for each item in FUNCTIONS to nil."
(mapc #'(lambda (f) (put f 'disabled nil)) functions))
-(defun oni:move-beginning-of-dwim ()
- "Move to beginning of line either after indentation or before."
- (interactive)
- (let ((start (point)))
- (back-to-indentation)
- (if (= start (point))
- (move-beginning-of-line 1))))
-
-(defun oni:move-end-of-dwim ()
- "Move to end of line, either before any comments or after."
- (interactive)
- (let ((start (point))
- (eolpos (line-end-position)))
- (beginning-of-line)
- (if (and comment-start
- (not (looking-at (regexp-quote comment-start)))
- (comment-search-forward eolpos t))
- (progn
- (search-backward-regexp (concat "[^ \t" comment-start "]"))
- (forward-char)
-
- (when (or (bolp)
- (= start (point)))
- (end-of-line)))
- (end-of-line))))
-
(defun oni:scuttle-formatter (plist)
"Format RSS items from Scuttle as org tasks.
diff --git a/emacs/.emacs.d/site-lisp/oni-editing.el b/emacs/.emacs.d/site-lisp/oni-editing.el
index 315750d..8e19562 100644
--- a/emacs/.emacs.d/site-lisp/oni-editing.el
+++ b/emacs/.emacs.d/site-lisp/oni-editing.el
@@ -24,6 +24,15 @@
;;; Code:
+;;;###autoload
+(defun oni:move-beginning-of-dwim ()
+ "Move to beginning of line either after indentation or before."
+ (interactive)
+ (let ((start (point)))
+ (back-to-indentation)
+ (if (= start (point))
+ (move-beginning-of-line 1))))
+
(defun oni:change-number-at-point (change-func)
"Use CHANGE-FUNC to change the number at `point'."
(let ((num (number-to-string (funcall change-func (number-at-point))))
@@ -52,6 +61,25 @@
(oni:change-prev-case num 'down))
;;;###autoload
+(defun oni:move-end-of-dwim ()
+ "Move to end of line, either before any comments or after."
+ (interactive)
+ (let ((start (point))
+ (eolpos (line-end-position)))
+ (beginning-of-line)
+ (if (and comment-start
+ (not (looking-at (regexp-quote comment-start)))
+ (comment-search-forward eolpos t))
+ (progn
+ (search-backward-regexp (concat "[^ \t" comment-start "]"))
+ (forward-char)
+
+ (when (or (bolp)
+ (= start (point)))
+ (end-of-line)))
+ (end-of-line))))
+
+;;;###autoload
(defun oni:increase-number-at-point ()
"Take the number at `point' and replace it with it increased by 1."
(interactive)