From 6f696084a9644a1e6f8e69a167dd64b18e8c5d0e Mon Sep 17 00:00:00 2001 From: Jean-Philippe Bernardy Date: Fri, 24 May 2019 10:30:28 +0200 Subject: [PATCH] attempt 2 --- boon-arguments.el | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/boon-arguments.el b/boon-arguments.el index 9fdbb30..aa069e9 100644 --- a/boon-arguments.el +++ b/boon-arguments.el @@ -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."