@@ -418,11 +418,9 @@ elab ist info pattern opts fn tm
418418 ctxt <- get_context
419419 let guarded = isConName f ctxt
420420 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
422422 let (ns', eargs) = unzip $
423− sortBy (\(_,x) (_,y) ->
424− compare (priority x) (priority y))
425− (zip ns args)
423+ sortBy cmpArg (zip ns args)
426424 elabArgs (ina || not isinf, guarded, inty)
427425 [] fc False ns' (map (\x -> (lazyarg x, getTm x)) eargs)
428426 solve
@@ -442,6 +440,13 @@ elab ist info pattern opts fn tm
442440 (ivs' \\ ivs)
443441 where tcArg (n, PConstraint _ _ Placeholder _) = True
444442 tcArg _ = False
443+
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
449+ _ -> 0
445450
446451 tacTm (PTactics _) = True
447452 tacTm (PProof _) = True