chiark / gitweb /
el/dot-emacs.el: Advice to fix `markdown-mode' to preserve match data.
authorMark Wooding <mdw@distorted.org.uk>
Mon, 28 Dec 2015 15:28:44 +0000 (15:28 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Mon, 28 Dec 2015 15:28:44 +0000 (15:28 +0000)
commita1e4004ca8710d6868f137f019f1625e1b00c15c
tree02616b29db6521f790cd0c197c303b43308cc297
parent2c3abc4cee5656cfae25f02d70dc99e2a224db08
el/dot-emacs.el: Advice to fix `markdown-mode' to preserve match data.

`markdown-mode' adds a hook to `after-change-functions', which checks
for completed wiki links and tries to highlight them.  This clobbers the
match data, and, although it tries to save the position of the point, it
seems that `replace-match' arranges to leave point at the end of the
match by looking at the match data after the hook functions have run.

The result is that point ends up in the wrong place after `replace-
match'.  During `query-replace' and friends, the effect is that only the
first change in any given line is actually replaced, regardless of how
many matches there might be.

Giving the broken function a few choice words of advice fixes
everything.
el/dot-emacs.el