From 65d49470e3562d02ee4c53a00c0348a7444cfc03 Mon Sep 17 00:00:00 2001 From: Somelauw Date: Fri, 25 Aug 2017 15:12:12 +0200 Subject: Cleanup - Remove 'leader from evil-org-keytheme variable - Put insertion functions after motions - Deprecate RSI keytheme (I'm not aware of anyone using it. If so, feel free to open an issue) --- evil-org.el | 154 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 77 insertions(+), 77 deletions(-) diff --git a/evil-org.el b/evil-org.el index fa2822c..517f55a 100644 --- a/evil-org.el +++ b/evil-org.el @@ -80,8 +80,7 @@ arguments." (const additional) (const shift) (const todo) - (const heading) - (const leader))) + (const heading))) (defcustom evil-org-special-o/O '(table-row item) "When o and O should be special. @@ -130,81 +129,6 @@ Optional argument ARGUMENTS arguments to pass to FUN." (apply fun arguments) (evil-insert nil)) -;;; insertion commands -(defun evil-org-insert-line (count) - "Insert at beginning of line, but ignore heading and item markers. -The insertion will be repeated COUNT times." - (interactive "p") - (if (org-at-heading-or-item-p) - ;; Manipulate org-beginning-of-line to become special - (let ((org-special-ctrl-a/e t)) - (beginning-of-line) - (org-beginning-of-line nil) - (evil-insert count)) - (evil-insert-line count))) - -(defun evil-org-append-line (count) - "Insert at beginning of line but ignore tags and ellipses at end of the line. -The insertion will be repeated COUNT times." - (interactive "p") - (if (org-at-heading-p) - ;; Manipulate org-end-of-line to become special - (let ((org-special-ctrl-a/e t)) - (end-of-line) - (org-end-of-line nil) - (evil-insert count)) - (evil-append-line count))) - -(defun evil-org-open-below (count) - "Clever insertion of org item. -Argument COUNT number of lines to insert. -The behavior in items and tables can be controlled using ‘evil-org-special-o/O’. -Passing in any prefix argument, executes the command without special behavior." - (interactive "P") - (end-of-visible-line) - (let* ((special (and (null count) evil-org-special-o/O)) - (ignore (when (memq 'item special) evil-org-special-o/O-ignore)) - (elements (append special ignore)) - (e (org-element-lineage (org-element-at-point) elements t))) - (cl-case (org-element-type e) - ((table-row) (org-table-insert-row '(4)) (evil-insert nil)) - ((item) (org-insert-item) (evil-insert nil)) - (otherwise (evil-open-below count))))) - -(defun evil-org-open-above (count) - "Clever insertion of org item. -Argument COUNT number of lines to insert. -The behavior in items and tables can be controlled using ‘evil-org-special-o/O’. -Passing in any prefix argument, executes the command without special behavior." - (interactive "P") - (end-of-visible-line) - (let* ((special (and (null count) evil-org-special-o/O)) - (ignore (when (memq 'item special) evil-org-special-o/O-ignore)) - (elements (append special ignore)) - (e (org-element-lineage (org-element-at-point) elements t))) - (cl-case (org-element-type e) - ((table-row) (org-table-insert-row) (evil-insert nil)) - ((item) (beginning-of-line) (org-insert-item) (evil-insert nil)) - (otherwise (evil-open-above count))))) - -(defun evil-org-insert-subheading (&optional arg) - "Insert new subheading. -Optional argument ARG If one prefix argument is given, insert at the end of current subtree." - (interactive "P") - (end-of-visible-line) - (org-insert-heading arg) - (org-metaright) - (evil-insert nil)) - -(defun evil-org-insert-subtodo (&optional arg) - "Insert new todo subheading. -Optional argument ARG If one prefix argument is given, insert at the end of current subtree." - (interactive "P") - (end-of-visible-line) - (org-insert-todo-heading arg) - (org-metaright) - (evil-insert nil)) - ;;; motion declarations (evil-declare-motion 'org-beginning-of-line) (evil-declare-motion 'org-end-of-line) @@ -288,6 +212,81 @@ Optional argument ARG If one prefix argument is given, insert at the end of curr (defalias 'evil-org-beginning-of-line 'org-beginning-of-line) +;;; insertion commands +(defun evil-org-insert-line (count) + "Insert at beginning of line, but ignore heading and item markers. +The insertion will be repeated COUNT times." + (interactive "p") + (if (org-at-heading-or-item-p) + ;; Manipulate org-beginning-of-line to become special + (let ((org-special-ctrl-a/e t)) + (beginning-of-line) + (org-beginning-of-line nil) + (evil-insert count)) + (evil-insert-line count))) + +(defun evil-org-append-line (count) + "Insert at beginning of line but ignore tags and ellipses at end of the line. +The insertion will be repeated COUNT times." + (interactive "p") + (if (org-at-heading-p) + ;; Manipulate org-end-of-line to become special + (let ((org-special-ctrl-a/e t)) + (end-of-line) + (org-end-of-line nil) + (evil-insert count)) + (evil-append-line count))) + +(defun evil-org-open-below (count) + "Clever insertion of org item. +Argument COUNT number of lines to insert. +The behavior in items and tables can be controlled using ‘evil-org-special-o/O’. +Passing in any prefix argument, executes the command without special behavior." + (interactive "P") + (end-of-visible-line) + (let* ((special (and (null count) evil-org-special-o/O)) + (ignore (when (memq 'item special) evil-org-special-o/O-ignore)) + (elements (append special ignore)) + (e (org-element-lineage (org-element-at-point) elements t))) + (cl-case (org-element-type e) + ((table-row) (org-table-insert-row '(4)) (evil-insert nil)) + ((item) (org-insert-item) (evil-insert nil)) + (otherwise (evil-open-below count))))) + +(defun evil-org-open-above (count) + "Clever insertion of org item. +Argument COUNT number of lines to insert. +The behavior in items and tables can be controlled using ‘evil-org-special-o/O’. +Passing in any prefix argument, executes the command without special behavior." + (interactive "P") + (end-of-visible-line) + (let* ((special (and (null count) evil-org-special-o/O)) + (ignore (when (memq 'item special) evil-org-special-o/O-ignore)) + (elements (append special ignore)) + (e (org-element-lineage (org-element-at-point) elements t))) + (cl-case (org-element-type e) + ((table-row) (org-table-insert-row) (evil-insert nil)) + ((item) (beginning-of-line) (org-insert-item) (evil-insert nil)) + (otherwise (evil-open-above count))))) + +(defun evil-org-insert-subheading (&optional arg) + "Insert new subheading. +Optional argument ARG If one prefix argument is given, insert at the end of current subtree." + (interactive "P") + (end-of-visible-line) + (org-insert-heading arg) + (org-metaright) + (evil-insert nil)) + +(defun evil-org-insert-subtodo (&optional arg) + "Insert new todo subheading. +Optional argument ARG If one prefix argument is given, insert at the end of current subtree." + (interactive "P") + (end-of-visible-line) + (org-insert-todo-heading arg) + (org-metaright) + (evil-insert nil)) + ;;; operators (evil-define-operator evil-org-demote-or-indent (beg end count) "Demote or indent selection (dwim)." @@ -593,6 +592,7 @@ Includes tables, list items and subtrees." (defun evil-org--populate-rsi-bindings () "Define key bindings to use in hybrid state." + (obsolete "Please create a github issue if you want to keep RSI bindings." "0.9.1") (define-key org-mode-map (kbd "C-d") (lambda (n) (interactive "p") -- cgit v1.0