GNU bug report logs - #14784
Occur from more Isearch types

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> jurta.org>

Date: Wed, 3 Jul 2013 23:32:01 UTC

Severity: wishlist

Tags: patch

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 14784 in the body.
You can then email your comments to 14784 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#14784; Package emacs. (Wed, 03 Jul 2013 23:32:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> jurta.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 03 Jul 2013 23:32:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: bug-gnu-emacs <at> gnu.org
Subject: Occur from more Isearch types
Date: Thu, 04 Jul 2013 02:28:15 +0300
Severity: wishlist
Tags: patch

Like bug#14673 added `Buffer-menu-multi-occur' to invoke Occur
from multiple marked buffers, it would also make sense to invoke Occur
from other search types where the search space differs from the default
single-buffer search.  Then typing `M-s o' in the minibuffer's isearch
will show occurrences from all minibuffer history elements, and
when typed in the comint's history isearch, will show occurrences
from all shell history elements:

=== modified file 'lisp/simple.el'
--- lisp/simple.el	2013-06-27 00:50:50 +0000
+++ lisp/simple.el	2013-07-03 23:17:01 +0000
@@ -1938,6 +2032,22 @@
 Go to the history element by the absolute history position HIST-POS."
   (goto-history-element hist-pos))
 
+(defun minibuffer-occur (regexp &optional nlines)
+  "Show all entries in the minibuffer history containing a match for REGEXP.
+Like `occur', but acts on the contents of the minibuffer history
+in the currently active minibuffer."
+  (interactive (occur-read-primary-args))
+  (when (and (minibufferp) minibuffer-history-variable)
+    (let* ((history-variable minibuffer-history-variable)
+	   (history (symbol-value history-variable)))
+      (with-current-buffer
+	  (get-buffer-create (format " *Minibuffer history %s*"
+				     history-variable))
+	(erase-buffer)
+	(dolist (line history)
+	  (insert (query-replace-descr line) "\n"))
+	(occur-1 regexp nlines (list (current-buffer)))))))
+
 
 ;Put this on C-x u, so we can force that rather than C-_ into startup msg
 (define-obsolete-function-alias 'advertised-undo 'undo "23.2")

=== modified file 'lisp/comint.el'
--- lisp/comint.el	2013-06-21 09:37:04 +0000
+++ lisp/comint.el	2013-07-03 23:15:59 +0000
@@ -1570,6 +1570,20 @@
 Go to the history element by the absolute history position HIST-POS."
   (comint-goto-input hist-pos))
 
+(defun comint-history-occur (regexp &optional nlines)
+  "Show all entries in the input history containing a match for REGEXP.
+Like `occur', but acts on the contents of the input history
+in the currently active comint buffer."
+  (interactive (occur-read-primary-args))
+  (when comint-input-ring
+    (let ((input-ring comint-input-ring))
+      (with-current-buffer
+	  (get-buffer-create " *Comint history*")
+	(erase-buffer)
+	(dotimes (i (1- (ring-length input-ring)))
+	  (insert (query-replace-descr (ring-ref input-ring i)) "\n"))
+	(occur-1 regexp nlines (list (current-buffer)))))))
+
 
 (defun comint-within-quotes (beg end)
   "Return t if the number of quotes between BEG and END is odd.

=== modified file 'lisp/isearch.el'
--- lisp/isearch.el	2013-06-13 22:08:45 +0000
+++ lisp/isearch.el	2013-07-03 23:18:35 +0000
@@ -1785,7 +1888,12 @@ (defun isearch-occur (regexp &optional n
 		 isearch-regexp-lax-whitespace
 	       isearch-lax-whitespace)
 	     search-whitespace-regexp)))
-    (occur regexp nlines)))
+    (cond ((and (minibufferp) minibuffer-history-variable)
+	   (minibuffer-occur regexp nlines))
+	  ((and (boundp 'comint-input-ring) comint-input-ring)
+	   (comint-history-occur regexp nlines))
+	  (t
+	   (occur regexp nlines)))))
 
 (declare-function hi-lock-read-face-name "hi-lock" ())




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14784; Package emacs. (Wed, 26 Jun 2019 15:45:01 GMT) Full text and rfc822 format available.

Message #8 received at 14784 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> jurta.org>
Cc: 14784 <at> debbugs.gnu.org
Subject: Re: bug#14784: Occur from more Isearch types
Date: Wed, 26 Jun 2019 17:44:15 +0200
Juri Linkov <juri <at> jurta.org> writes:

> Like bug#14673 added `Buffer-menu-multi-occur' to invoke Occur
> from multiple marked buffers, it would also make sense to invoke Occur
> from other search types where the search space differs from the default
> single-buffer search.  Then typing `M-s o' in the minibuffer's isearch
> will show occurrences from all minibuffer history elements, and
> when typed in the comint's history isearch, will show occurrences
> from all shell history elements:

[...]

> +(defun minibuffer-occur (regexp &optional nlines)
> +  "Show all entries in the minibuffer history containing a match for REGEXP.
> +Like `occur', but acts on the contents of the minibuffer history
> +in the currently active minibuffer."
> +  (interactive (occur-read-primary-args))
> +  (when (and (minibufferp) minibuffer-history-variable)
> +    (let* ((history-variable minibuffer-history-variable)
> +	   (history (symbol-value history-variable)))
> +      (with-current-buffer
> +	  (get-buffer-create (format " *Minibuffer history %s*"
> +				     history-variable))
> +	(erase-buffer)
> +	(dolist (line history)
> +	  (insert (query-replace-descr line) "\n"))
> +	(occur-1 regexp nlines (list (current-buffer)))))))

That's an interesting feature...  But with normal `C-s i foo M-s o', we
can then jump to the result, while we can't really do that there, can
we?  So there's a bit of a disconnect between using an Occur buffer and
the minibuffer...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14784; Package emacs. (Thu, 13 Aug 2020 11:24:02 GMT) Full text and rfc822 format available.

Message #11 received at 14784 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> jurta.org>
Cc: 14784 <at> debbugs.gnu.org
Subject: Re: bug#14784: Occur from more Isearch types
Date: Thu, 13 Aug 2020 13:23:44 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> That's an interesting feature...  But with normal `C-s i foo M-s o', we
> can then jump to the result, while we can't really do that there, can
> we?  So there's a bit of a disconnect between using an Occur buffer and
> the minibuffer...

That was a year ago, and there was no response, so I'm guessing there
wasn't much interest in adding this feature, so I'm closing this bug
report.  Please reopen if this is incorrect.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug closed, send any further explanations to 14784 <at> debbugs.gnu.org and Juri Linkov <juri <at> jurta.org> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 13 Aug 2020 11:24:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 11 Sep 2020 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 226 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.