org-tree selection

This commit is contained in:
Jean-Philippe Bernardy 2019-05-24 09:36:53 +02:00
parent 8793eb138e
commit 4cc140e232
2 changed files with 20 additions and 5 deletions

View file

@ -70,6 +70,20 @@ This item is either the symbol at point, or, if this fails, the sexp at point."
(save-excursion
(skip-chars-forward "^|") (point))))))
(defun boon-select-org-tree ()
"Return the region corresponding to the current subtree."
(interactive)
(lambda ()
(boon-regs-from-bounds
(save-excursion
(save-match-data
(org-with-limited-levels
(cons
(progn (org-back-to-heading t) (point))
(progn (org-end-of-subtree t t)
(when (and (org-at-heading-p) (not (eobp))) (backward-char 1))
(point)))))))))
(defun boon-select-justline ()
"Return the region of the current line, without any newline."
(interactive) (boon-regs-from-bounds (cons (line-beginning-position) (line-end-position))))

View file

@ -14,14 +14,15 @@
(define-key boon-select-map "r" 'boon-select-justline) ;; Row
(define-key boon-select-map "s" '("symbol" . boon-select-wim)) ;; symbol
(define-key boon-select-map "t" 'boon-select-with-spaces)
(define-key boon-select-map "T" 'boon-select-org-tree)
(define-key boon-select-map "d" 'boon-select-document)
(define-key boon-select-map "b" 'boon-select-block)
(define-key boon-select-map "C" 'boon-select-comment)
(define-key boon-select-map "x" 'boon-select-outside-pairs) ;; eXpression
(define-key boon-select-map "c" 'boon-select-inside-pairs) ;; Contents
(define-key boon-select-map "z" 'boon-select-content) ;; inZide
(define-key boon-select-map "x" 'boon-select-outside-pairs) ;; eXpression
(define-key boon-select-map "C" 'boon-select-comment)
(define-key boon-select-map "c" 'boon-select-inside-pairs) ;; Contents
(define-key boon-select-map "b" 'boon-select-block)
(define-key boon-select-map "k" '("blanks" . boon-select-blanks))