diff options
author | Daniel Pfeiffer <occitan@esperanto.org> | 2004-10-26 21:38:57 +0000 |
---|---|---|
committer | Daniel Pfeiffer <occitan@esperanto.org> | 2004-10-26 21:38:57 +0000 |
commit | 4456f9649b1b92d39f50b1512900c6c57171785e (patch) | |
tree | fdfdd6f1beef580660d0cc2dcc2131a3e2e4ce23 /lisp/textmodes/sgml-mode.el | |
parent | 8522009efb9ced6c8f0075a86569841630b18f50 (diff) | |
download | emacs-4456f9649b1b92d39f50b1512900c6c57171785e.tar.gz |
(sgml-mode): Fix imenu-generic-expression and add "Id" and "Name" submenus to it.
Diffstat (limited to 'lisp/textmodes/sgml-mode.el')
-rw-r--r-- | lisp/textmodes/sgml-mode.el | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index 6e7b2a9a51c..4ac96b2e4b0 100644 --- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el @@ -453,10 +453,22 @@ Do \\[describe-key] on the following bindings to discover what they do. ;; 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 -*-. |