emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kaushal Modi <kaushal.modi@gmail.com>
To: Tim Cross <theophilusx@gmail.com>,
	Galen Menzel <galen.menzel@utexas.edu>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: Fill column indicator and org indent mode
Date: Mon, 14 Aug 2017 22:16:00 +0000	[thread overview]
Message-ID: <CAFyQvY1g5fyRn7vziY_x0EfZ0t8GJ1ziLvGZZSwcwEuUAp+7mA@mail.gmail.com> (raw)
In-Reply-To: <87o9rhhkz1.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1965 bytes --]

On Mon, Aug 14, 2017 at 5:59 PM Tim Cross <theophilusx@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

[-- Attachment #2: Type: text/html, Size: 2974 bytes --]

  reply	other threads:[~2017-08-14 22:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-14 17:58 Fill column indicator and org indent mode Galen Menzel
2017-08-14 21:57 ` Tim Cross
2017-08-14 22:16   ` Kaushal Modi [this message]
2017-08-16  3:04     ` Galen Menzel
2017-08-14 22:23 ` Eduardo Mercovich
2017-08-16  3:14   ` Galen Menzel
2017-08-16  4:24   ` Adam Porter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFyQvY1g5fyRn7vziY_x0EfZ0t8GJ1ziLvGZZSwcwEuUAp+7mA@mail.gmail.com \
    --to=kaushal.modi@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=galen.menzel@utexas.edu \
    --cc=theophilusx@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).