Commit 8ec6d48a authored by Glenn Morris's avatar Glenn Morris

(simple-diary-display, make-diary-entry): Allow the diary to pop up a

new frame, if needed.
parent 783bf210
...@@ -409,7 +409,6 @@ These hooks have the following distinct roles: ...@@ -409,7 +409,6 @@ These hooks have the following distinct roles:
'list-diary-entries-hook) 'list-diary-entries-hook)
(if diary-display-hook (if diary-display-hook
(run-hooks 'diary-display-hook) (run-hooks 'diary-display-hook)
;; FIXME Error if calendar-setup 'calendar-only -- gm.
(simple-diary-display)) (simple-diary-display))
(run-hooks 'diary-hook) (run-hooks 'diary-hook)
diary-entries-list)))) diary-entries-list))))
...@@ -466,17 +465,19 @@ changing the variable `diary-include-string'." ...@@ -466,17 +465,19 @@ changing the variable `diary-include-string'."
"Display the diary buffer if there are any relevant entries or holidays." "Display the diary buffer if there are any relevant entries or holidays."
(let* ((holiday-list (if holidays-in-diary-buffer (let* ((holiday-list (if holidays-in-diary-buffer
(check-calendar-holidays original-date))) (check-calendar-holidays original-date)))
(msg (format "No diary entries for %s %s" (hol-string (format "%s%s%s"
(concat date-string (if holiday-list ":" "")) date-string
(mapconcat 'identity holiday-list "; ")))) (if holiday-list ": " "")
(calendar-set-mode-line (mapconcat 'identity holiday-list "; ")))
(concat "Diary for " date-string (msg (format "No diary entries for %s" hol-string))
(if holiday-list ": " "") ;; If selected window is dedicated (to the calendar),
(mapconcat 'identity holiday-list "; "))) ;; need a new one to display the diary.
(pop-up-frames (window-dedicated-p (selected-window))))
(calendar-set-mode-line (format "Diary for %s" hol-string))
(if (or (not diary-entries-list) (if (or (not diary-entries-list)
(and (not (cdr diary-entries-list)) (and (not (cdr diary-entries-list))
(string-equal (car (cdr (car diary-entries-list))) ""))) (string-equal (car (cdr (car diary-entries-list))) "")))
(if (<= (length msg) (frame-width)) (if (< (length msg) (frame-width))
(message "%s" msg) (message "%s" msg)
(set-buffer (get-buffer-create holiday-buffer)) (set-buffer (get-buffer-create holiday-buffer))
(setq buffer-read-only nil) (setq buffer-read-only nil)
...@@ -1589,7 +1590,8 @@ Do nothing if DATE or STRING is nil." ...@@ -1589,7 +1590,8 @@ Do nothing if DATE or STRING is nil."
(defun make-diary-entry (string &optional nonmarking file) (defun make-diary-entry (string &optional nonmarking file)
"Insert a diary entry STRING which may be NONMARKING in FILE. "Insert a diary entry STRING which may be NONMARKING in FILE.
If omitted, NONMARKING defaults to nil and FILE defaults to `diary-file'." If omitted, NONMARKING defaults to nil and FILE defaults to `diary-file'."
(find-file-other-window (substitute-in-file-name (or file diary-file))) (let ((pop-up-frames (window-dedicated-p (selected-window))))
(find-file-other-window (substitute-in-file-name (or file diary-file))))
(widen) (widen)
(goto-char (point-max)) (goto-char (point-max))
(when (let ((case-fold-search t)) (when (let ((case-fold-search t))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment