summaryrefslogtreecommitdiffstats
path: root/emacs/.emacs.d/site-lisp
diff options
context:
space:
mode:
authorGravatar Tom Willemse2015-12-18 01:47:38 +0100
committerGravatar Tom Willemse2015-12-18 01:47:38 +0100
commite2680b51cf66bdff546d73cf76a103dcc2aa13c4 (patch)
tree1bbadea538df40a7ec9cff17d5cdfc1d21d93c24 /emacs/.emacs.d/site-lisp
parent8dcf6df105b9e4a04620073dbbe2a31f8a02d028 (diff)
downloaddotfiles-e2680b51cf66bdff546d73cf76a103dcc2aa13c4.tar.gz
dotfiles-e2680b51cf66bdff546d73cf76a103dcc2aa13c4.zip
Move some commands to editing library
Diffstat (limited to 'emacs/.emacs.d/site-lisp')
-rw-r--r--emacs/.emacs.d/site-lisp/oni-editing.el46
1 files changed, 46 insertions, 0 deletions
diff --git a/emacs/.emacs.d/site-lisp/oni-editing.el b/emacs/.emacs.d/site-lisp/oni-editing.el
index 908b5e3..0383cef 100644
--- a/emacs/.emacs.d/site-lisp/oni-editing.el
+++ b/emacs/.emacs.d/site-lisp/oni-editing.el
@@ -105,6 +105,52 @@
(revert-buffer nil t nil))
;;;###autoload
+(defun oni:scroll-down-or-prev-page (arg)
+ "Either scroll down or go to the previous page.
+
+Depending on the value of `buffer-narrowed-p'."
+ (interactive "^P")
+ (if (buffer-narrowed-p)
+ (let ((scroll-error-top-bottom nil))
+ (condition-case nil
+ (scroll-down-command arg)
+ (beginning-of-buffer
+ (narrow-to-page -1)
+ (goto-char (point-min)))))
+ (scroll-down-command arg)))
+
+;;;###autoload
+(defun oni:scroll-up-or-next-page (arg)
+ "Either scroll up or go to the next page.
+
+Depending on the value of `buffer-narrowed-p'."
+ (interactive "^P")
+ (if (buffer-narrowed-p)
+ (let ((scroll-error-top-bottom nil))
+ (condition-case nil
+ (scroll-up-command arg)
+ (end-of-buffer
+ (narrow-to-page 1)
+ (goto-char (point-min)))))
+ (scroll-up-command arg)))
+
+;;;###autoload
+(defun oni:self-insert-dwim ()
+ "Execute self insert, but when the region is active call self
+insert at the end of the region and at the beginning."
+ (interactive)
+ (if (region-active-p)
+ (let ((electric-pair-mode nil)
+ (beginning (region-beginning))
+ (end (region-end)))
+ (goto-char end)
+ (self-insert-command 1)
+ (save-excursion
+ (goto-char beginning)
+ (self-insert-command 1)))
+ (self-insert-command 1)))
+
+;;;###autoload
(defun oni:upcase-prev (num)
(interactive "p")
(oni:change-prev-case num 'up))