attempt 2

This commit is contained in:
Jean-Philippe Bernardy 2019-05-24 10:30:28 +02:00
parent e5591395f3
commit 6f696084a9

View file

@ -70,20 +70,24 @@ This item is either the symbol at point, or, if this fails, the sexp at point."
(save-excursion
(skip-chars-forward "^|") (point))))))
(with-eval-after-load 'org
(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))))))))))
(declare-function org-back-to-heading "org" (&optional invisible-ok))
(declare-function org-end-of-subtree "org" (&optional invisible-ok to-heading))
(declare-function org-at-heading-p "org" (&optional ignored))
(declare-function org-with-limited-levels "org-macs" (&rest body))
(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."