Mercurial > emacs
changeset 57718:e60d53125cf2
(sgml-mode): Fix imenu-generic-expression and add "Id" and "Name" submenus to it.
author | Daniel Pfeiffer <occitan@esperanto.org> |
---|---|
date | Tue, 26 Oct 2004 21:38:57 +0000 |
parents | d198f03d3ba5 |
children | 018ef6100fc5 |
files | lisp/textmodes/sgml-mode.el |
diffstat | 1 files changed, 16 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/textmodes/sgml-mode.el Tue Oct 26 21:38:09 2004 +0000 +++ b/lisp/textmodes/sgml-mode.el Tue Oct 26 21:38:57 2004 +0000 @@ -453,10 +453,22 @@ ;; recognized. (set (make-local-variable 'comment-start-skip) "\\(?:<!\\)?--[ \t]*") (set (make-local-variable 'comment-end-skip) "[ \t]*--\\([ \t\n]*>\\)?") - ;; This definition probably is not useful in derived modes. - (set (make-local-variable 'imenu-generic-expression) - (concat "<!\\(element\\|entity\\)[ \t\n]+%?[ \t\n]*\\(" - sgml-name-re "\\)"))) + ;; This definition has an HTML leaning but probably fits well for other modes. + (setq imenu-generic-expression + `((nil + ,(concat "<!\\(element\\|entity\\)[ \t\n]+%?[ \t\n]*\\(" + sgml-name-re "\\)") + 2) + ("Id" + ,(concat "<[^>]+[ \t\n]+[Ii][Dd]=\\(['\"]" + (if sgml-xml-mode "" "?") + "\\)\\(" sgml-name-re "\\)\\1") + 2) + ("Name" + ,(concat "<[^>]+[ \t\n]+[Nn][Aa][Mm][Ee]=\\(['\"]" + (if sgml-xml-mode "" "?") + "\\)\\(" sgml-name-re "\\)\\1") + 2)))) ;; Some programs (such as Glade 2) generate XML which has ;; -*- mode: xml -*-.