fourier / ztree

Directory tree comparison mode for Emacs
http://www.emacswiki.org/emacs/ZtreeDiff
GNU General Public License v3.0
239 stars 21 forks source link

No coloring #12

Closed theldoria closed 9 years ago

theldoria commented 9 years ago

First trying ztree-diff, but the result buffer does not show any coloring whatsoever.

I tried to resolve it by disabling/re-enabling font-lock-mode with no success.

fourier commented 9 years ago

How do you run it ? Works for me with default emacs -Q and emacs version 24.4.1

theldoria commented 9 years ago

I investigeted this issue and found, that font-lock-mode was the problem. I had global-font-lock-mode enabled, which conflicts with set-text-properties. I think should enable it for specific modes only.

However, you could warn users about this.

fourier commented 9 years ago

That is strange since I have global-font-lock-mode enabled in all configurations and don't have this problem. So it is probably something else in your configuration. Could you please try to run emacs -Q and enable the global-font-lock-mode and then start the ztree ?

theldoria commented 9 years ago

Well, it seems to work with emacs -Q and global-font-lock-mode.

(add-to-list 'load-path "~/.emacs.d/elpa/ztree-20140610.359")
(global-font-lock-mode 1)
(require 'ztree-dir)
(ztree-dir "~/.emacs.d/elpa/ztree-20140610.359")

I got a hint regarding font-lock-mode from this page: http://www.emacswiki.org/emacs/TextProperties. Although 'ztree-diff' works, the text property example

(let ((s "Alex"))
   (put-text-property 0 (length s) 'face 'bold s)
   (insert s))

does not work if font-lock-mode is enabled (running emacs -Q).

fourier commented 9 years ago

I believe it is something wrong with your configuration then. Try to bisect your config until you get it working, since if emacs -Q works even with a global-font-lock-mode when obviously it is something in your settings. I'll keep the issue open so you can report your findings what is a problem.

theldoria commented 9 years ago

I don't think it's my configuration in the first place. And bisecting for my large configuration (using 86 elpa packages, six other modules not available in elpa and a couple of self-made modules) is currently not that easy, thus I am not shure when I will find time to do it (maybe next week?).

Meanwhile, did you visit http://www.emacswiki.org/emacs/TextProperties? Once again, the example given there does not work with font-lock-mode and emacs -Q (as expected). Without font-lock-mode all is well.

Now I tried to use the text property available to work in conjunction with font-lock-mode and replaced face with font-lock-face. And voila, it properly works with global-font-lock-mode.

The down-side is, of course, that it no longer works without font-lock-mode. Since I am not an expert in that area, I don't know what's the right way to do it, but I might suggest one of the following:

theldoria commented 9 years ago

Don't know wheter it helps, but I further investigated this issue and found, that configuration (even global-font-lock-mode) is not ultimately the problem.

The coloring of ztree-diff works as lang as I dont't use org-mode (org-20141201, org-plus-contrib-20141201 and ox-reveal-20140710.811) combined with global-font-lock-mode prior to ztree-diff. If I did use it once, it no longer works for that emacs session. I also removed all my org-mode configuration, without any change.

theldoria commented 9 years ago

I tried it again with emacs -Q and the following test script:

(defun ztree-test-idle ()
  (ztree-dir "~/.emacs.d/elpa/ztree-20140610.359"))

(defun remove-org-idle ()
  (set-buffer-modified-p nil)
  (kill-buffer "test.org"))

(defun ztree-test ()
  (add-to-list 'load-path "~/.emacs.d/elpa/ztree-20140610.359")
  (add-to-list 'load-path "~/.emacs.d/elpa/org-20141201")
  (global-font-lock-mode 1)
  (require 'ztree-dir)
  (require 'org)
  (find-file "~/test.org")
  (insert "* Heading")
  (run-with-idle-timer 1 nil 'remove-org-idle)
  (run-with-idle-timer 2 nil 'ztree-test-idle))

(ztree-test)

and it fails.

theldoria commented 9 years ago

I also tried it at home, where I use a linux box and it showed, that the problem does not occur on linux.

The emacs version on my linux machine is the following: GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.10.7) of 2014-03-07 on lamiak, modified by Debian

I will also report the emacs version I use on windows.

fourier commented 9 years ago

Ok, then we understand at least what this problem is Emacs-specific..

theldoria commented 9 years ago

On windows (where the problem shows) I have this emacs version: GNU Emacs 24.3.1 (i386-mingw-nt6.1.7601) of 2013-03-17 on MARVIN

So, it's also not obviously emacs version related.

theldoria commented 9 years ago

I updated to org-mode version to org-20150504 and the problem disappeared.

fourier commented 9 years ago

Awesome, glad it worked for you. Otherwise it could be a very nasty bug for me to find.

eigengrau commented 8 years ago

In case someone stumbles upon this again, I’ve also encountered this issue when fic-mode is enabled in the ztree-diff buffer.