aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2012-03-31 13:03:59 -0700
committerGlenn Morris2012-03-31 13:03:59 -0700
commita1daddd610574dd81c006fdb5265deaa448bf9ae (patch)
treea3b68cf8e68df791da31c2a86e19a75414a11cd5
parent0b0210946b093bcabae9b6bbd06b28b494d1188d (diff)
downloademacs-a1daddd610574dd81c006fdb5265deaa448bf9ae.tar.gz
emacs-a1daddd610574dd81c006fdb5265deaa448bf9ae.zip
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. Fixes: debbugs:11140
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/calendar/calendar.el63
2 files changed, 48 insertions, 19 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 970c74bf50f..87426eb0bea 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,9 @@
12012-03-31 Glenn Morris <rgm@gnu.org> 12012-03-31 Glenn Morris <rgm@gnu.org>
2 2
3 * calendar/calendar.el (calendar-window-list)
4 (calendar-hide-window): Restore. (Bug#11140)
5 (calendar-exit): Use calendar-window-list, calendar-hide-window again.
6
3 * emacs-lisp/edebug.el (edebug-unwrap-results): Doc fix. 7 * emacs-lisp/edebug.el (edebug-unwrap-results): Doc fix.
4 8
52012-03-30 Thierry Volpiatto <thierry.volpiatto@gmail.com> 92012-03-30 Thierry Volpiatto <thierry.volpiatto@gmail.com>
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
index cdef98a2763..d9ec27b4f88 100644
--- a/lisp/calendar/calendar.el
+++ b/lisp/calendar/calendar.el
@@ -1793,6 +1793,19 @@ the STRINGS are just concatenated and the result truncated."
1793 ?\s (- calendar-right-margin (1- start)))))) 1793 ?\s (- calendar-right-margin (1- start))))))
1794 (force-mode-line-update)))) 1794 (force-mode-line-update))))
1795 1795
1796(defun calendar-window-list ()
1797 "List of all calendar-related windows."
1798 (let ((calendar-buffers (calendar-buffer-list))
1799 list)
1800 ;; Using 0 rather than t for last argument - see bug#2199.
1801 ;; This is only used with calendar-hide-window, which ignores
1802 ;; iconified frames anyway, so could use 'visible rather than 0.
1803 (walk-windows (lambda (w)
1804 (if (memq (window-buffer w) calendar-buffers)
1805 (push w list)))
1806 nil 0)
1807 list))
1808
1796(defun calendar-buffer-list () 1809(defun calendar-buffer-list ()
1797 "List of all calendar-related buffers (as buffers, not strings)." 1810 "List of all calendar-related buffers (as buffers, not strings)."
1798 (let (buffs) 1811 (let (buffs)
@@ -1804,29 +1817,41 @@ the STRINGS are just concatenated and the result truncated."
1804 (push b buffs))) 1817 (push b buffs)))
1805 buffs)) 1818 buffs))
1806 1819
1807(defun calendar-exit (&optional kill) 1820(defun calendar-exit ()
1808 "Get out of the calendar window and hide it and related buffers." 1821 "Get out of the calendar window and hide it and related buffers."
1809 (interactive "P") 1822 (interactive)
1810 (let ((diary-buffer (get-file-buffer diary-file)) 1823 (let ((diary-buffer (get-file-buffer diary-file)))
1811 (calendar-buffers (calendar-buffer-list))) 1824 (if (or (not diary-buffer)
1812 (when (or (not diary-buffer) 1825 (not (buffer-modified-p diary-buffer))
1813 (not (buffer-modified-p diary-buffer)) 1826 (yes-or-no-p
1814 (yes-or-no-p 1827 "Diary modified; do you really want to exit the calendar? "))
1815 "Diary modified; do you really want to exit the calendar? ")) 1828 ;; Need to do this multiple times because one time can replace some
1816 (if (and calendar-setup (display-multi-frame-p)) 1829 ;; calendar-related buffers with other calendar-related buffers.
1817 ;; FIXME: replace this cruft with the `quit-restore' window property 1830 (mapc (lambda (x)
1818 (dolist (w (window-list-1 nil nil t)) 1831 (mapc 'calendar-hide-window (calendar-window-list)))
1819 (if (and (memq (window-buffer w) calendar-buffers) 1832 (calendar-window-list)))))
1820 (window-dedicated-p w))
1821 (if calendar-remove-frame-by-deleting
1822 (delete-frame (window-frame w))
1823 (iconify-frame (window-frame w)))
1824 (quit-window kill w)))
1825 (dolist (b calendar-buffers)
1826 (quit-windows-on b kill))))))
1827 1833
1828(define-obsolete-function-alias 'exit-calendar 'calendar-exit "23.1") 1834(define-obsolete-function-alias 'exit-calendar 'calendar-exit "23.1")
1829 1835
1836(defun calendar-hide-window (window)
1837 "Hide WINDOW if it is calendar-related."
1838 (let ((buffer (if (window-live-p window) (window-buffer window))))
1839 (if (memq buffer (calendar-buffer-list))
1840 (cond
1841 ((and (display-multi-frame-p)
1842 (eq 'icon (cdr (assoc 'visibility
1843 (frame-parameters
1844 (window-frame window))))))
1845 nil)
1846 ((and (display-multi-frame-p) (window-dedicated-p window))
1847 (if calendar-remove-frame-by-deleting
1848 (delete-frame (window-frame window))
1849 (iconify-frame (window-frame window))))
1850 ((not (and (select-window window) (one-window-p window)))
1851 (delete-window window))
1852 (t (set-buffer buffer)
1853 (bury-buffer))))))
1854
1830(defun calendar-current-date (&optional offset) 1855(defun calendar-current-date (&optional offset)
1831 "Return the current date in a list (month day year). 1856 "Return the current date in a list (month day year).
1832Optional integer OFFSET is a number of days from the current date." 1857Optional integer OFFSET is a number of days from the current date."