@@ -418,11 +418,9 @@ elab ist info pattern opts fn tm
418 ctxt <- get_context
418 ctxt <- get_context
419 let guarded = isConName f ctxt
419 let guarded = isConName f ctxt
420 ns <- apply (Var f) (map isph args)
420 ns <- apply (Var f) (map isph args)
421− -- Sort so that the implicit tactics go last
421+ -- Sort so that the implicit tactics and alternatives go last
422 let (ns', eargs) = unzip $
422 let (ns', eargs) = unzip $
423− sortBy (\(_,x) (_,y) ->
424− compare (priority x) (priority y))
425− (zip ns args)
423+ sortBy cmpArg (zip ns args)
426 elabArgs (ina || not isinf, guarded, inty)
424 elabArgs (ina || not isinf, guarded, inty)
427 [] fc False ns' (map (\x -> (lazyarg x, getTm x)) eargs)
425 [] fc False ns' (map (\x -> (lazyarg x, getTm x)) eargs)
@@ -442,6 +440,13 @@ elab ist info pattern opts fn tm
442 (ivs' \\ ivs)
440 (ivs' \\ ivs)
443 where tcArg (n, PConstraint _ _ Placeholder _) = True
441 where tcArg (n, PConstraint _ _ Placeholder _) = True
444 tcArg _ = False
442 tcArg _ = False
444+ -- normal < tactic < default tactic
445+ cmpArg (_, x) (_, y)
446+ = compare (priority x + alt x) (priority y + alt y)
447+ where alt t = case getTm t of
448+ PAlternative False _ -> 5
446 tacTm (PTactics _) = True
451 tacTm (PTactics _) = True
447 tacTm (PProof _) = True
452 tacTm (PProof _) = True