packages/excorporate: Interoperate with `save-some-buffers'
authorThomas Fitzsimmons <fitzsim@fitzsim.org>
Fri, 17 Jun 2016 01:59:27 +0000 (21:59 -0400)
committerThomas Fitzsimmons <fitzsim@fitzsim.org>
Fri, 17 Jun 2016 02:06:11 +0000 (22:06 -0400)
* packages/excorporate/excorporate-org.el
(exco-org-initialize-buffer): Set buffer-file-name to
excorporate-org-buffer-name during org-mode initialization
(bug#23765).

packages/excorporate/excorporate-org.el

index 05d11fb..2266161 100644 (file)
   "Add initial text to the destination buffer."
   (with-current-buffer (get-buffer-create excorporate-org-buffer-name)
       (setq buffer-read-only t)
-      (setq buffer-file-name excorporate-org-buffer-name)
-      (org-mode)
+      ;; Some Org mode configurations need `buffer-file-name' to be
+      ;; non-nil, or they'll make `org-mode' error out, for example
+      ;; `org-startup-with-latex-preview'.  Set `buffer-file-name' to
+      ;; something non-nil temporarily during initialization.  Don't
+      ;; leave it set or `save-some-buffers' will always prompt about
+      ;; *Excorporate*.
+      (let ((buffer-file-name excorporate-org-buffer-name))
+       (org-mode))
       (use-local-map (copy-keymap org-mode-map))
       (local-set-key "q" 'quit-window)
       (display-buffer (current-buffer))