emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Imenu should avoid positions in comments/strings


From: Dave Love
Subject: Imenu should avoid positions in comments/strings
Date: Mon, 26 Jul 2004 14:07:06 +0100
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.2 (gnu/linux)

Currently the default Imenu indexing may find items in multi-line
strings and comments, e.g.

/*
foo () {return;}
*/

I think `imenu--generic-function' should use `syntax-ppss' to check
the position before adding to the index.  Probably also
`imenu-default-create-index-function' should check the position found
by `imenu-prev-index-position-function'.  (Don't forget
`save-match-data' around `syntax-ppss'.)

By the way, the doc for various variables in Imenu now has redundant
info about the variable being buffer-local.  Probably Imenu isn't the
only case.  E.g.


  imenu--index-alist's value is nil
  Automatically becomes buffer-local when set in any fashion.
  
  The buffer index computed for this buffer in Imenu.
  Simple elements in the alist look like (INDEX-NAME . INDEX-POSITION).
  Special elements look like (INDEX-NAME INDEX-POSITION FUNCTION ARGUMENTS...).
  A nested sub-alist element looks like (INDEX-NAME SUB-ALIST).
  
  This variable is local in all buffers, once set.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]