Subject: Re: bug#10916: Using occur to list occurrencies of the symbol at point

From: [email-masked] (Niels Möller)
Date: Thu, 01 Mar 2012 13:18:09 +0100

Juri Linkov <[email-masked]> writes:

> `C-u M-x occur' doesn't interpret the prefix argument as the amount of
> additional context.  `C-u M-x occur' collects strings matching regexp.

I'm not following you. If I type C-u M-x occur RET gcd_hook RET, I get
an *Occur* buffer looking like this:

3 matches for "gcd_hook" in buffer: gcd.c
       :  mp_size_t gn;
       :};
       :
       :static void
     61:gcd_hook (void *p, mp_srcptr gp, mp_size_t gn,
       :	  mp_srcptr qp, mp_size_t qn, int d)
       :{
       :  struct gcd_ctx *ctx = (struct gcd_ctx *) p;
       :  MPN_COPY (ctx->gp, gp, gn);
-------
       :	}
       :      else
       :	{
       :	  /* Temporary storage n */
    209:	  n = mpn_gcd_subdiv_step (up, vp, n, gcd_hook, &ctx, tp);
       :	  if (n == 0)
       :	    goto done;
       :	}
       :    }
-------
       :	     small, or the difference is very small. Perform one
       :	     subtraction followed by one division. */
       :
       :	  /* Temporary storage n */
    253:	  n = mpn_gcd_subdiv_step (up, vp, n, &gcd_hook, &ctx, tp);
       :	  if (n == 0)
       :	    goto done;
       :	}
       :    }
-------

This is with emacs-23.2, but I think it's the same in other emacs
versions I have used. The documentation string for occur says

  Each line is displayed with NLINES lines before and after, or -NLINES
  before if NLINES is negative.
  NLINES defaults to `list-matching-lines-default-context-lines'.
  Interactively it is the prefix arg.

> Have you tried `M-x occur M-n RET'?

Now I have. Seems to give the symbol at point in recent emacs versions.
Slightly less convenient than a prefix argument, but I think that does
what I want.

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.