From 972ec6c4a7413a034c1eac62003f18dbabce754a Mon Sep 17 00:00:00 2001 From: Sylvain Chouleur Date: Wed, 8 Jul 2015 19:54:34 +0200 Subject: [PATCH] Display single result in same window In case of single result for a search, the entry is automatically displayed without displaying the result buffer. The previous behavior was to display the entry in an other window. This can be annoying when working with only two windows, for example one for code, one for documentation, we would like to keep always the same one for code. This patch changes this behavior to use the window from where we issued the research to display the single result. Signed-off-by: Sylvain Chouleur --- rscope.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rscope.el b/rscope.el index ae93380..515409e 100644 --- a/rscope.el +++ b/rscope.el @@ -626,7 +626,7 @@ The first hook returning non nil wins." (setq file-name (nth 0 l)) (setq line-number (nth 1 l)) (if (and file-name line-number) - (rscope-select-entry-other-window) + (rscope-select-entry-current-window) (error "No cscope unique entry found, that's abnormal"))))) (defun rscope-handle-query (query) @@ -643,7 +643,7 @@ The first hook returning non nil wins." result-buf 'rscope-results-organize-filename) (when (>= nb-results 1) (ring-insert rscope-marker-ring (point-marker))) - (rscope-finish-result-buffer result-buf) + (rscope-finish-result-buffer result-buf (= 1 nb-results)) (when (= 1 nb-results) (rscope-select-unique-result)))))) (defun rscope-handle-query-call-hierarchy (function-name levels) @@ -904,12 +904,12 @@ call organizer to handle them within resultbuf." (insert rscope-separator-line "\n")) result-buf)) -(defun rscope-finish-result-buffer (result-buf) +(defun rscope-finish-result-buffer (result-buf &optional nodisplay) (with-current-buffer result-buf (goto-char (point-max)) (insert rscope-separator-line "\n") (insert "Search complete.") - (pop-to-buffer result-buf) + (unless nodisplay (pop-to-buffer result-buf)) (goto-char (point-min)) (rscope-get-relative-entry (current-buffer) +1) (rscope-list-entry-mode)))