method mode_from_display s =
      match mode with
        None -> s
      | Some m -> m#from_display s