1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-26 07:33:39 +00:00

Make folded blocks searchable

Patch by Eric Schulte
This commit is contained in:
Carsten Dominik 2009-08-20 08:59:34 +01:00
parent 38bdf41d1e
commit 62b932c8d5
2 changed files with 27 additions and 13 deletions

View File

@ -1,3 +1,7 @@
2009-08-20 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-hide-block-toggle): Make folded blocks searchable.
2009-08-19 Carsten Dominik <carsten.dominik@gmail.com>
* org-remember.el (org-remember-apply-template): Use

View File

@ -5364,24 +5364,34 @@ the range."
(beginning-of-line)
(if (re-search-forward org-block-regexp nil t)
(let ((start (- (match-beginning 4) 1)) ;; beginning of body
(end (match-end 0))
ov) ;; end of entire body
(end (match-end 0)) ;; end of entire body
ov)
(if (memq t (mapcar (lambda (overlay)
(eq (org-overlay-get overlay 'invisible)
'org-hide-block))
(org-overlays-at start)))
(if (or (not force) (eq force 'off))
(mapc (lambda (ov)
(when (member ov org-hide-block-overlays)
(setq org-hide-block-overlays
(delq ov org-hide-block-overlays)))
(when (eq (org-overlay-get ov 'invisible)
'org-hide-block)
(org-delete-overlay ov)))
(org-overlays-at start)))
(setq ov (org-make-overlay start end))
(if (or (not force) (eq force 'off))
(mapc (lambda (ov)
(when (member ov org-hide-block-overlays)
(setq org-hide-block-overlays
(delq ov org-hide-block-overlays)))
(when (eq (org-overlay-get ov 'invisible)
'org-hide-block)
(org-delete-overlay ov)))
(org-overlays-at start)))
(setq ov (org-make-overlay start end))
(org-overlay-put ov 'invisible 'org-hide-block)
(push ov org-hide-block-overlays)))
;; make the block accessible to isearch
(org-overlay-put
ov 'isearch-open-invisible
(lambda (ov)
(when (member ov org-hide-block-overlays)
(setq org-hide-block-overlays
(delq ov org-hide-block-overlays)))
(when (eq (org-overlay-get ov 'invisible)
'org-hide-block)
(org-delete-overlay ov))))
(push ov org-hide-block-overlays)))
(error "Not looking at a source block"))))
;; org-tab-after-check-for-cycling-hook