unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#18209: Add ability to truncate long grep matches
@ 2014-08-06 11:52 Reuben Thomas
  2014-08-06 17:44 ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Reuben Thomas @ 2014-08-06 11:52 UTC (permalink / raw)
  To: 18209

[-- Attachment #1: Type: text/plain, Size: 1018 bytes --]

In some files (e.g. in text files using newline as a paragraph delimiter)
one can get matches in very long lines that can occupy several screenfuls.
These are not always straightforward to avoid. There's no way to tell (GNU)
grep to truncate its output; perhaps Emacs could help here, by being able
to specify a maximum length of match to show? For bonus points, show part
of the line that matches, with ellipses, rather than just truncating the
line; but even without that it would be useful, provided that the
truncation is clearly marked: the annoyance and slowness of navigating
*grep* buffers full of enormous matches which are almost always not what
one is looking for would be great!

(I just managed to work around one source, minified Javascript mixed in
with non-minified files, by omitting *.min.js in the list of files grep
should ignore, but this is not always easy either: sometimes one might only
have the minified form to hand, and might want to grep it e.g. while
debugging.)

-- 
http://rrt.sc3d.org

[-- Attachment #2: Type: text/html, Size: 1155 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#18209: Add ability to truncate long grep matches
  2014-08-06 11:52 bug#18209: Add ability to truncate long grep matches Reuben Thomas
@ 2014-08-06 17:44 ` Stefan Monnier
  2014-08-06 17:47   ` Reuben Thomas
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2014-08-06 17:44 UTC (permalink / raw)
  To: Reuben Thomas; +Cc: 18209

>>>>> "Reuben" == Reuben Thomas <rrt@sc3d.org> writes:

> In some files (e.g. in text files using newline as a paragraph delimiter)
> one can get matches in very long lines that can occupy several screenfuls.
> These are not always straightforward to avoid. There's no way to tell (GNU)
> grep to truncate its output; perhaps Emacs could help here, by being able
> to specify a maximum length of match to show? For bonus points, show part
> of the line that matches, with ellipses, rather than just truncating the
> line; but even without that it would be useful, provided that the
> truncation is clearly marked: the annoyance and slowness of navigating
> *grep* buffers full of enormous matches which are almost always not what
> one is looking for would be great!

FWIW, I have the following in my ~/.emacs:

   (defun sm-compilation-mode-hook ()
     (setq truncate-lines t))
   (add-hook 'compilation-mode-hook #'sm-compilation-mode-hook)


-- Stefan





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#18209: Add ability to truncate long grep matches
  2014-08-06 17:44 ` Stefan Monnier
@ 2014-08-06 17:47   ` Reuben Thomas
  2020-08-12 18:39     ` Stefan Kangas
  0 siblings, 1 reply; 6+ messages in thread
From: Reuben Thomas @ 2014-08-06 17:47 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 18209

[-- Attachment #1: Type: text/plain, Size: 1136 bytes --]

On 6 August 2014 18:44, Stefan Monnier <monnier@iro.umontreal.ca> wrote:

> >>>>> "Reuben" == Reuben Thomas <rrt@sc3d.org> writes:
>
> > In some files (e.g. in text files using newline as a paragraph delimiter)
> > one can get matches in very long lines that can occupy several
> screenfuls.
> > These are not always straightforward to avoid. There's no way to tell
> (GNU)
> > grep to truncate its output; perhaps Emacs could help here, by being able
> > to specify a maximum length of match to show? For bonus points, show part
> > of the line that matches, with ellipses, rather than just truncating the
> > line; but even without that it would be useful, provided that the
> > truncation is clearly marked: the annoyance and slowness of navigating
> > *grep* buffers full of enormous matches which are almost always not what
> > one is looking for would be great!
>
> FWIW, I have the following in my ~/.emacs:
>
>    (defun sm-compilation-mode-hook ()
>      (setq truncate-lines t))
>    (add-hook 'compilation-mode-hook #'sm-compilation-mode-hook)
>

That's ingenious, obvious, and thanks very muchious.

-- 
http://rrt.sc3d.org

[-- Attachment #2: Type: text/html, Size: 1670 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#18209: Add ability to truncate long grep matches
  2014-08-06 17:47   ` Reuben Thomas
@ 2020-08-12 18:39     ` Stefan Kangas
  2020-08-12 18:43       ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Kangas @ 2020-08-12 18:39 UTC (permalink / raw)
  To: Reuben Thomas; +Cc: Stefan Monnier, 18209

Reuben Thomas <rrt@sc3d.org> writes:

> On 6 August 2014 18:44, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>
>  >>>>> "Reuben" == Reuben Thomas <rrt@sc3d.org> writes:
>
>  > In some files (e.g. in text files using newline as a paragraph delimiter)
>  > one can get matches in very long lines that can occupy several screenfuls.
>  > These are not always straightforward to avoid. There's no way to tell (GNU)
>  > grep to truncate its output; perhaps Emacs could help here, by being able
>  > to specify a maximum length of match to show? For bonus points, show part
>  > of the line that matches, with ellipses, rather than just truncating the
>  > line; but even without that it would be useful, provided that the
>  > truncation is clearly marked: the annoyance and slowness of navigating
>  > *grep* buffers full of enormous matches which are almost always not what
>  > one is looking for would be great!
>
>  FWIW, I have the following in my ~/.emacs:
>
>     (defun sm-compilation-mode-hook ()
>       (setq truncate-lines t))
>     (add-hook 'compilation-mode-hook #'sm-compilation-mode-hook)
>
> That's ingenious, obvious, and thanks very muchious.

Did that resolve the problem, or is there anything more to do here?

Best regards,
Stefan Kangas





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#18209: Add ability to truncate long grep matches
  2020-08-12 18:39     ` Stefan Kangas
@ 2020-08-12 18:43       ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2020-08-12 18:50         ` Stefan Kangas
  0 siblings, 1 reply; 6+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2020-08-12 18:43 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: Stefan Monnier, 18209

[-- Attachment #1: Type: text/plain, Size: 1451 bytes --]

That worked, thanks!

-- 
https://rrt.sc3d.org

On Wed, 12 Aug 2020, 19:39 Stefan Kangas, <stefan@marxist.se> wrote:

> Reuben Thomas <rrt@sc3d.org> writes:
>
> > On 6 August 2014 18:44, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> >
> >  >>>>> "Reuben" == Reuben Thomas <rrt@sc3d.org> writes:
> >
> >  > In some files (e.g. in text files using newline as a paragraph
> delimiter)
> >  > one can get matches in very long lines that can occupy several
> screenfuls.
> >  > These are not always straightforward to avoid. There's no way to tell
> (GNU)
> >  > grep to truncate its output; perhaps Emacs could help here, by being
> able
> >  > to specify a maximum length of match to show? For bonus points, show
> part
> >  > of the line that matches, with ellipses, rather than just truncating
> the
> >  > line; but even without that it would be useful, provided that the
> >  > truncation is clearly marked: the annoyance and slowness of navigating
> >  > *grep* buffers full of enormous matches which are almost always not
> what
> >  > one is looking for would be great!
> >
> >  FWIW, I have the following in my ~/.emacs:
> >
> >     (defun sm-compilation-mode-hook ()
> >       (setq truncate-lines t))
> >     (add-hook 'compilation-mode-hook #'sm-compilation-mode-hook)
> >
> > That's ingenious, obvious, and thanks very muchious.
>
> Did that resolve the problem, or is there anything more to do here?
>
> Best regards,
> Stefan Kangas
>

[-- Attachment #2: Type: text/html, Size: 2262 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#18209: Add ability to truncate long grep matches
  2020-08-12 18:43       ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2020-08-12 18:50         ` Stefan Kangas
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Kangas @ 2020-08-12 18:50 UTC (permalink / raw)
  To: Reuben Thomas; +Cc: Stefan Monnier, 18209-done

Reuben Thomas <rrt@sc3d.org> writes:

> That worked, thanks!

Thanks! Closing.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-08-12 18:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-06 11:52 bug#18209: Add ability to truncate long grep matches Reuben Thomas
2014-08-06 17:44 ` Stefan Monnier
2014-08-06 17:47   ` Reuben Thomas
2020-08-12 18:39     ` Stefan Kangas
2020-08-12 18:43       ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-08-12 18:50         ` Stefan Kangas

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).