Subject: bug#38592: 27.0.50; org mode insinuates itself into calendar

From: Sam Steingold <[email-masked]>
Date: Mon, 17 Feb 2020 07:51:54 -0500

To reproduce:

emacs -Q -f package-initialize --eval "(require 'ob)" --eval "(and (cl-assert (featurep 'ob)) (cl-assert (not (featurep 'org))))" --eval "(call-interactively 'calendar)"

The emacs needs to be at least 165f738382.

How about, minimally:

diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el
index 4446a169d7..ea66bb82be 100644
--- a/lisp/org/org-compat.el
+++ b/lisp/org/org-compat.el
@@ -1043,7 +1043,7 @@ org--setup-calendar-bindings
     ((guard (not (lookup-key calendar-mode-map "c")))
      (local-set-key "c" #'org-calendar-goto-agenda))
     (_ nil))
-  (unless (eq org-agenda-diary-file 'diary-file)
+  (unless (and (boundp 'org-agenda-diary-file) (eq org-agenda-diary-file 'diary-file))
     (local-set-key org-calendar-insert-diary-entry-key
 		   #'org-agenda-diary-entry)))

I suspect other assumptions are made that `ob` cannot be required without `org`.