diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2016-02-14 00:07:37 +0100 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2016-02-14 00:11:28 +0100 |
commit | d846817f9d53204847ce3e34080126ab0f37fe97 (patch) | |
tree | ac423238981489a65ff71bc3428d7cafb2aed4ab | |
parent | caf66ea7793c070eea1bef1cbce93125d93496d6 (diff) | |
download | org-mode-d846817f9d53204847ce3e34080126ab0f37fe97.tar.gz |
Allow to preview LaTeX fragments in temporary buffers
* lisp/org.el (org-toggle-latex-fragment): Allow to preview fragments
even when current buffer is not visiting a file.
-rw-r--r-- | etc/ORG-NEWS | 1 | ||||
-rw-r--r-- | lisp/org.el | 8 |
2 files changed, 4 insertions, 5 deletions
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index a78ef7f..fba5f6e 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -208,6 +208,7 @@ When defining a "columnview" dynamic block, it is now possible to add an :indent parameter, much like the one in the clock table. On the other hand, stars no longer appear in an ITEM field. +*** Preview LaTeX snippets in buffers not visiting files ** New functions *** ~org-next-line-empty-p~ It replaces the deprecated ~next~ argument to ~org-previous-line-empty-p~. diff --git a/lisp/org.el b/lisp/org.el index 93062e2..5fcafd4 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -18956,8 +18956,6 @@ headline. With a double prefix ARG \\[universal-argument] \ \\[universal-argument] preview or clear images for all fragments in the buffer." (interactive "P") - (unless (buffer-file-name (buffer-base-buffer)) - (user-error "Can't preview LaTeX fragment in a non-file buffer")) (when (display-graphic-p) (catch 'exit (save-excursion @@ -19005,11 +19003,11 @@ for all fragments in the buffer." (narrow-to-region beg end)))))) (let ((file (buffer-file-name (buffer-base-buffer)))) (org-format-latex - (concat org-latex-preview-ltxpng-directory - (file-name-sans-extension (file-name-nondirectory file))) + (concat org-latex-preview-ltxpng-directory "org-ltxpng") ;; Emacs cannot overlay images from remote hosts. ;; Create it in `temporary-file-directory' instead. - (if (file-remote-p file) temporary-file-directory + (if (or (not file) (file-remote-p file)) + temporary-file-directory default-directory) 'overlays msg 'forbuffer org-latex-create-formula-image-program))) |