$ifdef NOT
procedure fool_emacs()
    $endif


    if (\( p . sel_type) ) then {
    p . id_last_definition := nil
    p . id_def_found = TRUE
    sigids( p . sel_type)
} else if (insig) then {
    if (\ (p . signature) & (p . sig_done ~= SIG_DONE)) then {
	# user specifed signature 
	errmsg0(p,
		"Warning - signatures in signatures are ignored")
	yynerrs -:= 1
    }
    if ( \curr_sig_transp) &
	( \ (p . id_last_definition)) then {
	    def := p . id_last_definition
	    imid := curr_sig_transp . decl_innermost_id

	    # Update innermost id of curr_sig_transp 
	    if (def . kind = DECLARATION)  then {
		# Check that it's not a forward reference 
		if (def . post_num >= p . post_num) then {
		    errmsg1(p, "Forward reference to %s in === declaration",
			    getname(p . id_str_table_index))
		}
		if (def . decl_sig_transp) then {
		    id_def := def . decl_innermost_id
		} else {
		    id_def := def
		}
	    }
	}
    if (\id_def  &
	(/imid |
	 is_descendant(id_def, imid . decl_scope))) then {
	     curr_sig_transp . decl_innermost_id := id_def
	 }
}

    # MAY NEED TO BE SMARTER EVENTUALLY 
    if (/ (p . id_last_definition) &
	p . id_str_table_index ~= -1) then {
    # This hopefully excludes defining instances 
    usl := p . id_use_list
    while (\usl) do {
	fixed_it := FALSE
	temp := usl.usl_type_list.lh_first
	while \temp  & fixed_it = FALSE do {
	    s := temp.cn_hd_field
	    if ((s . kind ~= LETTERID & s . kind != OPRID) |
		\ (s . signature) |
		\ ( s . sel_type)) then {
		    p . sel_type :=  s
		    fixed_it := true
		    break
		} else {
		    def = s . id_last_definition
		    if (/def) |
			(def . kind ~= DECLARATION &
			 def . kind ~= PARAMETER) |
			(def . kind = DECLARATION &
			 / (def .decl_signature)) then {
			     p . sel_type := s
			     fixed_it := TRUE
			     break
			 }
		    if def.kind = PARAMETER then 
			sig := def. par_signature
		    else
			sig := def. decl_signature
		    if (sig . kind = TYPESIGNATURE &
			hascomp(sig, p . id_str_table_index)) then {
			    p . sel_type := s
			    fixed_it := TRUE
			    break
			}
		}
	 
   temp := temp.cn_tl_field
	}	if fixed_it = FALSE then
	    usl = usl . usl_previous_list
    }
    if fixed_it = FALSE then {
	errmsg1(p,"%s undeclared",
		getname(p . id_str_table_index))
	# make sure the next pass doesn't run into it again 
	p . signature = ERR_SIG
	p . sig_done = SIG_DONE
	break
    }
    p . id_def_found := TRUE
    sigids(p . sel_type)
}
    check_sig(p . signature)
    sigids( p . signature )
    $ifdef NOT
end
$endif
