diff options
| author | Richard M. Stallman | 1996-04-07 03:22:54 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-04-07 03:22:54 +0000 |
| commit | a0e06fd0c10e26e809c82df235db6b03909aecf9 (patch) | |
| tree | e243df72f92213f17740e8a45d869b104597f598 | |
| parent | c011e9a593077486dd75cbce238d30ff2c158190 (diff) | |
| download | emacs-a0e06fd0c10e26e809c82df235db6b03909aecf9.tar.gz emacs-a0e06fd0c10e26e809c82df235db6b03909aecf9.zip | |
(calendar-mouse-goto-date): New function.
Call it instead of calendar-goto-date throughout this file.
(calendar-event-to-date): Switch buffers based on the event.
| -rw-r--r-- | lisp/calendar/cal-menu.el | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/lisp/calendar/cal-menu.el b/lisp/calendar/cal-menu.el index e058857a462..33b0443fca9 100644 --- a/lisp/calendar/cal-menu.el +++ b/lisp/calendar/cal-menu.el | |||
| @@ -217,6 +217,7 @@ | |||
| 217 | If event is not on a specific date, signals an error if optional parameter | 217 | If event is not on a specific date, signals an error if optional parameter |
| 218 | ERROR is t, otherwise just returns nil." | 218 | ERROR is t, otherwise just returns nil." |
| 219 | (save-excursion | 219 | (save-excursion |
| 220 | (set-buffer (window-buffer (posn-window (event-start last-input-event)))) | ||
| 220 | (goto-char (posn-point (event-start last-input-event))) | 221 | (goto-char (posn-point (event-start last-input-event))) |
| 221 | (calendar-cursor-to-date error))) | 222 | (calendar-cursor-to-date error))) |
| 222 | 223 | ||
| @@ -250,49 +251,49 @@ ERROR is t, otherwise just returns nil." | |||
| 250 | "Show sunrise/sunset times for mouse-selected date." | 251 | "Show sunrise/sunset times for mouse-selected date." |
| 251 | (interactive) | 252 | (interactive) |
| 252 | (save-excursion | 253 | (save-excursion |
| 253 | (calendar-goto-date (calendar-event-to-date)) | 254 | (calendar-mouse-goto-date (calendar-event-to-date)) |
| 254 | (calendar-sunrise-sunset))) | 255 | (calendar-sunrise-sunset))) |
| 255 | 256 | ||
| 256 | (defun calendar-mouse-holidays () | 257 | (defun calendar-mouse-holidays () |
| 257 | "Show holidays for mouse-selected date." | 258 | "Show holidays for mouse-selected date." |
| 258 | (interactive) | 259 | (interactive) |
| 259 | (save-excursion | 260 | (save-excursion |
| 260 | (calendar-goto-date (calendar-event-to-date)) | 261 | (calendar-mouse-goto-date (calendar-event-to-date)) |
| 261 | (calendar-cursor-holidays))) | 262 | (calendar-cursor-holidays))) |
| 262 | 263 | ||
| 263 | (defun calendar-mouse-view-diary-entries () | 264 | (defun calendar-mouse-view-diary-entries () |
| 264 | "View diary entries on mouse-selected date." | 265 | "View diary entries on mouse-selected date." |
| 265 | (interactive) | 266 | (interactive) |
| 266 | (save-excursion | 267 | (save-excursion |
| 267 | (calendar-goto-date (calendar-event-to-date)) | 268 | (calendar-mouse-goto-date (calendar-event-to-date)) |
| 268 | (view-diary-entries 1))) | 269 | (view-diary-entries 1))) |
| 269 | 270 | ||
| 270 | (defun calendar-mouse-view-other-diary-entries () | 271 | (defun calendar-mouse-view-other-diary-entries () |
| 271 | "View diary entries from alternative file on mouse-selected date." | 272 | "View diary entries from alternative file on mouse-selected date." |
| 272 | (interactive) | 273 | (interactive) |
| 273 | (save-excursion | 274 | (save-excursion |
| 274 | (calendar-goto-date (calendar-event-to-date)) | 275 | (calendar-mouse-goto-date (calendar-event-to-date)) |
| 275 | (call-interactively 'view-other-diary-entries))) | 276 | (call-interactively 'view-other-diary-entries))) |
| 276 | 277 | ||
| 277 | (defun calendar-mouse-insert-diary-entry () | 278 | (defun calendar-mouse-insert-diary-entry () |
| 278 | "Insert diary entry for mouse-selected date." | 279 | "Insert diary entry for mouse-selected date." |
| 279 | (interactive) | 280 | (interactive) |
| 280 | (save-excursion | 281 | (save-excursion |
| 281 | (calendar-goto-date (calendar-event-to-date)) | 282 | (calendar-mouse-goto-date (calendar-event-to-date)) |
| 282 | (insert-diary-entry nil))) | 283 | (insert-diary-entry nil))) |
| 283 | 284 | ||
| 284 | (defun calendar-mouse-set-mark () | 285 | (defun calendar-mouse-set-mark () |
| 285 | "Mark the date under the cursor." | 286 | "Mark the date under the cursor." |
| 286 | (interactive) | 287 | (interactive) |
| 287 | (save-excursion | 288 | (save-excursion |
| 288 | (calendar-goto-date (calendar-event-to-date)) | 289 | (calendar-mouse-goto-date (calendar-event-to-date)) |
| 289 | (calendar-set-mark nil))) | 290 | (calendar-set-mark nil))) |
| 290 | 291 | ||
| 291 | (defun cal-tex-mouse-day () | 292 | (defun cal-tex-mouse-day () |
| 292 | "Make a buffer with LaTeX commands for the day mouse is on." | 293 | "Make a buffer with LaTeX commands for the day mouse is on." |
| 293 | (interactive) | 294 | (interactive) |
| 294 | (save-excursion | 295 | (save-excursion |
| 295 | (calendar-goto-date (calendar-event-to-date)) | 296 | (calendar-mouse-goto-date (calendar-event-to-date)) |
| 296 | (cal-tex-cursor-day nil))) | 297 | (cal-tex-cursor-day nil))) |
| 297 | 298 | ||
| 298 | (defun cal-tex-mouse-week () | 299 | (defun cal-tex-mouse-week () |
| @@ -300,7 +301,7 @@ ERROR is t, otherwise just returns nil." | |||
| 300 | Holidays are included if `cal-tex-holidays' is t." | 301 | Holidays are included if `cal-tex-holidays' is t." |
| 301 | (interactive) | 302 | (interactive) |
| 302 | (save-excursion | 303 | (save-excursion |
| 303 | (calendar-goto-date (calendar-event-to-date)) | 304 | (calendar-mouse-goto-date (calendar-event-to-date)) |
| 304 | (cal-tex-cursor-week nil))) | 305 | (cal-tex-cursor-week nil))) |
| 305 | 306 | ||
| 306 | (defun cal-tex-mouse-week2 () | 307 | (defun cal-tex-mouse-week2 () |
| @@ -308,7 +309,7 @@ Holidays are included if `cal-tex-holidays' is t." | |||
| 308 | The printed output will be on two pages." | 309 | The printed output will be on two pages." |
| 309 | (interactive) | 310 | (interactive) |
| 310 | (save-excursion | 311 | (save-excursion |
| 311 | (calendar-goto-date (calendar-event-to-date)) | 312 | (calendar-mouse-goto-date (calendar-event-to-date)) |
| 312 | (cal-tex-cursor-week2 nil))) | 313 | (cal-tex-cursor-week2 nil))) |
| 313 | 314 | ||
| 314 | (defun cal-tex-mouse-week-iso () | 315 | (defun cal-tex-mouse-week-iso () |
| @@ -316,28 +317,28 @@ The printed output will be on two pages." | |||
| 316 | Holidays are included if `cal-tex-holidays' is t." | 317 | Holidays are included if `cal-tex-holidays' is t." |
| 317 | (interactive) | 318 | (interactive) |
| 318 | (save-excursion | 319 | (save-excursion |
| 319 | (calendar-goto-date (calendar-event-to-date)) | 320 | (calendar-mouse-goto-date (calendar-event-to-date)) |
| 320 | (cal-tex-cursor-week-iso nil))) | 321 | (cal-tex-cursor-week-iso nil))) |
| 321 | 322 | ||
| 322 | (defun cal-tex-mouse-week-monday () | 323 | (defun cal-tex-mouse-week-monday () |
| 323 | "One page calendar for week indicated by cursor." | 324 | "One page calendar for week indicated by cursor." |
| 324 | (interactive) | 325 | (interactive) |
| 325 | (save-excursion | 326 | (save-excursion |
| 326 | (calendar-goto-date (calendar-event-to-date)) | 327 | (calendar-mouse-goto-date (calendar-event-to-date)) |
| 327 | (cal-tex-cursor-week-monday nil))) | 328 | (cal-tex-cursor-week-monday nil))) |
| 328 | 329 | ||
| 329 | (defun cal-tex-mouse-filofax-2week () | 330 | (defun cal-tex-mouse-filofax-2week () |
| 330 | "One page Filofax calendar for week indicated by cursor." | 331 | "One page Filofax calendar for week indicated by cursor." |
| 331 | (interactive) | 332 | (interactive) |
| 332 | (save-excursion | 333 | (save-excursion |
| 333 | (calendar-goto-date (calendar-event-to-date)) | 334 | (calendar-mouse-goto-date (calendar-event-to-date)) |
| 334 | (cal-tex-cursor-filofax-2week nil))) | 335 | (cal-tex-cursor-filofax-2week nil))) |
| 335 | 336 | ||
| 336 | (defun cal-tex-mouse-filofax-week () | 337 | (defun cal-tex-mouse-filofax-week () |
| 337 | "Two page Filofax calendar for week indicated by cursor." | 338 | "Two page Filofax calendar for week indicated by cursor." |
| 338 | (interactive) | 339 | (interactive) |
| 339 | (save-excursion | 340 | (save-excursion |
| 340 | (calendar-goto-date (calendar-event-to-date)) | 341 | (calendar-mouse-goto-date (calendar-event-to-date)) |
| 341 | (cal-tex-cursor-filofax-week nil))) | 342 | (cal-tex-cursor-filofax-week nil))) |
| 342 | 343 | ||
| 343 | (defun cal-tex-mouse-month () | 344 | (defun cal-tex-mouse-month () |
| @@ -345,7 +346,7 @@ Holidays are included if `cal-tex-holidays' is t." | |||
| 345 | Calendar is condensed onto one page." | 346 | Calendar is condensed onto one page." |
| 346 | (interactive) | 347 | (interactive) |
| 347 | (save-excursion | 348 | (save-excursion |
| 348 | (calendar-goto-date (calendar-event-to-date)) | 349 | (calendar-mouse-goto-date (calendar-event-to-date)) |
| 349 | (cal-tex-cursor-month nil))) | 350 | (cal-tex-cursor-month nil))) |
| 350 | 351 | ||
| 351 | (defun cal-tex-mouse-month-landscape () | 352 | (defun cal-tex-mouse-month-landscape () |
| @@ -353,28 +354,28 @@ Calendar is condensed onto one page." | |||
| 353 | The output is in landscape format, one month to a page." | 354 | The output is in landscape format, one month to a page." |
| 354 | (interactive) | 355 | (interactive) |
| 355 | (save-excursion | 356 | (save-excursion |
| 356 | (calendar-goto-date (calendar-event-to-date)) | 357 | (calendar-mouse-goto-date (calendar-event-to-date)) |
| 357 | (cal-tex-cursor-month-landscape nil))) | 358 | (cal-tex-cursor-month-landscape nil))) |
| 358 | 359 | ||
| 359 | (defun cal-tex-mouse-year () | 360 | (defun cal-tex-mouse-year () |
| 360 | "Make a buffer with LaTeX commands for the year cursor is on." | 361 | "Make a buffer with LaTeX commands for the year cursor is on." |
| 361 | (interactive) | 362 | (interactive) |
| 362 | (save-excursion | 363 | (save-excursion |
| 363 | (calendar-goto-date (calendar-event-to-date)) | 364 | (calendar-mouse-goto-date (calendar-event-to-date)) |
| 364 | (cal-tex-cursor-year nil))) | 365 | (cal-tex-cursor-year nil))) |
| 365 | 366 | ||
| 366 | (defun cal-tex-mouse-filofax-year () | 367 | (defun cal-tex-mouse-filofax-year () |
| 367 | "Make a buffer with LaTeX commands for Filofax calendar of year cursor is on." | 368 | "Make a buffer with LaTeX commands for Filofax calendar of year cursor is on." |
| 368 | (interactive) | 369 | (interactive) |
| 369 | (save-excursion | 370 | (save-excursion |
| 370 | (calendar-goto-date (calendar-event-to-date)) | 371 | (calendar-mouse-goto-date (calendar-event-to-date)) |
| 371 | (cal-tex-cursor-filofax-year nil))) | 372 | (cal-tex-cursor-filofax-year nil))) |
| 372 | 373 | ||
| 373 | (defun cal-tex-mouse-year-landscape () | 374 | (defun cal-tex-mouse-year-landscape () |
| 374 | "Make a buffer with LaTeX commands for the year cursor is on." | 375 | "Make a buffer with LaTeX commands for the year cursor is on." |
| 375 | (interactive) | 376 | (interactive) |
| 376 | (save-excursion | 377 | (save-excursion |
| 377 | (calendar-goto-date (calendar-event-to-date)) | 378 | (calendar-mouse-goto-date (calendar-event-to-date)) |
| 378 | (cal-tex-cursor-year-landscape nil))) | 379 | (cal-tex-cursor-year-landscape nil))) |
| 379 | 380 | ||
| 380 | (defun calendar-mouse-print-dates () | 381 | (defun calendar-mouse-print-dates () |
| @@ -427,9 +428,13 @@ The output is in landscape format, one month to a page." | |||
| 427 | "Show Chinese equivalent for mouse-selected date." | 428 | "Show Chinese equivalent for mouse-selected date." |
| 428 | (interactive) | 429 | (interactive) |
| 429 | (save-excursion | 430 | (save-excursion |
| 430 | (calendar-goto-date (calendar-event-to-date)) | 431 | (calendar-mouse-goto-date (calendar-event-to-date)) |
| 431 | (calendar-print-chinese-date))) | 432 | (calendar-print-chinese-date))) |
| 432 | 433 | ||
| 434 | (defun calendar-mouse-goto-date (date) | ||
| 435 | (set-buffer (window-buffer (posn-window (event-start last-input-event)))) | ||
| 436 | (calendar-goto-date date)) | ||
| 437 | |||
| 433 | (defun calendar-mouse-2-date-menu (event) | 438 | (defun calendar-mouse-2-date-menu (event) |
| 434 | "Pop up menu for Mouse-2 for selected date in the calendar window." | 439 | "Pop up menu for Mouse-2 for selected date in the calendar window." |
| 435 | (interactive "e") | 440 | (interactive "e") |