From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kaushal Subject: Re: Bug: Export to html inserts strange unicode characters at line breaks because of fci-mode [8.2.7c (8.2.7c-64-g01f736-elpa @ /home/kmodi/.emacs.d/elpa/org-20140915/)] Date: Thu, 04 Jun 2015 20:10:43 +0000 Message-ID: References: <87ppeid7ix.fsf@nicolasgoaziou.fr> <87lhp4n9wa.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113a5e20de13650517b6c525 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43135) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0bTd-00024n-PZ for emacs-orgmode@gnu.org; Thu, 04 Jun 2015 16:10:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z0bTb-0004Rl-PU for emacs-orgmode@gnu.org; Thu, 04 Jun 2015 16:10:57 -0400 Received: from mail-yh0-x231.google.com ([2607:f8b0:4002:c01::231]:36038) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0bTb-0004RY-Gm for emacs-orgmode@gnu.org; Thu, 04 Jun 2015 16:10:55 -0400 Received: by yhan67 with SMTP id n67so13267603yha.3 for ; Thu, 04 Jun 2015 13:10:54 -0700 (PDT) In-Reply-To: <87lhp4n9wa.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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nicolas Goaziou , emacs-orgmode@gnu.org, bzg@altern.org --001a113a5e20de13650517b6c525 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi all, I was finally able to solve this problem without tweaking anything inside ox-html.el I noticed that htmlize has provided few hooks and I used those. Here is the code that I now have in my emacs init to disable fci (and flyspell too) while htmlize-region is doing its job: (defvar modi/htmlize-initial-fci-state nil "Variable to store the state of `fci-mode' when `htmlize-buffer' is called.") (defvar modi/htmlize-initial-flyspell-state nil "Variable to store the state of `flyspell-mode' when `htmlize-buffer' is called.") (defun modi/htmlize-before-hook-fn () (when (fboundp 'fci-mode) (setq modi/htmlize-initial-fci-state fci-mode) (when fci-mode (fci-mode -1))) (when (fboundp 'flyspell-mode) (setq modi/htmlize-initial-flyspell-state flyspell-mode) (when flyspell-mode (flyspell-mode -1)))) (add-hook 'htmlize-before-hook #'modi/htmlize-before-hook-fn) (defun modi/htmlize-after-hook-fn () (when (fboundp 'fci-mode) (when modi/htmlize-initial-fci-state (fci-mode 1))) (when (fboundp 'flyspell-mode) (when modi/htmlize-initial-flyspell-state (flyspell-mode 1)))) (add-hook 'htmlize-after-hook #'modi/htmlize-after-hook-fn) I would suggest that that fci-mode specific code be removed from the master= . On Sat, Sep 27, 2014 at 3:25 PM Aaron Ecay wrote: > Hi Nicolas and Kaushal, > > 2014ko irailak 26an, Nicolas Goaziou-ek idatzi zuen: > > > > Hello, > > > > Kaushal writes: > > > >> I have fci-mode installed and enabled for programming modes. > >> > >> When org exports to html, htmlize figures out the syntax highlighting = of > >> the code by calling =3D(funcall lang-mode)=3D. > >> > >> That activates =3Dfci-mode=3D. > >> > >> =3Dfci-mode=3D shows the fill column using a unicode character. The is= sue is > >> that org export to html exports that character as well. > >> > >> Those characters show up in html as below! > >> http://i.imgur.com/8WplTqw.png > >> > >> So the solution is to fix the =3Dorx-html-fontify-code=3D function. > > > > I don't think so. `fill-column-indicator' is not even in core Emacs. We > > shouldn't provide a workaround for every package out there. > > For better or for worse, Bastien already installed this fix on master as > commit 44aaaad8, in response to Kaushal=E2=80=99s earlier bug report on t= his > issue. See . > > The fix has not yet been merged to the release branch, so it won=E2=80=99= t yet > show up in the ELPA version of org which Kaushal seems to be using. > > -- > Aaron Ecay > --001a113a5e20de13650517b6c525 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi all,

I was finally able to solve this problem wi= thout tweaking anything inside ox-html.el

I noticed that= htmlize has provided few hooks and I used those.

= Here is the code that I now have in my emacs init to disable fci (and flysp= ell too) while htmlize-region is doing its job:

=C2=A0 =C2=A0 (defvar modi/htmlize-initial-fci-state nil
=C2= =A0 =C2=A0 =C2=A0 "Variable to store the state of `fci-mode' when = `htmlize-buffer' is called.")
=C2=A0 =C2=A0 (defvar modi= /htmlize-initial-flyspell-state nil
=C2=A0 =C2=A0 =C2=A0 "Va= riable to store the state of `flyspell-mode' when `htmlize-buffer' = is called.")

=C2=A0 =C2=A0 (defun modi/htmliz= e-before-hook-fn ()
=C2=A0 =C2=A0 =C2=A0 (when (fboundp 'fci-= mode)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (setq modi/htmlize-initial-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 (when (fboundp 'flyspell-mode)
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 (setq modi/htmlize-initial-flyspell-state flyspell-mode)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (when flyspell-mode
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 (flyspell-mode -1))))
=C2=A0 =C2=A0 (add-hoo= k 'htmlize-before-hook #'modi/htmlize-before-hook-fn)
=C2=A0 =C2=A0 (defun modi/htmlize-after-hook-fn ()
= =C2=A0 =C2=A0 =C2=A0 (when (fboundp 'fci-mode)
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 (when modi/htmlize-initial-fci-state
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 (fci-mode 1)))
=C2=A0 =C2=A0 =C2=A0 (when (f= boundp 'flyspell-mode)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (when modi= /htmlize-initial-flyspell-state
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 (flyspell-mode 1))))
=C2=A0 =C2=A0 (add-hook 'htmlize-aft= er-hook #'modi/htmlize-after-hook-fn)

I = would suggest that that fci-mode specific code be removed from the master.<= /div>


On Sat,= Sep 27, 2014 at 3:25 PM Aaron Ecay <aaronecay@gmail.com> wrote:
Hi Nicolas and Kaushal,

2014ko irailak 26an, Nicolas Goaziou-ek idatzi zuen:
>
> Hello,
>
> Kaushal <kaushal.modi@gmail.com> writes:
>
>> I have fci-mode installed and enabled for programming modes.
>>
>> When org exports to html, htmlize figures out the syntax highlight= ing of
>> the code by calling=C2=A0 =3D(funcall lang-mode)=3D.
>>
>> That activates =3Dfci-mode=3D.
>>
>> =3Dfci-mode=3D shows the fill column using a unicode character. Th= e issue is
>> that org export to html exports that character as well.
>>
>> Those characters show up in html as below!
>> http:= //i.imgur.com/8WplTqw.png
>>
>> So the solution is to fix the =3Dorx-html-fontify-code=3D function= .
>
> I don't think so. `fill-column-indicator' is not even in core = Emacs. We
> shouldn't provide a workaround for every package out there.

For better or for worse, Bastien already installed this fix on master as commit 44aaaad8, in response to Kaushal=E2=80=99s earlier bug report on thi= s
issue.=C2=A0 See <http://mid.gmane.org/87oaw92y6s.fsf@bzg.ath.cx&g= t;.

The fix has not yet been merged to the release branch, so it won=E2=80=99t = yet
show up in the ELPA version of org which Kaushal seems to be using.

--
Aaron Ecay
--001a113a5e20de13650517b6c525--