William Johnston married Mary Scott or Irving in Annan in 1895.
1891 census in Annan: Mary Irving, widow, 38; Jane, 13; Joseph, 11; Mary, 8; George, 6; Williamina, 3; Thomas, under 1 year; William Dalrymple, 2nd cousin.
1881: Thomas Irving, 38, quarryman; Mary, wife, 27; Thomas, 7; John Ann R, 5; Jane, 3; Joseph, 1.
This looks like the family of Thomas Irving and Mary Scott, who were married in Annan in 1875. See screenshot. No sign of a William there.
There's a birth of William Scott, illegitimate son of Janet Scott, in Annan in 1874.
In 1861 there's a family consisting of John Scott, 34; wife Mary, 40; Jemima A, 10; Janet, 8; Mary, 6; William, 3; John A R, 1.
These look like the family of John Scott and Mary Dalrymple, married 17 December 1847 in Annan.
Could this be Mary with her parents and siblings? And could Mary have (informally) adopted her sister's illegitimate child? If so, where was he in 1881?