mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-12-23 10:34:17 +00:00
Implement `org-show-all'
* lisp/org.el (org-show-all): New function. (org-cycle): (org-cycle-internal-global): (org-global-cycle): (org-set-startup-visibility): (org-set-outline-overlay-data): (org-hide-block-all): (org-mode-hook): (org-tree-to-indirect-buffer): (org-sort-entries): (org-mode-map): (org-org-menu): * lisp/ob-lilypond.el (org-babel-lilypond-mark-error-line): * lisp/org-archive.el (org-archive-subtree): * lisp/org-capture.el (org-capture-place-template): * lisp/org-mouse.el (org-mouse-popup-global-menu): * lisp/ox-org.el (org-org-publish-to-org): * testing/org-test.el (org-test-at-id): (org-test-in-example-file): Use new function. * lisp/org-compat.el (org-show-block-all): Mark as obsolete.
This commit is contained in:
parent
d30bea7cee
commit
4dbb4a76a7
@ -92,7 +92,6 @@
|
||||
(declare-function org-uniquify "org" (list))
|
||||
(declare-function orgtbl-to-generic "org-table" (table params))
|
||||
(declare-function orgtbl-to-orgtbl "org-table" (table params))
|
||||
(declare-function outline-show-all "outline" ())
|
||||
(declare-function tramp-compat-make-temp-file "tramp-compat" (filename &optional dir-flag))
|
||||
|
||||
(defgroup org-babel nil
|
||||
|
@ -33,7 +33,9 @@
|
||||
|
||||
;;; Code:
|
||||
(require 'ob)
|
||||
(require 'outline)
|
||||
|
||||
(declare-function org-show-all "org" (&optional types))
|
||||
|
||||
(defalias 'lilypond-mode 'LilyPond-mode)
|
||||
|
||||
(add-to-list 'org-babel-tangle-lang-exts '("LilyPond" . "ly"))
|
||||
@ -264,7 +266,7 @@ LINE is the erroneous line"
|
||||
(setq case-fold-search nil)
|
||||
(if (search-forward line nil t)
|
||||
(progn
|
||||
(outline-show-all)
|
||||
(org-show-all)
|
||||
(set-mark (point))
|
||||
(goto-char (- (point) (length line))))
|
||||
(goto-char temp))))
|
||||
|
@ -315,7 +315,7 @@ direct children of this heading."
|
||||
org-odd-levels-only
|
||||
tr-org-odd-levels-only)))
|
||||
(goto-char (point-min))
|
||||
(outline-show-all)
|
||||
(org-show-all '(headings blocks))
|
||||
(if (and heading (not (and datetree-date (not datetree-subheading-p))))
|
||||
(progn
|
||||
(if (re-search-forward
|
||||
|
@ -1094,7 +1094,7 @@ may have been stored before."
|
||||
(org-switch-to-buffer-other-window
|
||||
(org-capture-get-indirect-buffer (org-capture-get :buffer) "CAPTURE"))
|
||||
(widen)
|
||||
(outline-show-all)
|
||||
(org-show-all)
|
||||
(goto-char (org-capture-get :pos))
|
||||
(setq-local outline-level 'org-outline-level)
|
||||
(pcase (org-capture-get :type)
|
||||
|
@ -65,7 +65,6 @@
|
||||
(defalias 'outline-hide-entry 'hide-entry)
|
||||
(defalias 'outline-hide-sublevels 'hide-sublevels)
|
||||
(defalias 'outline-hide-subtree 'hide-subtree)
|
||||
(defalias 'outline-show-all 'show-all)
|
||||
(defalias 'outline-show-branches 'show-branches)
|
||||
(defalias 'outline-show-children 'show-children)
|
||||
(defalias 'outline-show-entry 'show-entry)
|
||||
@ -394,12 +393,21 @@ use of this function is for the stuck project list."
|
||||
(define-obsolete-variable-alias 'org-texinfo-def-table-markup
|
||||
'org-texinfo-table-default-markup "Org 9.1")
|
||||
|
||||
;;; The function was made obsolete by commit 65399674d5 of 2013-02-22.
|
||||
;;; This make-obsolete call was added 2016-09-01.
|
||||
;; The function was made obsolete by commit 65399674d5 of 2013-02-22.
|
||||
;; This make-obsolete call was added 2016-09-01.
|
||||
(make-obsolete 'org-capture-import-remember-templates
|
||||
"use the `org-capture-templates' variable instead."
|
||||
"Org 9.0")
|
||||
|
||||
(defun org-show-block-all ()
|
||||
"Unfold all blocks in the current buffer."
|
||||
(interactive)
|
||||
(remove-overlays nil nil 'invisible 'org-hide-block))
|
||||
|
||||
(make-obsolete 'org-show-block-all
|
||||
"use `org-show-all' instead."
|
||||
"Org 9.2")
|
||||
|
||||
|
||||
;;;; Obsolete link types
|
||||
|
||||
|
@ -498,7 +498,7 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:"
|
||||
`("Main Menu"
|
||||
["Show Overview" org-mouse-show-overview t]
|
||||
["Show Headlines" org-mouse-show-headlines t]
|
||||
["Show All" outline-show-all t]
|
||||
["Show All" org-show-all t]
|
||||
["Remove Highlights" org-remove-occur-highlights
|
||||
:visible org-occur-highlights]
|
||||
"--"
|
||||
|
40
lisp/org.el
40
lisp/org.el
@ -6595,6 +6595,19 @@ and subscripts."
|
||||
|
||||
(defvar org-inlinetask-min-level)
|
||||
|
||||
(defun org-show-all (&optional types)
|
||||
"Show all contents in the visible part of the buffer.
|
||||
By default, the function expands headings, blocks and drawers.
|
||||
When optional argument TYPE is a list of symbols among `blocks',
|
||||
`drawers' and `headings', to only expand one specific type."
|
||||
(dolist (type (or types '(blocks drawers headings)))
|
||||
(org-flag-region (point-min) (point-max) nil
|
||||
(pcase type
|
||||
(`blocks 'org-hide-block)
|
||||
(`drawers 'org-hide-drawer)
|
||||
(`headings 'outline)
|
||||
(_ (error "Invalid type: %S" type))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-cycle (&optional arg)
|
||||
"TAB-action and visibility cycling for Org mode.
|
||||
@ -6685,7 +6698,7 @@ if the variable `org-cycle-global-at-bob' is t."
|
||||
(org-unlogged-message "Startup visibility, plus VISIBILITY properties"))
|
||||
|
||||
((equal arg '(64))
|
||||
(outline-show-all)
|
||||
(org-show-all)
|
||||
(org-unlogged-message "Entire buffer visible, including drawers"))
|
||||
|
||||
((equal arg '(4)) (org-cycle-internal-global))
|
||||
@ -6786,7 +6799,7 @@ Use `\\[org-edit-special]' to edit table.el tables"))
|
||||
(eq org-cycle-global-status 'contents))
|
||||
;; We just showed the table of contents - now show everything
|
||||
(run-hook-with-args 'org-pre-cycle-hook 'all)
|
||||
(outline-show-all)
|
||||
(org-show-all '(headings blocks))
|
||||
(unless ga (org-unlogged-message "SHOW ALL"))
|
||||
(setq org-cycle-global-status 'all)
|
||||
(run-hook-with-args 'org-cycle-hook 'all))
|
||||
@ -6911,7 +6924,7 @@ With a numeric prefix, show all headlines up to that level."
|
||||
(if (derived-mode-p 'org-mode) org-cycle-include-plain-lists nil)))
|
||||
(cond
|
||||
((integerp arg)
|
||||
(outline-show-all)
|
||||
(org-show-all '(headings blocks))
|
||||
(outline-hide-sublevels arg)
|
||||
(setq org-cycle-global-status 'contents))
|
||||
((equal arg '(4))
|
||||
@ -6929,7 +6942,7 @@ With a numeric prefix, show all headlines up to that level."
|
||||
(org-content))
|
||||
((or (eq org-startup-folded 'showeverything)
|
||||
(eq org-startup-folded nil))
|
||||
(outline-show-all)))
|
||||
(org-show-all)))
|
||||
(unless (eq org-startup-folded 'showeverything)
|
||||
(when org-hide-block-startup (org-hide-block-all))
|
||||
(org-set-visibility-according-to-property)
|
||||
@ -7205,7 +7218,7 @@ If USE-MARKERS is set, return the positions as markers."
|
||||
"Create visibility overlays for all positions in DATA.
|
||||
DATA should have been made by `org-outline-overlay-data'."
|
||||
(org-with-wide-buffer
|
||||
(outline-show-all)
|
||||
(org-show-all)
|
||||
(dolist (c data) (outline-flag-region (car c) (cdr c) t))))
|
||||
|
||||
;;; Folding of blocks
|
||||
@ -7242,14 +7255,9 @@ Optional arguments START and END can be used to limit the range."
|
||||
(defun org-hide-block-all ()
|
||||
"Fold all blocks in the current buffer."
|
||||
(interactive)
|
||||
(org-show-block-all)
|
||||
(org-show-all '(blocks))
|
||||
(org-block-map 'org-hide-block-toggle-maybe))
|
||||
|
||||
(defun org-show-block-all ()
|
||||
"Unfold all blocks in the current buffer."
|
||||
(interactive)
|
||||
(remove-overlays nil nil 'invisible 'org-hide-block))
|
||||
|
||||
(defun org-hide-block-toggle-maybe ()
|
||||
"Toggle visibility of block at point.
|
||||
Unlike to `org-hide-block-toggle', this function does not throw
|
||||
@ -7298,7 +7306,7 @@ a block. Return a non-nil value when toggling is successful."
|
||||
;; Remove overlays when changing major mode
|
||||
(add-hook 'org-mode-hook
|
||||
(lambda () (add-hook 'change-major-mode-hook
|
||||
'org-show-block-all 'append 'local)))
|
||||
'org-show-all 'append 'local)))
|
||||
|
||||
;;; Indirect buffer display of subtrees
|
||||
|
||||
@ -7367,7 +7375,7 @@ frame is not changed."
|
||||
(pop-to-buffer ibuf))
|
||||
(t (error "Invalid value")))
|
||||
(narrow-to-region beg end)
|
||||
(outline-show-all)
|
||||
(org-show-all '(headings blocks))
|
||||
(goto-char pos)
|
||||
(run-hook-with-args 'org-cycle-hook 'all)
|
||||
(and (window-live-p cwin) (select-window cwin))))
|
||||
@ -8601,7 +8609,7 @@ function is being called interactively."
|
||||
(setq end (point-max))
|
||||
(setq what "top-level")
|
||||
(goto-char start)
|
||||
(outline-show-all)))
|
||||
(org-show-all '(headings blocks))))
|
||||
|
||||
(setq beg (point))
|
||||
(when (>= beg end) (goto-char start) (user-error "Nothing to sort"))
|
||||
@ -18957,7 +18965,7 @@ COMMANDS is a list of alternating OLDDEF NEWDEF command names."
|
||||
'delete-backward-char 'org-delete-backward-char)
|
||||
(org-defkey org-mode-map "|" 'org-force-self-insert)
|
||||
|
||||
(org-defkey org-mode-map "\C-c\C-a" 'outline-show-all) ; in case allout messed up.
|
||||
(org-defkey org-mode-map "\C-c\C-a" 'org-show-all)
|
||||
(org-defkey org-mode-map "\C-c\C-r" 'org-reveal)
|
||||
(if (boundp 'narrow-map)
|
||||
(org-defkey narrow-map "s" 'org-narrow-to-subtree)
|
||||
@ -20714,7 +20722,7 @@ an argument, unconditionally call `org-insert-heading'."
|
||||
["Cycle Global Visibility" org-shifttab :active (not (org-at-table-p))]
|
||||
["Sparse Tree..." org-sparse-tree t]
|
||||
["Reveal Context" org-reveal t]
|
||||
["Show All" outline-show-all t]
|
||||
["Show All" org-show-all t]
|
||||
"--"
|
||||
["Subtree to indirect buffer" org-tree-to-indirect-buffer t])
|
||||
"--"
|
||||
|
@ -328,8 +328,7 @@ Return output file name."
|
||||
newbuf)
|
||||
(with-current-buffer work-buffer
|
||||
(org-font-lock-ensure)
|
||||
(outline-show-all)
|
||||
(org-show-block-all)
|
||||
(org-show-all)
|
||||
(setq newbuf (htmlize-buffer)))
|
||||
(with-current-buffer newbuf
|
||||
(when org-org-htmlized-css-url
|
||||
|
@ -134,7 +134,7 @@ currently executed.")
|
||||
(condition-case nil
|
||||
(progn
|
||||
(org-show-subtree)
|
||||
(org-show-block-all))
|
||||
(org-show-all '(blocks)))
|
||||
(error nil))
|
||||
(save-restriction ,@body)))
|
||||
(unless (or visited-p (not to-be-removed))
|
||||
@ -158,7 +158,7 @@ currently executed.")
|
||||
(progn
|
||||
(outline-next-visible-heading 1)
|
||||
(org-show-subtree)
|
||||
(org-show-block-all))
|
||||
(org-show-all '(blocks)))
|
||||
(error nil))
|
||||
(save-restriction ,@body)))
|
||||
(unless visited-p
|
||||
|
Loading…
Reference in New Issue
Block a user