From bf6c65a42e04d4753c58795442a479685bb5f318 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 26 Jan 2011 11:14:11 +0100 Subject: [PATCH] org: remove org-invisible-p * org.el: Remove org-invisible-p: outline-invisible-p is available in Emacs 22 and in recent XEmacs 21. Replace in various files. Signed-off-by: Julien Danjou --- lisp/org-clock.el | 2 +- lisp/org-crypt.el | 2 +- lisp/org-exp.el | 2 +- lisp/org-list.el | 3 +- lisp/org.el | 59 +++++++++++++++++++++------------------------------- 5 files changed, 28 insertions(+), 40 deletions(-) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 8bb67d9..dac035f 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -2481,7 +2481,7 @@ The details of what will be saved are regulated by the variable (goto-char (cdr resume-clock)) (let ((org-clock-auto-clock-resolution nil)) (org-clock-in) - (if (org-invisible-p) + (if (outline-invisible-p) (org-show-context)))))))))) ;;;###autoload diff --git a/lisp/org-crypt.el b/lisp/org-crypt.el index 1d76104..1758a81 100644 --- a/lisp/org-crypt.el +++ b/lisp/org-crypt.el @@ -112,7 +112,7 @@ This setting can also be overridden in the CRYPTKEY property." (let ((start-heading (point))) (forward-line) (when (not (looking-at "-----BEGIN PGP MESSAGE-----")) - (let ((folded (org-invisible-p)) + (let ((folded (outline-invisible-p)) (epg-context (epg-make-context nil t t)) (crypt-key (org-crypt-key-for-heading)) (beg (point)) diff --git a/lisp/org-exp.el b/lisp/org-exp.el index 7c814cd..e84a7c2 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -2615,7 +2615,7 @@ command." (goto-char (point-min)) (while (re-search-forward org-drawer-regexp nil t) (goto-char (match-beginning 1)) - (or (org-invisible-p) (org-flag-drawer nil)))) + (or (outline-invisible-p) (org-flag-drawer nil)))) (with-current-buffer buffer (erase-buffer)) (save-excursion (setq s (goto-char (point-min))) diff --git a/lisp/org-list.el b/lisp/org-list.el index bc8e7bd..0c519fc 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -44,7 +44,6 @@ (defvar org-ts-regexp) (defvar org-ts-regexp-both) -(declare-function org-invisible-p "org" ()) (declare-function org-on-heading-p "org" (&optional invisible-ok)) (declare-function outline-next-heading "outline" ()) (declare-function org-back-to-heading "org" (&optional invisible-ok)) @@ -1101,7 +1100,7 @@ item is invisible." (unless (or (not (org-in-item-p)) (save-excursion (goto-char (org-get-item-beginning)) - (org-invisible-p))) + (outline-invisible-p))) (if (save-excursion (goto-char (org-get-item-beginning)) (org-at-item-timer-p)) diff --git a/lisp/org.el b/lisp/org.el index fcdf245..d6b9c0d 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -6010,7 +6010,7 @@ in special contexts. (save-excursion (goto-char eos) (outline-next-heading) - (if (org-invisible-p) (org-flag-heading nil)))) + (if (outline-invisible-p) (org-flag-heading nil)))) ((and (or (>= eol eos) (not (string-match "\\S-" (buffer-substring eol eos)))) (or has-children @@ -6024,7 +6024,7 @@ in special contexts. (save-excursion (goto-char eos) (outline-next-heading) - (if (org-invisible-p) (org-flag-heading nil))) + (if (outline-invisible-p) (org-flag-heading nil))) (setq org-cycle-subtree-status 'children) (run-hook-with-args 'org-cycle-hook 'children)) ((or children-skipped @@ -6191,9 +6191,9 @@ This function is the default value of the hook `org-cycle-hook'." ;; Properly fold already folded siblings (goto-char (point-min)) (while (re-search-forward re nil t) - (if (and (not (org-invisible-p)) + (if (and (not (outline-invisible-p)) (save-excursion - (goto-char (point-at-eol)) (org-invisible-p))) + (goto-char (point-at-eol)) (outline-invisible-p))) (hide-entry)))) (org-cycle-show-empty-lines 'overview) (org-cycle-hide-drawers 'overview))))) @@ -6526,7 +6526,7 @@ the headline hierarchy above." (progn (org-mark-ring-push org-goto-start-pos) (goto-char selected-point) - (if (or (org-invisible-p) (org-invisible-p2)) + (if (or (outline-invisible-p) (org-invisible-p2)) (org-show-context 'org-goto))) (message "Quit")))) @@ -6571,7 +6571,7 @@ or nil." (org-show-siblings t) (org-show-following-heading t)) (goto-char org-goto-start-pos) - (and (org-invisible-p) (org-show-context))) + (and (outline-invisible-p) (org-show-context))) (goto-char (point-min))) (let (org-special-ctrl-a/e) (org-beginning-of-line)) (message "Select location and press RET") @@ -6786,14 +6786,14 @@ This is important for non-interactive uses of the command." (cond ((and (org-on-heading-p) (bolp) (or (bobp) - (save-excursion (backward-char 1) (not (org-invisible-p))))) + (save-excursion (backward-char 1) (not (outline-invisible-p))))) ;; insert before the current line (open-line (if blank 2 1))) ((and (bolp) (not org-insert-heading-respect-content) (or (bobp) (save-excursion - (backward-char 1) (not (org-invisible-p))))) + (backward-char 1) (not (outline-invisible-p))))) ;; insert right here nil) (t @@ -6801,7 +6801,7 @@ This is important for non-interactive uses of the command." (save-excursion (setq previous-pos (point-at-bol)) (end-of-line) - (setq hide-previous (org-invisible-p))) + (setq hide-previous (outline-invisible-p))) (and org-insert-heading-respect-content (org-show-subtree)) (let ((split (and (org-get-alist-option org-M-RET-may-split-line 'headline) @@ -7257,7 +7257,7 @@ case." (setq beg (point))) (save-match-data (save-excursion (outline-end-of-heading) - (setq folded (org-invisible-p))) + (setq folded (outline-invisible-p))) (outline-end-of-subtree)) (outline-next-heading) (setq ne-end (org-back-over-empty-lines)) @@ -7349,7 +7349,7 @@ useful if the caller implements cut-and-paste as copy-then-paste-then-cut." (skip-chars-forward " \t\r\n") (save-match-data (save-excursion (outline-end-of-heading) - (setq folded (org-invisible-p))) + (setq folded (outline-invisible-p))) (condition-case nil (org-forward-same-level (1- n) t) (error nil)) @@ -7397,7 +7397,7 @@ the inserted text when done." (error "%s" (substitute-command-keys "The kill is not a (set of) tree(s) - please use \\[yank] to yank anyway"))) - (let* ((visp (not (org-invisible-p))) + (let* ((visp (not (outline-invisible-p))) (txt tree) (^re (concat "^\\(" outline-regexp "\\)")) (re (concat "\\(" outline-regexp "\\)")) @@ -7459,7 +7459,7 @@ the inserted text when done." (goto-char beg) (skip-chars-forward " \t\n\r") (setq beg (point)) - (if (and (org-invisible-p) visp) + (if (and (outline-invisible-p) visp) (save-excursion (outline-show-heading))) ;; Shift if necessary (unless (= shift 0) @@ -8976,7 +8976,7 @@ If the link is in hidden text, expose it." (if (re-search-forward org-any-link-re nil t) (progn (goto-char (match-beginning 0)) - (if (org-invisible-p) (org-show-context))) + (if (outline-invisible-p) (org-show-context))) (goto-char pos) (setq org-link-search-failed t) (error "No further link found")))) @@ -8996,7 +8996,7 @@ If the link is in hidden text, expose it." (if (re-search-backward org-any-link-re nil t) (progn (goto-char (match-beginning 0)) - (if (org-invisible-p) (org-show-context))) + (if (outline-invisible-p) (org-show-context))) (goto-char pos) (setq org-link-search-failed t) (error "No further link found")))) @@ -9642,7 +9642,7 @@ onto the ring." (setq m (car p)) (switch-to-buffer (marker-buffer m)) (goto-char m) - (if (or (org-invisible-p) (org-invisible-p2)) (org-show-context 'mark-goto)))) + (if (or (outline-invisible-p) (org-invisible-p2)) (org-show-context 'mark-goto)))) (defun org-remove-angle-brackets (s) (if (equal (substring s 0 1) "<") (setq s (substring s 1))) @@ -12023,7 +12023,7 @@ How much context is shown depends upon the variables ;; Show heading or entry text (if (and heading-p (not entry-p)) (org-flag-heading nil) ; only show the heading - (and (or entry-p (org-invisible-p) (org-invisible-p2)) + (and (or entry-p (outline-invisible-p) (org-invisible-p2)) (org-show-hidden-entry))) ; show entire entry (when following-p ;; Show next sibling, or heading below text @@ -13807,7 +13807,7 @@ formats in the current buffer." (setq end (point)) (goto-char beg) (while (re-search-forward re end t)) - (setq hiddenp (org-invisible-p)) + (setq hiddenp (outline-invisible-p)) (end-of-line 1) (and (equal (char-after) ?\n) (forward-char 1)) (while (looking-at "^[ \t]*\\(:CLOCK:\\|:LOGBOOK:\\|CLOCK:\\|:END:\\)") @@ -19176,13 +19176,6 @@ interactive command with similar behavior." (define-key org-mode-map "\C-y" 'org-yank) -(defun org-invisible-p () - "Check if point is at a character currently not visible." - ;; Early versions of noutline don't have `outline-invisible-p'. - (if (fboundp 'outline-invisible-p) - (outline-invisible-p) - (get-char-property (point) 'invisible))) - (defun org-truely-invisible-p () "Check if point is at a character currently not visible. This version does not only check the character property, but also @@ -19190,18 +19183,14 @@ This version does not only check the character property, but also ;; Early versions of noutline don't have `outline-invisible-p'. (if (org-bound-and-true-p visible-mode) nil - (if (fboundp 'outline-invisible-p) - (outline-invisible-p) - (get-char-property (point) 'invisible)))) + (outline-invisible-p))) (defun org-invisible-p2 () "Check if point is at a character currently not visible." (save-excursion (if (and (eolp) (not (bobp))) (backward-char 1)) ;; Early versions of noutline don't have `outline-invisible-p'. - (if (fboundp 'outline-invisible-p) - (outline-invisible-p) - (get-char-property (point) 'invisible)))) + (outline-invisible-p))) (defun org-back-to-heading (&optional invisible-ok) "Call `outline-back-to-heading', but provide a better error message." @@ -19429,7 +19418,7 @@ it wil also look at invisible ones." (setq l (- (match-end 0) (match-beginning 0) 1)) (= l level) (not invisible-ok) - (progn (backward-char 1) (org-invisible-p))) + (progn (backward-char 1) (outline-invisible-p))) (if (< l level) (setq arg 1))) (setq arg (1- arg))) (beginning-of-line 1))) @@ -19448,7 +19437,7 @@ Stop at the first and last subheadings of a superior heading." (setq l (- (match-end 0) (match-beginning 0) 1)) (= l level) (not invisible-ok) - (org-invisible-p)) + (outline-invisible-p)) (if (< l level) (setq arg 1))) (setq arg (1- arg))))) @@ -19669,9 +19658,9 @@ To get rid of the restriction, use \\[org-agenda-remove-restriction-lock]." (defun org-bookmark-jump-unhide () "Unhide the current position, to show the bookmark location." (and (org-mode-p) - (or (org-invisible-p) + (or (outline-invisible-p) (save-excursion (goto-char (max (point-min) (1- (point)))) - (org-invisible-p))) + (outline-invisible-p))) (org-show-context 'bookmark-jump))) ;; Make session.el ignore our circular variable -- 1.7.2.3