From mboxrd@z Thu Jan 1 00:00:00 1970 From: Darlan Cavalcante Moreira Subject: [PATCH] org-preview-latex-fragment in indirect buffers Date: Thu, 28 Apr 2011 21:46:42 -0300 Message-ID: <4dba0a77.4bb7ec0a.32f5.60c2@mx.google.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: Received: from eggs.gnu.org ([140.186.70.92]:51644) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFbr7-0001MB-N3 for emacs-orgmode@gnu.org; Thu, 28 Apr 2011 20:46:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QFbr6-00087e-Rg for emacs-orgmode@gnu.org; Thu, 28 Apr 2011 20:46:49 -0400 Received: from mail-gx0-f169.google.com ([209.85.161.169]:49527) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFbr6-00087V-PN for emacs-orgmode@gnu.org; Thu, 28 Apr 2011 20:46:48 -0400 Received: by gxk23 with SMTP id 23so1479199gxk.0 for ; Thu, 28 Apr 2011 17:46:48 -0700 (PDT) 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: Orgmode Mailing List Hello, I frequently use indirect buffers with org but org-preview-latex-fragment does not work when in an indirect buffer. The reason is that org-preview-latex-fragment uses "buffer-file-name" to get the name of the file associated with the current buffer, but this is nil for indirect buffers. To solve this, all its necessary is to define the function below --8<---------------cut here---------------start------------->8--- (defun org-buffer-file-name () "Similar to buffer-file-name, but also work on indirect buffers." (buffer-file-name (buffer-base-buffer)) ) --8<---------------cut here---------------end--------------->8--- and replace "buffer-file-name" in the org-preview-latex-fragment by "(org-buffer-file-name)". This works in both: "normal" buffers and indirect buffers. -- Darlan