On Mon, Aug 14, 2017 at 5:59 PM Tim Cross <theophil...@gmail.com> wrote:

>
> I was using fci, but found all sorts of problems when it comes to
> org-mode. In addition to the issue you mention, you will also find

'spurious' additional characters turning up in things like html exports
> of your org files.


I fixed that particular problem using this:

=====
    ;; It is required to disable `fci-mode' when `htmlize-buffer' is called;
    ;; otherwise the invisible fci characters show up as funky looking
    ;; visible characters in the source code blocks in the html file.
    ;; http://lists.gnu.org/archive/html/emacs-orgmode/2014-09/msg00777.html
    (with-eval-after-load 'fill-column-indicator
      (defvar modi/htmlize-initial-fci-state nil
        "Variable to store the state of `fci-mode' when `htmlize-buffer' is
called.")

      (defun modi/htmlize-before-hook-fci-disable ()
        (setq modi/htmlize-initial-fci-state fci-mode)
        (when fci-mode
          (fci-mode -1)))

      (defun modi/htmlize-after-hook-fci-enable-maybe ()
        (when modi/htmlize-initial-fci-state
          (fci-mode 1)))

      (add-hook 'htmlize-before-hook #'modi/htmlize-before-hook-fci-disable)
      (add-hook 'htmlize-after-hook
#'modi/htmlize-after-hook-fci-enable-maybe))
=====

When the code blocks are exported to HTML, htmlize is used to load the
major mode to get the syntax highlighting. The side effect of that is that
the FCI mode also gets enabled as they would have been added to the major
mode's hook var. Now, FCI shows that column indicator using a special
sequence of characters. The spurious additional characters are those.

Above snippet basically prevents the fci mode from getting enabled when
htmlize is doing its thing.

In general I agree that FCI needs one to put such hacks in their config,
and whitespace mode (ships with Emacs) is much nicer. Though, there is no
package that does the exact same thing as FCI.
-- 

Kaushal Modi

Reply via email to