TITLE: "Almost" continuous = continuous?
QUESTION [7 upvotes]: Let $x_0\in[a,b]$ be fixed and let $f:[a,b]\to\mathbb R$ be a function with the following property: For every $\varepsilon>0$ there exists some $\delta>0$ and some set $U\subset[x_0-\delta,x_0+\delta]$, where $[x_0-\delta,x_0+\delta]\backslash U$ is of Lebesgue-measure zero, such that $|f(x)-f(x_0)|<\varepsilon$ for all $x\in U\cap[a,b]$.
Can we conclude that $f$ is continuous at $x_0$?
It is clear that $f$ cannot have a jump discontinuity at $x_0$. Is anything known about those functions? Any help or literature recommendation is highly appreciated. Thanks in advance!
EDIT: Thanks to @Mike Earnest for his comment: We cannot say that $f$ is continuous at $x_0$. For example, let $f:[0,1]\to\mathbb R$ be 1 for $x\in\{1,1/2,1/3,1/4,\ldots\}$ and 0 elsewhere. Then $f$ satisfies the property at $x_0=0$, but is clearly discontinuous there.
What about functions that satisfy the property at every $x_0\in[a,b]$? Can they be discontinuous at some point of $[a,b]$?

REPLY [3 votes]: Assuming that the property holds for each $x\in [a,b]$ as the "$x_0$", $f$ must be continuous.  Let $x_0\in[a,b]$ be fixed, and let $(x_n)=(x_1,x_2,\ldots)$ be a sequence in $[a,b]$ converging to $x_0$.  Let $\varepsilon>0$ be given, and for $n=0,1,\ldots$, let $\delta_n>0$ and $U_n\subseteq[x_n-\delta_n,x_n+\delta_n]$ be such that $[x_n-\delta_n,x_n+\delta_n]\setminus U_n$ has measure zero and $|f(x)-f(x_n)|<\varepsilon$ for all $x\in U_n\cap[a,b]$. Let $N\in\mathbb N$ be such that $n\geq N$ implies $|x_n-x_0|<\delta_0$.  Then for all $n\geq N$, $[x_0-\delta_0,x_0+\delta_0]\cap [x_n-\delta_n,x_n+\delta_n]\cap[a,b]$ contains a nontrivial interval, in which $U_0\cap U_n\cap [a,b]$ has full measure, hence is nonempty.  For $x$ in the latter intersection, $|f(x_0)-f(x_n)|\leq |f(x_0)-f(x)|+|f(x)-f(x_n)|<2\varepsilon$.  Thus $\lim\limits_{n\to\infty}f(x_n)=f(x_0)$.