I normally use indirect buffers while I edit python code in python-mode, I create them by running clone-indirect-buffer-other-window. While the syntax highlighting of the main buffer looks just fine, sometimes it is wrong in the indirect one. Specifically, it seems like some closing quotes are ignored adn so big chunks of my code are coloured as if they were part of long literal string.

I have not found references of this elsewhere, and have not clue why it could be happening. Does anybody know why this is and/or how to solve it?

This question could be related, be he does not mention indirect buffers (I only have this problem with those), and also my indirect buffer do not refresh to proper syntax highlighting even if a wait several minutes.

  • Why are you using an indirect buffer in the first place? You can show the main buffer in two different windows, if that is what you are after. Aug 8, 2015 at 16:07
  • 1
    If the problem exists with the most recent public release of Emacs, then consider filing a bug report with as many details as possible regarding the issue. If you are using an older version of Emacs, then try the most recent public release. If you are using Emacs Trunk, then also consider filing a bug report with lots of details.
    – lawlist
    Aug 8, 2015 at 16:41
  • @Lindydancer indirect buffers are more useful if I want to keep two fixed places of a long buffer open after switching my windows to other buffers
    – jmlorenzi
    Aug 8, 2015 at 20:24
  • @lawlist Yes, I will play around to get more details and send the bug. I have just reproduced the error with in emacs -q
    – jmlorenzi
    Aug 8, 2015 at 20:25

2 Answers 2


You can try Just Another Cloning package.

Installation: Put jac.el into any directory from your load-path and put

 (autoload 'jac "jac")

into your init file.

Usage: With the buffer you want to clone type M-x jac RET.

It copies the buffer content of the original buffer and synchronizes text modifications of both buffers but does not touch text properties. That way fontlock can do its work in both buffers independently. That makes different major modes inclusively highlighting possible.

Maybe, it also avoids the bug with the highlighting of different regions of a phyton file. (Just try it.)


Indirect buffers suck. They may look like "just what I need", but it's very rarely the case, and then sooner or later you bump into problems. IOW, I think they are an attractive nuisance.

I recommend you try and figure out why you want to use indirect-buffers and then try to look for other ways to get the same result.

E.g. you say:

indirect buffers are more useful if I want to keep two fixed places
of a long buffer open after switching my windows to other buffers

There are many other ways which are a lot less intrusive than using indirect buffers. E.g. using registers, bookmarks, or maybe with a package which tries to remember which point was used for your buffers individually in each window. E.g. in Emacs's master branch we have now enabled switch-to-buffer-preserve-window-point by default, which should provide some of the behavior you were looking for via indirect buffers.

  • 1
    This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review
    – erikstokes
    Jan 5, 2016 at 22:50
  • If you don;t recognize it as a valid answer, it's because you're not familiar enough with indirect-buffers.
    – Stefan
    Jan 7, 2016 at 5:34
  • @Stefan while you may be right, you're also not following this site's requested format: if you can answer the question, write an answer. If the question is invalid and should be changed, write a comment.
    – Trevoke
    Jun 24, 2016 at 14:56
  • The question is definitely valid, and I've heard it many times, which is why I think it's important to answer it as it is rather than to try and get the author to "fix it". I much prefer losing a few rep-points than dogmatically following some policy.
    – Stefan
    Jun 25, 2016 at 0:35
  • 1
    I agree with Stefan. Question and answer are valid. The answer could be formulated more neutral. E.g., "Indirect buffers suck. They" could be replaced by "Indirect buffers".
    – Tobias
    Jan 16, 2019 at 11:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.