> I awm using the following regexp to match "(defun" lines > > ("defun" "^\\s-*(defun\\s-+\\([[:alnum:]-]+\\)") 1) > > I need regexp suggestions to improve upon it. FWIW, in `imenu+.el' I use these regexps for function and macro definitions: imenup-lisp-fn-defn-regexp-1: (concat "^\\s-*(" (regexp-opt '("defun" "cl-defun" "defun*" "defsubst" "cl-defsubst" "define-inline" "define-advice" "defadvice" "define-skeleton" "define-compilation-mode" "define-minor-mode" "define-global-minor-mode" "define-globalized-minor-mode" "define-derived-mode" "define-generic-mode" "defsetf" "define-setf-expander" "define-method-combination" "defgeneric" "cl-defgeneric" "defmethod" "cl-defmethod" "ert-deftest" "icicle-define-command" "icicle-define-file-command") t) "\\s-+\\(\\(\\sw\\|\\s_\\)+\\)") imenup-lisp-fn-defn-regexp-2 (defs with a quoted name): (concat "^\\s-*(" (regexp-opt '("defalias" "fset") t) "\\s-+'\\s-*\\(\\(\\sw\\|\\s_\\)+\\)") imenup-lisp-macro-defn-regexp: "(\\s-*\\(defmacro\\|cl-defmacro\\|cl-define-compiler-macro\\|\ define-compiler-macro\\|define-modify-macro\\)\\s-+\\([^ \t()]+\\)" You don't need all of those (e.g., Icicles defs and old defadvice defs for older Emacs releases). But you might want to include some other ways to define functions and macros. HTH.