Store the parameters of the last org-occur calls.

Lennart Borgman asked for this, to have more information about
item visibility when exporting to freemind.
This commit is contained in:
Carsten Dominik 2008-03-04 20:25:59 +01:00
parent 098f76aff3
commit ee8e5a3e0f
2 changed files with 19 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2008-03-04 Carsten Dominik <dominik@science.uva.nl>
* org.el (org-occur-parameters): New variable.
(org-remove-occur-highlights): Clear `org-occur-parameters'.
2008-03-04 Bastien Guerry <bzg@altern.org> 2008-03-04 Bastien Guerry <bzg@altern.org>
* org-publish.el (org-publish-get-files): Bugfix. * org-publish.el (org-publish-get-files): Bugfix.

15
org.el
View File

@ -15249,8 +15249,19 @@ d Show deadlines due within `org-deadline-warning-days'."
(call-interactively 'org-occur)) (call-interactively 'org-occur))
(t (error "No such sparse tree command \"%c\"" ans))))) (t (error "No such sparse tree command \"%c\"" ans)))))
(defvar org-occur-highlights nil) (defvar org-occur-highlights nil
"List of overlays used for occur matches.")
(make-variable-buffer-local 'org-occur-highlights) (make-variable-buffer-local 'org-occur-highlights)
(defvar org-occur-parameters nil
"Parameters of the active org-occur calls.
This is a list, each call to org-occur pushes as cons cell,
containing the regular expression and the callback, onto the list.
The list can contain several entries if `org-occur' has been called
several time with the KEEP-PREVIOUS argument. Otherwise, this list
will only contain one set of parameters. When the highlights are
removed (for example with `C-c C-c', or with the next edit (depending
on `org-remove-highlights-with-change'), this variable is emptied
as well.")
(defun org-occur (regexp &optional keep-previous callback) (defun org-occur (regexp &optional keep-previous callback)
"Make a compact tree which shows all matches of REGEXP. "Make a compact tree which shows all matches of REGEXP.
@ -15265,6 +15276,7 @@ that the match should indeed be shown."
(interactive "sRegexp: \nP") (interactive "sRegexp: \nP")
(unless keep-previous (unless keep-previous
(org-remove-occur-highlights nil nil t)) (org-remove-occur-highlights nil nil t))
(push (cons regexp callback) org-occur-parameters)
(let ((cnt 0)) (let ((cnt 0))
(save-excursion (save-excursion
(goto-char (point-min)) (goto-char (point-min))
@ -15350,6 +15362,7 @@ from the `before-change-functions' in the current buffer."
(unless org-inhibit-highlight-removal (unless org-inhibit-highlight-removal
(mapc 'org-delete-overlay org-occur-highlights) (mapc 'org-delete-overlay org-occur-highlights)
(setq org-occur-highlights nil) (setq org-occur-highlights nil)
(setq org-occur-parameters nil)
(unless noremove (unless noremove
(remove-hook 'before-change-functions (remove-hook 'before-change-functions
'org-remove-occur-highlights 'local)))) 'org-remove-occur-highlights 'local))))