Move some commands to editing library
This commit is contained in:
parent
355b452a4c
commit
fa0b9c87eb
2 changed files with 28 additions and 26 deletions
|
@ -141,32 +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: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)
|
(defun oni:scuttle-formatter (plist)
|
||||||
"Format RSS items from Scuttle as org tasks.
|
"Format RSS items from Scuttle as org tasks.
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,15 @@
|
||||||
|
|
||||||
;;; Code:
|
;;; 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)
|
(defun oni:change-number-at-point (change-func)
|
||||||
"Use CHANGE-FUNC to change the number at `point'."
|
"Use CHANGE-FUNC to change the number at `point'."
|
||||||
(let ((num (number-to-string (funcall change-func (number-at-point))))
|
(let ((num (number-to-string (funcall change-func (number-at-point))))
|
||||||
|
@ -51,6 +60,25 @@
|
||||||
(interactive "p")
|
(interactive "p")
|
||||||
(oni:change-prev-case num 'down))
|
(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
|
;;;###autoload
|
||||||
(defun oni:increase-number-at-point ()
|
(defun oni:increase-number-at-point ()
|
||||||
"Take the number at `point' and replace it with it increased by 1."
|
"Take the number at `point' and replace it with it increased by 1."
|
||||||
|
|
Loading…
Reference in a new issue