From ee8e5a3e0f46d5394132e4050da42a13c3c8459c Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Tue, 4 Mar 2008 20:25:59 +0100 Subject: [PATCH] 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. --- ChangeLog | 5 +++++ org.el | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8de10a2e0..6503ce35b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-03-04 Carsten Dominik + + * org.el (org-occur-parameters): New variable. + (org-remove-occur-highlights): Clear `org-occur-parameters'. + 2008-03-04 Bastien Guerry * org-publish.el (org-publish-get-files): Bugfix. diff --git a/org.el b/org.el index 721039067..e07661cfa 100644 --- a/org.el +++ b/org.el @@ -15249,8 +15249,19 @@ d Show deadlines due within `org-deadline-warning-days'." (call-interactively 'org-occur)) (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) +(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) "Make a compact tree which shows all matches of REGEXP. @@ -15265,6 +15276,7 @@ that the match should indeed be shown." (interactive "sRegexp: \nP") (unless keep-previous (org-remove-occur-highlights nil nil t)) + (push (cons regexp callback) org-occur-parameters) (let ((cnt 0)) (save-excursion (goto-char (point-min)) @@ -15350,6 +15362,7 @@ from the `before-change-functions' in the current buffer." (unless org-inhibit-highlight-removal (mapc 'org-delete-overlay org-occur-highlights) (setq org-occur-highlights nil) + (setq org-occur-parameters nil) (unless noremove (remove-hook 'before-change-functions 'org-remove-occur-highlights 'local))))