emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r107716: Revert 2012-03-28 calendar c


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r107716: Revert 2012-03-28 calendar change
Date: Sat, 31 Mar 2012 13:03:59 -0700
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 107716
fixes bug(s): http://debbugs.gnu.org/11140
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Sat 2012-03-31 13:03:59 -0700
message:
  Revert 2012-03-28 calendar change
  
  * lisp/calendar/calendar.el (calendar-window-list)
  (calendar-hide-window): Restore. 
  (calendar-exit): Use calendar-window-list, calendar-hide-window again.
modified:
  lisp/ChangeLog
  lisp/calendar/calendar.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-03-31 19:58:05 +0000
+++ b/lisp/ChangeLog    2012-03-31 20:03:59 +0000
@@ -1,5 +1,9 @@
 2012-03-31  Glenn Morris  <address@hidden>
 
+       * calendar/calendar.el (calendar-window-list)
+       (calendar-hide-window): Restore.  (Bug#11140)
+       (calendar-exit): Use calendar-window-list, calendar-hide-window again.
+
        * emacs-lisp/edebug.el (edebug-unwrap-results): Doc fix.
 
 2012-03-30  Thierry Volpiatto  <address@hidden>

=== modified file 'lisp/calendar/calendar.el'
--- a/lisp/calendar/calendar.el 2012-03-29 14:00:00 +0000
+++ b/lisp/calendar/calendar.el 2012-03-31 20:03:59 +0000
@@ -1793,6 +1793,19 @@
                          ?\s (- calendar-right-margin (1- start))))))
         (force-mode-line-update))))
 
+(defun calendar-window-list ()
+  "List of all calendar-related windows."
+  (let ((calendar-buffers (calendar-buffer-list))
+        list)
+    ;; Using 0 rather than t for last argument - see bug#2199.
+    ;; This is only used with calendar-hide-window, which ignores
+    ;; iconified frames anyway, so could use 'visible rather than 0.
+    (walk-windows (lambda (w)
+                    (if (memq (window-buffer w) calendar-buffers)
+                        (push w list)))
+                  nil 0)
+    list))
+
 (defun calendar-buffer-list ()
   "List of all calendar-related buffers (as buffers, not strings)."
   (let (buffs)
@@ -1804,29 +1817,41 @@
            (push b buffs)))
     buffs))
 
-(defun calendar-exit (&optional kill)
+(defun calendar-exit ()
   "Get out of the calendar window and hide it and related buffers."
-  (interactive "P")
-  (let ((diary-buffer (get-file-buffer diary-file))
-        (calendar-buffers (calendar-buffer-list)))
-    (when (or (not diary-buffer)
-              (not (buffer-modified-p diary-buffer))
-              (yes-or-no-p
-               "Diary modified; do you really want to exit the calendar? "))
-      (if (and calendar-setup (display-multi-frame-p))
-          ;; FIXME: replace this cruft with the `quit-restore' window property
-          (dolist (w (window-list-1 nil nil t))
-            (if (and (memq (window-buffer w) calendar-buffers)
-                     (window-dedicated-p w))
-                (if calendar-remove-frame-by-deleting
-                    (delete-frame (window-frame w))
-                    (iconify-frame (window-frame w)))
-              (quit-window kill w)))
-        (dolist (b calendar-buffers)
-          (quit-windows-on b kill))))))
+  (interactive)
+  (let ((diary-buffer (get-file-buffer diary-file)))
+    (if (or (not diary-buffer)
+            (not (buffer-modified-p diary-buffer))
+            (yes-or-no-p
+             "Diary modified; do you really want to exit the calendar? "))
+        ;; Need to do this multiple times because one time can replace some
+        ;; calendar-related buffers with other calendar-related buffers.
+        (mapc (lambda (x)
+                (mapc 'calendar-hide-window (calendar-window-list)))
+              (calendar-window-list)))))
 
 (define-obsolete-function-alias 'exit-calendar 'calendar-exit "23.1")
 
+(defun calendar-hide-window (window)
+  "Hide WINDOW if it is calendar-related."
+  (let ((buffer (if (window-live-p window) (window-buffer window))))
+    (if (memq buffer (calendar-buffer-list))
+        (cond
+         ((and (display-multi-frame-p)
+               (eq 'icon (cdr (assoc 'visibility
+                                     (frame-parameters
+                                      (window-frame window))))))
+          nil)
+         ((and (display-multi-frame-p) (window-dedicated-p window))
+          (if calendar-remove-frame-by-deleting
+              (delete-frame (window-frame window))
+              (iconify-frame (window-frame window))))
+         ((not (and (select-window window) (one-window-p window)))
+          (delete-window window))
+         (t (set-buffer buffer)
+            (bury-buffer))))))
+
 (defun calendar-current-date (&optional offset)
   "Return the current date in a list (month day year).
 Optional integer OFFSET is a number of days from the current date."


reply via email to

[Prev in Thread] Current Thread [Next in Thread]