diff options
author | Konstantin Nazarov <knazarov@parallels.com> | 2015-01-11 02:03:52 +0300 |
---|---|---|
committer | Konstantin Nazarov <knazarov@parallels.com> | 2015-01-11 02:33:10 +0300 |
commit | c98af897f728663f4144cb0df8e0f8f7991fd175 (patch) | |
tree | 4b36fee7a0c367b1184770146274aea8ff8ed59d /lisp/ledger-fontify.el | |
parent | d4b20926c85a4989a845da21c2c36bbd1e183451 (diff) | |
download | fork-ledger-c98af897f728663f4144cb0df8e0f8f7991fd175.tar.gz fork-ledger-c98af897f728663f4144cb0df8e0f8f7991fd175.tar.bz2 fork-ledger-c98af897f728663f4144cb0df8e0f8f7991fd175.zip |
[emacs] Fontification should work independentily on where the point currently is
This is a subtle bug that happens only when org-src-fontify-natively is
enabled:
(setq org-src-fontify-natively t)
If then you create a Babel block with ledger text, it won't be
fontified.
This happens because the 'ledger-fontify-buffer-part' starts
fontification from the current 'point', which in case of
org-src-font-lock-fontify-block happens to _not_ point to the beginning
of buffer. Instead it points to the original org-mode buffer.
This doesn't happen when one opens regular files, because the
'point' is almost always at the beginning of the file.
To reproduce the bug, you can do the following:
(defun fontify-test()
(let ((lang-mode 'ledger-mode) pos next)
(with-current-buffer
(get-buffer-create
"ledger-fontification-bug")
(unless (eq major-mode lang-mode) (funcall lang-mode))
(erase-buffer)
(insert "2015/01/09 asdf\n foo\n bar\n" " ")
(font-lock-fontify-buffer)
(switch-to-buffer "ledger-fontification-bug")
)))
Call 'fontify-test' and see that the buffer is not fontified.
[ci skip]
Diffstat (limited to 'lisp/ledger-fontify.el')
-rw-r--r-- | lisp/ledger-fontify.el | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lisp/ledger-fontify.el b/lisp/ledger-fontify.el index d307208f..8dbe1bd5 100644 --- a/lisp/ledger-fontify.el +++ b/lisp/ledger-fontify.el @@ -42,6 +42,7 @@ (save-excursion (unless beg (setq beg (point-min))) (unless end (setq end (point-max))) + (goto-char beg) (beginning-of-line) (while (< (point) end) (cond ((or (looking-at ledger-xact-start-regex) |