summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2011-10-26 19:53:06 +0200
committerBastien Guerry <bzg@altern.org>2011-10-28 17:36:14 +0200
commitcfed6e9366c93742072e8e328cf878aac54e08f6 (patch)
tree6b20240ee5693d0dbeb23244b11577b87b4cb94b
parent728611fa77ea6af2328926d0614b2fbb010b07df (diff)
downloadorg-mode-cfed6e9366c93742072e8e328cf878aac54e08f6.tar.gz
Add a way to search for a link search without impacting buffer visibility
* lisp/org.el (org-link-search): Add an optional argument preventing function from revealing context around match.
-rw-r--r--lisp/org.el13
1 files changed, 10 insertions, 3 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 7f967ce..fe45cf7 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -9758,13 +9758,18 @@ the window configuration before `org-open-at-point' was called using:
(set-window-configuration org-window-config-before-follow-link)")
(defvar org-link-search-inhibit-query nil) ;; dynamically scoped
-(defun org-link-search (s &optional type avoid-pos)
+(defun org-link-search (s &optional type avoid-pos stealth)
"Search for a link search option.
If S is surrounded by forward slashes, it is interpreted as a
regular expression. In org-mode files, this will create an `org-occur'
sparse tree. In ordinary files, `occur' will be used to list matches.
If the current buffer is in `dired-mode', grep will be used to search
-in all files. If AVOID-POS is given, ignore matches near that position."
+in all files. If AVOID-POS is given, ignore matches near that position.
+
+When optional argument STEALTH is non-nil, do not modify
+visibility around point, thus ignoring
+`org-show-hierarchy-above', `org-show-following-heading' and
+`org-show-siblings' variables."
(let ((case-fold-search t)
(s0 (mapconcat 'identity (org-split-string s "[ \t\r\n]+") " "))
(markers (concat "\\(?:" (mapconcat (lambda (x) (regexp-quote (car x)))
@@ -9888,7 +9893,9 @@ in all files. If AVOID-POS is given, ignore matches near that position."
(goto-char (match-beginning 1))
(goto-char pos)
(error "No match"))))))
- (and (eq major-mode 'org-mode) (org-show-context 'link-search))
+ (and (eq major-mode 'org-mode)
+ (not stealth)
+ (org-show-context 'link-search))
type))
(defun org-search-not-self (group &rest args)