diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2017-12-06 16:22:09 +0100 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2018-01-10 15:58:21 +0100 |
commit | a8ee20d23d3c2250477bf7590e225da48f327dd3 (patch) | |
tree | c10c8cab7ea7c34a78b0a4f3dc6d6410587e3450 | |
parent | 4dbb4a76a7a52463b941524c54b80df99f3d2762 (diff) | |
download | org-mode-a8ee20d23d3c2250477bf7590e225da48f327dd3.tar.gz |
Replace `outline-flag-region' with `org-flag-region'
* lisp/org-inlinetask.el (org-inlinetask-toggle-visibility):
* lisp/org-list.el (org-list-set-item-visibility):
* lisp/org.el (org-flag-subtree):
(org-cycle-internal-local):
(org-cycle-show-empty-lines):
(org-set-outline-overlay-data):
(org-move-subtree-down):
(org-set-tags):
(org-flag-heading):
(org-show-children):
(org-show-subtree):
(org-show-entry): Replace `outline-flag-region' with
`org-flag-region'.
-rw-r--r-- | lisp/org-inlinetask.el | 4 | ||||
-rw-r--r-- | lisp/org-list.el | 33 | ||||
-rw-r--r-- | lisp/org.el | 62 |
3 files changed, 43 insertions, 56 deletions
diff --git a/lisp/org-inlinetask.el b/lisp/org-inlinetask.el index 5c2fd49..f75d932 100644 --- a/lisp/org-inlinetask.el +++ b/lisp/org-inlinetask.el @@ -324,8 +324,8 @@ If the task has an end part, also demote it." ((= end start)) ;; Inlinetask was folded: expand it. ((eq (get-char-property (1+ start) 'invisible) 'outline) - (outline-flag-region start end nil)) - (t (outline-flag-region start end t))))) + (org-flag-region start end nil 'outline)) + (t (org-flag-region start end t 'outline))))) (defun org-inlinetask-hide-tasks (state) "Hide inline tasks in buffer when STATE is `contents' or `children'. diff --git a/lisp/org-list.el b/lisp/org-list.el index 9eee320..2043f11 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -106,33 +106,25 @@ (declare-function org-element-at-point "org-element" ()) (declare-function org-element-context "org-element" (&optional element)) (declare-function org-element-interpret-data "org-element" (data)) -(declare-function - org-element-lineage "org-element" (blob &optional types with-self)) +(declare-function org-element-lineage "org-element" (blob &optional types with-self)) (declare-function org-element-macro-interpreter "org-element" (macro ##)) -(declare-function - org-element-map "org-element" - (data types fun &optional info first-match no-recursion with-affiliated)) +(declare-function org-element-map "org-element" (data types fun &optional info first-match no-recursion with-affiliated)) (declare-function org-element-normalize-string "org-element" (s)) -(declare-function org-element-parse-buffer "org-element" - (&optional granularity visible-only)) +(declare-function org-element-parse-buffer "org-element" (&optional granularity visible-only)) (declare-function org-element-property "org-element" (property element)) -(declare-function org-element-put-property "org-element" - (element property value)) +(declare-function org-element-put-property "org-element" (element property value)) (declare-function org-element-set-element "org-element" (old new)) (declare-function org-element-type "org-element" (element)) (declare-function org-element-update-syntax "org-element" ()) -(declare-function org-entry-get "org" - (pom property &optional inherit literal-nil)) +(declare-function org-entry-get "org" (pom property &optional inherit literal-nil)) (declare-function org-export-create-backend "ox" (&rest rest) t) (declare-function org-export-data-with-backend "ox" (data backend info)) (declare-function org-export-get-backend "ox" (name)) -(declare-function org-export-get-environment "ox" - (&optional backend subtreep ext-plist)) -(declare-function org-export-get-next-element "ox" - (blob info &optional n)) -(declare-function org-export-with-backend "ox" - (backend data &optional contents info)) +(declare-function org-export-get-environment "ox" (&optional backend subtreep ext-plist)) +(declare-function org-export-get-next-element "ox" (blob info &optional n)) +(declare-function org-export-with-backend "ox" (backend data &optional contents info)) (declare-function org-fix-tags-on-the-fly "org" ()) +(declare-function org-flag-region "org" (from to flag spec)) (declare-function org-get-indentation "org" (&optional line)) (declare-function org-get-todo-state "org" ()) (declare-function org-in-block-p "org" (names)) @@ -155,7 +147,6 @@ (declare-function org-trim "org" (s &optional keep-lead)) (declare-function org-uniquify "org" (list)) (declare-function org-invisible-p "org" (&optional pos)) -(declare-function outline-flag-region "outline" (from to flag)) (declare-function outline-next-heading "outline" ()) (declare-function outline-previous-heading "outline" ()) @@ -2050,8 +2041,8 @@ Possible values are: `folded', `children' or `subtree'. See ((eq view 'folded) (let ((item-end (org-list-get-item-end-before-blank item struct))) ;; Hide from eol - (outline-flag-region (save-excursion (goto-char item) (point-at-eol)) - item-end t))) + (org-flag-region (save-excursion (goto-char item) (line-end-position)) + item-end t 'outline))) ((eq view 'children) ;; First show everything. (org-list-set-item-visibility item struct 'subtree) @@ -2064,7 +2055,7 @@ Possible values are: `folded', `children' or `subtree'. See ((eq view 'subtree) ;; Show everything (let ((item-end (org-list-get-item-end item struct))) - (outline-flag-region item item-end nil))))) + (org-flag-region item item-end nil 'outline))))) (defun org-list-item-body-column (item) "Return column at which body of ITEM should start." diff --git a/lisp/org.el b/lisp/org.el index bfa5926..8c75d2d 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -4652,15 +4652,13 @@ STATE should be one of the symbols listed in the docstring of (org-flag-subtree t) (org-end-of-subtree t)))))) -(declare-function outline-end-of-heading "outline" ()) -(declare-function outline-flag-region "outline" (from to flag)) (defun org-flag-subtree (flag) (save-excursion (org-back-to-heading t) - (outline-end-of-heading) - (outline-flag-region (point) - (progn (org-end-of-subtree t) (point)) - flag))) + (org-flag-region (line-end-position) + (progn (org-end-of-subtree t) (point)) + flag + 'outline))) (defalias 'org-advertized-archive-subtree 'org-archive-subtree) @@ -6899,7 +6897,7 @@ Use `\\[org-edit-special]' to edit table.el tables")) ;; now show everything. (unless (org-before-first-heading-p) (run-hook-with-args 'org-pre-cycle-hook 'subtree)) - (outline-flag-region eoh eos nil) + (org-flag-region eoh eos nil 'outline) (org-unlogged-message (if children-skipped "SUBTREE (NO CHILDREN)" "SUBTREE")) (setq org-cycle-subtree-status 'subtree) @@ -6908,7 +6906,7 @@ Use `\\[org-edit-special]' to edit table.el tables")) (t ;; Default action: hide the subtree. (run-hook-with-args 'org-pre-cycle-hook 'folded) - (outline-flag-region eoh eos t) + (org-flag-region eoh eos t 'outline) (org-unlogged-message "FOLDED") (setq org-cycle-subtree-status 'folded) (unless (org-before-first-heading-p) @@ -7095,7 +7093,7 @@ are at least `org-cycle-separator-lines' empty lines before the headline." (goto-char (match-beginning 0)) (skip-chars-backward " \t\n") (line-end-position))))) - (outline-flag-region b e nil)))))))) + (org-flag-region b e nil 'outline)))))))) ;; Never hide empty lines at the end of the file. (save-excursion (goto-char (point-max)) @@ -7103,7 +7101,7 @@ are at least `org-cycle-separator-lines' empty lines before the headline." (outline-end-of-heading) (when (and (looking-at "[ \t\n]+") (= (match-end 0) (point-max))) - (outline-flag-region (point) (match-end 0) nil)))) + (org-flag-region (point) (match-end 0) nil 'outline)))) (defun org-show-empty-lines-in-parent () "Move to the parent and re-show empty lines before visible headlines." @@ -7219,7 +7217,7 @@ If USE-MARKERS is set, return the positions as markers." DATA should have been made by `org-outline-overlay-data'." (org-with-wide-buffer (org-show-all) - (dolist (c data) (outline-flag-region (car c) (cdr c) t)))) + (dolist (c data) (org-flag-region (car c) (cdr c) t 'outline)))) ;;; Folding of blocks @@ -8104,8 +8102,8 @@ case." (org-save-markers-in-region beg end) (delete-region beg end) (org-remove-empty-overlays-at beg) - (or (= beg (point-min)) (outline-flag-region (1- beg) beg nil)) - (or (bobp) (outline-flag-region (1- (point)) (point) nil)) + (unless (= beg (point-min)) (org-flag-region (1- beg) beg nil 'outline)) + (unless (bobp) (org-flag-region (1- (point)) (point) nil 'outline)) (and (not (bolp)) (looking-at "\n") (forward-char 1)) (let ((bbb (point))) (insert-before-markers txt) @@ -14359,7 +14357,9 @@ When JUST-ALIGN is non-nil, only align tags." ;; When text is being inserted on an invisible ;; region boundary, it can be inadvertently sucked ;; into invisibility. - (outline-flag-region (point) (progn (insert " " tags) (point)) nil) + (org-flag-region (point) (progn (insert " " tags) (point)) + nil + 'outline) (skip-chars-backward " \t") (delete-region (point) (line-end-position))))) ;; Align tags, if any. Fix tags column if `org-indent-mode' @@ -23110,15 +23110,13 @@ When ENTRY is non-nil, show the entire entry." (save-excursion (org-back-to-heading t) ;; Check if we should show the entire entry - (if entry - (progn - (org-show-entry) - (save-excursion - (and (outline-next-heading) - (org-flag-heading nil)))) - (outline-flag-region (max (point-min) (1- (point))) - (save-excursion (outline-end-of-heading) (point)) - flag)))) + (if (not entry) + (org-flag-region + (line-end-position 0) (line-end-position) flag 'outline) + (org-show-entry) + (save-excursion + (and (outline-next-heading) + (org-flag-heading nil)))))) (defun org-get-next-sibling () "Move to next heading of the same level, and return point. @@ -23710,7 +23708,7 @@ heading to appear." 3)) (t (1- org-inlinetask-min-level)))))) ;; Display parent heading. - (outline-flag-region (line-end-position 0) (line-end-position) nil) + (org-flag-heading nil) (forward-line) ;; Display children. First child may be deeper than expected ;; MAX-LEVEL. Since we want to display it anyway, adjust @@ -23721,16 +23719,13 @@ heading to appear." current-level (max (funcall outline-level) max-level))) (setq past-first-child t)) - (outline-flag-region (line-end-position 0) (line-end-position) nil))))) + (org-flag-heading nil))))) (defun org-show-subtree () "Show everything after this heading at deeper levels." (interactive) - (outline-flag-region - (point) - (save-excursion - (org-end-of-subtree t t)) - nil)) + (org-flag-region + (point) (save-excursion (org-end-of-subtree t t)) nil 'outline)) (defun org-show-entry () "Show the body directly following this heading. @@ -23739,14 +23734,15 @@ Show the heading too, if it is currently invisible." (save-excursion (ignore-errors (org-back-to-heading t) - (outline-flag-region - (max (point-min) (1- (point))) + (org-flag-region + (line-end-position 0) (save-excursion (if (re-search-forward (concat "[\r\n]\\(" org-outline-regexp "\\)") nil t) (match-beginning 1) (point-max))) - nil)))) + nil + 'outline)))) (defun org-make-options-regexp (kwds &optional extra) "Make a regular expression for keyword lines. |