Move some commands to editing library
This commit is contained in:
parent
8dcf6df105
commit
e2680b51cf
2 changed files with 46 additions and 43 deletions
|
@ -141,49 +141,6 @@ MODE1 is enabled and vice-versa."
|
||||||
"Set the `disabled' property for each item in FUNCTIONS to nil."
|
"Set the `disabled' property for each item in FUNCTIONS to nil."
|
||||||
(mapc #'(lambda (f) (put f 'disabled nil)) functions))
|
(mapc #'(lambda (f) (put f 'disabled nil)) functions))
|
||||||
|
|
||||||
(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)))
|
|
||||||
|
|
||||||
(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)))
|
|
||||||
|
|
||||||
(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)))
|
|
||||||
|
|
||||||
(defun oni:set-emacs-lisp-keys ()
|
(defun oni:set-emacs-lisp-keys ()
|
||||||
"Set some keys for `emacs-lisp-mode'."
|
"Set some keys for `emacs-lisp-mode'."
|
||||||
(local-set-key (kbd "C-.") 'find-function))
|
(local-set-key (kbd "C-.") 'find-function))
|
||||||
|
|
|
@ -104,6 +104,52 @@
|
||||||
(interactive)
|
(interactive)
|
||||||
(revert-buffer nil t nil))
|
(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
|
;;;###autoload
|
||||||
(defun oni:upcase-prev (num)
|
(defun oni:upcase-prev (num)
|
||||||
(interactive "p")
|
(interactive "p")
|
||||||
|
|
Loading…
Reference in a new issue