When an indictment is found in any county, against a person for a felony or misdemeanor, the accused, if in custody, or if he appear in discharge of his recognizance, or voluntarily, shall, unless good cause be shown for a continuance, be tried at the same term. If any witness for the accused be a nonresident of the state, or absent therefrom in any service or employment, so that service of a subpoena cannot be had upon him in this state, or is aged or infirm so that he cannot attend upon the court at the trial, the accused may present to the court in which the case is pending, or to the judge thereof in vacation, an affidavit showing such facts, and stating therein what he expects to prove by any such witness, his name, residence, or place of service or employment; and if such court or judge be of the opinion that the evidence of any such witness, as stated in such affidavit, is necessary and material to the defense of the accused on his trial, an order may be made by such court or judge for the taking of the deposition of any such witness upon such notice to the prosecuting attorney, of the time and place of taking the same, as the court or judge may prescribe; and in such order the court or judge may authorize the employment of counsel, practicing at or near the place where the deposition is to be taken, to cross-examine the witness on behalf of the state, the reasonable expense whereof shall be paid out of the treasury of the state, upon certificate of the court wherein the case is pending. Every deposition so taken may, on the motion of the defendant, so far as the evidence therein contained is competent and proper, be read to the jury on the trial of the case as evidence therein. A court of record may appoint counsel to assist an accused in criminal cases at any time upon request. A copy of the indictment and of the list of the jurors selected or summoned for his trial, as provided in section three of this article, shall be furnished him upon his request, at any time before the jury is impaneled. In every case where the court appoints counsel for the accused and the accused presents an affidavit showing that he cannot pay therefor, the attorney so appointed shall be paid for his services and expenses in accordance with the provisions of article twenty-one, chapter twenty-nine of this code.