]> code.delx.au - gnu-emacs-elpa/blobdiff - packages/excorporate/excorporate-org.el
packages/excorporate: Interoperate with `save-some-buffers'
[gnu-emacs-elpa] / packages / excorporate / excorporate-org.el
index 8613f8e9c081ec7817597781303ffac73e9499c3..22661619f48336c8d35c4e23520d4cb79bbee90d 100644 (file)
   "Add initial text to the destination buffer."
   (with-current-buffer (get-buffer-create excorporate-org-buffer-name)
       (setq buffer-read-only t)
-      (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))
       (let ((inhibit-read-only t))
        (delete-region (point-min) (point-max))
@@ -88,8 +97,9 @@ are the requested participants."
   (insert (format "+ Duration: %d minutes\n"
                  (round (/ (float-time (time-subtract end start)) 60.0))))
   (insert (format "+ Location: %s\n" location))
-  (insert "+ Invitees:\n")
-  (exco-org-insert-invitees main-invitees)
+  (when main-invitees
+    (insert "+ Invitees:\n")
+    (exco-org-insert-invitees main-invitees))
   (when optional-invitees
     (insert "+ Optional invitees:\n")
     (exco-org-insert-invitees optional-invitees)))