aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2008-03-25 03:42:55 +0000
committerGlenn Morris2008-03-25 03:42:55 +0000
commitf49f2a9eb11c211fa07e0946855af9f7495e1632 (patch)
tree2d3b425cccd8e56d27382aa02f41f8f15e7363e3
parent0075b4a27882cf183756eeeabf0a4afbc67ca07d (diff)
downloademacs-f49f2a9eb11c211fa07e0946855af9f7495e1632.tar.gz
emacs-f49f2a9eb11c211fa07e0946855af9f7495e1632.zip
(calendar-remove-frame-by-deleting): Default to t. Add to 'calendar group.
(calendar): Doc fix. Use calendar-frame-setup. (calendar-basic-setup): Doc fix. Add optional NODISPLAY argument. (generate-calendar-window): Doc fix.
-rw-r--r--lisp/calendar/calendar.el105
1 files changed, 51 insertions, 54 deletions
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
index 6b3388bf74a..7dc584e76a4 100644
--- a/lisp/calendar/calendar.el
+++ b/lisp/calendar/calendar.el
@@ -202,11 +202,13 @@ The marking symbol is specified by the variable `diary-entry-marker'."
202 :type 'boolean 202 :type 'boolean
203 :group 'diary) 203 :group 'diary)
204 204
205(defcustom calendar-remove-frame-by-deleting nil 205(defcustom calendar-remove-frame-by-deleting t
206 "Determine how the calendar mode removes a frame no longer needed. 206 "Determine how the calendar mode removes a frame no longer needed.
207If nil, make an icon of the frame. If non-nil, delete the frame." 207If nil, make an icon of the frame. If non-nil, delete the frame."
208 :type 'boolean 208 :type 'boolean
209 :group 'view) 209 :version "23.1" ; changed from nil to t
210 :group 'view
211 :group 'calendar)
210 212
211(defface calendar-today 213(defface calendar-today
212 '((t (:underline t))) 214 '((t (:underline t)))
@@ -1340,57 +1342,52 @@ return negative results."
1340 1342
1341;;;###autoload 1343;;;###autoload
1342(defun calendar (&optional arg) 1344(defun calendar (&optional arg)
1343 "Choose between the one frame, two frame, or basic calendar displays. 1345 "Display a three-month Gregorian calendar.
1344If called with an optional prefix argument ARG, prompts for month and year. 1346The three months appear side by side, with the current month in
1345 1347the middle surrounded by the previous and next months. The
1346The original function `calendar' has been renamed `calendar-basic-setup'. 1348cursor is put on today's date. If optional prefix argument ARG
1347See the documentation of that function for more information." 1349is non-nil, prompts for the central month and year.
1350
1351Once in the calendar window, future or past months can be moved
1352into view. Arbitrary months can be displayed, or the calendar
1353can be scrolled forward or backward. The cursor can be moved
1354forward or backward by one day, one week, one month, or one year.
1355All of these commands take prefix arguments which, when negative,
1356cause movement in the opposite direction. For convenience, the
1357digit keys and the minus sign are automatically prefixes. Use
1358\\[describe-mode] for details of the key bindings in the calendar
1359window.
1360
1361Displays the calendar in a separate window, or optionally in a
1362separate frame, depending on the value of `calendar-setup'.
1363
1364If `view-diary-entries-initially' is non-nil, also displays the
1365diary entries for the current date (or however many days
1366`number-of-diary-entries' specifies). This variable can be
1367overridden by `calendar-setup'. As well as being displayed,
1368diary entries can also be marked on the calendar (see
1369`mark-diary-entries-in-calendar').
1370
1371Runs the following hooks:
1372
1373`calendar-load-hook' - after loading calendar.el
1374`today-visible-calendar-hook', `today-invisible-calendar-hook' - after
1375 generating a calendar, if today's date is visible or not, respectively
1376`initial-calendar-window-hook' - after first creating a calendar
1377
1378This function is suitable for execution in a .emacs file."
1348 (interactive "P") 1379 (interactive "P")
1349 (cond ((equal calendar-setup 'one-frame) (calendar-one-frame-setup arg)) 1380 ;; Avoid loading cal-x unless it will be used.
1350 ((equal calendar-setup 'two-frames) (calendar-two-frame-setup arg)) 1381 (if (and (memq calendar-setup '(one-frame two-frames calendar-only))
1351 ((equal calendar-setup 'calendar-only) 1382 (display-multi-frame-p))
1352 (calendar-only-one-frame-setup arg)) 1383 (calendar-frame-setup calendar-setup arg)
1353 (t (calendar-basic-setup arg)))) 1384 (calendar-basic-setup arg)))
1354 1385
1355(defun calendar-basic-setup (&optional arg) 1386(defun calendar-basic-setup (&optional arg nodisplay)
1356 "Display a three-month calendar in another window. 1387 "Create a three-month calendar.
1357The three months appear side by side, with the current month in the middle 1388If optional prefix argument ARG is non-nil, prompts for the month
1358surrounded by the previous and next months. The cursor is put on today's date. 1389and year, else uses the current date. If NODISPLAY is non-nil, don't
1359 1390display the generated calendar."
1360If called with an optional prefix argument ARG, prompts for month and year.
1361
1362This function is suitable for execution in a .emacs file; appropriate setting
1363of the variable `view-diary-entries-initially' will cause the diary entries for
1364the current date to be displayed in another window. The value of the variable
1365`number-of-diary-entries' controls the number of days of diary entries
1366displayed upon initial display of the calendar.
1367
1368Once in the calendar window, future or past months can be moved into view.
1369Arbitrary months can be displayed, or the calendar can be scrolled forward
1370or backward.
1371
1372The cursor can be moved forward or backward by one day, one week, one month,
1373or one year. All of these commands take prefix arguments which, when negative,
1374cause movement in the opposite direction. For convenience, the digit keys
1375and the minus sign are automatically prefixes. The window is replotted as
1376necessary to display the desired date.
1377
1378Diary entries can be marked on the calendar or displayed in another window.
1379
1380Use \\[describe-mode] for details of the key bindings in the calendar window.
1381
1382The Gregorian calendar is assumed.
1383
1384After loading the calendar, the hooks given by the variable
1385`calendar-load-hook' are run. This is the place to add key bindings to the
1386`calendar-mode-map'.
1387
1388The hooks given by the variable `today-visible-calendar-hook' are run
1389every time the calendar window gets scrolled, if the current date is visible
1390in the window. If it is not visible, the hooks given by the variable
1391`today-invisible-calendar-hook' are run.
1392
1393Finally this command runs `initial-calendar-window-hook'."
1394 (interactive "P") 1391 (interactive "P")
1395 (set-buffer (get-buffer-create calendar-buffer)) 1392 (set-buffer (get-buffer-create calendar-buffer))
1396 (calendar-mode) 1393 (calendar-mode)
@@ -1403,7 +1400,7 @@ Finally this command runs `initial-calendar-window-hook'."
1403 (increment-calendar-month month year (- calendar-offset)) 1400 (increment-calendar-month month year (- calendar-offset))
1404 ;; Display the buffer before calling generate-calendar-window so that it 1401 ;; Display the buffer before calling generate-calendar-window so that it
1405 ;; can get a chance to adjust the window sizes to the frame size. 1402 ;; can get a chance to adjust the window sizes to the frame size.
1406 (pop-to-buffer calendar-buffer) 1403 (or nodisplay (pop-to-buffer calendar-buffer))
1407 (generate-calendar-window month year) 1404 (generate-calendar-window month year)
1408 (if (and view-diary-entries-initially (calendar-date-is-visible-p date)) 1405 (if (and view-diary-entries-initially (calendar-date-is-visible-p date))
1409 (diary-view-entries))) 1406 (diary-view-entries)))
@@ -1417,7 +1414,7 @@ Finally this command runs `initial-calendar-window-hook'."
1417 1414
1418(defun generate-calendar-window (&optional mon yr) 1415(defun generate-calendar-window (&optional mon yr)
1419 "Generate the calendar window for the current date. 1416 "Generate the calendar window for the current date.
1420Or, for optional MON, YR." 1417Optional integers MON and YR are used instead of today's date."
1421 (let* ((inhibit-read-only t) 1418 (let* ((inhibit-read-only t)
1422 (today (calendar-current-date)) 1419 (today (calendar-current-date))
1423 (month (extract-calendar-month today)) 1420 (month (extract-calendar-month today))