From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kaushal Modi Subject: Re: Fill column indicator and org indent mode Date: Mon, 14 Aug 2017 22:16:00 +0000 Message-ID: References: <87o9rhhkz1.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="94eb2c14669499ec160556be0275" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46615) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dhNef-0000Wp-4V for emacs-orgmode@gnu.org; Mon, 14 Aug 2017 18:16:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dhNed-0003OI-Qd for emacs-orgmode@gnu.org; Mon, 14 Aug 2017 18:16:13 -0400 Received: from mail-yw0-x229.google.com ([2607:f8b0:4002:c05::229]:35149) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dhNed-0003O3-KJ for emacs-orgmode@gnu.org; Mon, 14 Aug 2017 18:16:11 -0400 Received: by mail-yw0-x229.google.com with SMTP id l82so62856395ywc.2 for ; Mon, 14 Aug 2017 15:16:11 -0700 (PDT) In-Reply-To: <87o9rhhkz1.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Tim Cross , Galen Menzel Cc: Org Mode --94eb2c14669499ec160556be0275 Content-Type: text/plain; charset="UTF-8" On Mon, Aug 14, 2017 at 5:59 PM Tim Cross 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 --94eb2c14669499ec160556be0275 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Mon, Aug 14= , 2017 at 5:59 PM Tim Cross <t= heophilusx@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 exp= orts
of your org files.

I fixed that particular= problem using this:

=3D=3D=3D=3D=3D
=C2=A0 =C2=A0 ;; It is required to disable `fci-mode' when `htmlize-b= uffer' is called;
=C2=A0 =C2=A0 ;; otherwise the invisible fc= i characters show up as funky looking
=C2=A0 =C2=A0 ;; visible ch= aracters in the source code blocks in the html file.
=C2=A0 =C2=A0 (with-eval-after-load 'fill-column= -indicator
=C2=A0 =C2=A0 =C2=A0 (defvar modi/htmlize-initial-fci-= state nil
=C2=A0 =C2=A0 =C2=A0 =C2=A0 "Variable to store the= state of `fci-mode' when `htmlize-buffer' is called.")
<= div>
=C2=A0 =C2=A0 =C2=A0 (defun modi/htmlize-before-hook-fci= -disable ()
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (setq modi/htmlize-initia= l-fci-state fci-mode)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (when fci-mode<= /div>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (fci-mode -1)))

=
=C2=A0 =C2=A0 =C2=A0 (defun modi/htmlize-after-hook-fci-enable-m= aybe ()
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (when modi/htmlize-initial-fc= i-state
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (fci-mode 1)))

=C2=A0 =C2=A0 =C2=A0 (add-hook 'htmlize-before-hook #= 'modi/htmlize-before-hook-fci-disable)
=C2=A0 =C2=A0 =C2=A0 (= add-hook 'htmlize-after-hook #'modi/htmlize-after-hook-fci-enable-m= aybe))
=3D=3D=3D=3D=3D

When the co= de blocks are exported to HTML, htmlize is used to load the major mode to g= et the syntax highlighting. The side effect of that is that the FCI mode al= so 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 chara= cters. 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 tha= t FCI needs one to put such hacks in their config, and whitespace mode (shi= ps with Emacs) is much nicer. Though, there is no package that does the exa= ct same thing as FCI.
--

= Kaushal Modi

--94eb2c14669499ec160556be0275--