summaryrefslogtreecommitdiff
path: root/lisp/calendar/lunar.el
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2008-03-17 02:19:31 +0000
committerGlenn Morris <rgm@gnu.org>2008-03-17 02:19:31 +0000
commit48844538aedc947e8e8b3a1302b0d1e228d1665b (patch)
tree2f73a8cdef9e87919d684d5971f128cad55e3309 /lisp/calendar/lunar.el
parent2472a6f07f8e8458ec82accc44472ff800c7a472 (diff)
downloademacs-48844538aedc947e8e8b3a1302b0d1e228d1665b.tar.gz
(calendar-phases-of-moon): Use calendar-in-read-only-buffer to replace
previous code and disable undo.
Diffstat (limited to 'lisp/calendar/lunar.el')
-rw-r--r--lisp/calendar/lunar.el44
1 files changed, 19 insertions, 25 deletions
diff --git a/lisp/calendar/lunar.el b/lisp/calendar/lunar.el
index c0e9f8d6f36..789b47eb191 100644
--- a/lisp/calendar/lunar.el
+++ b/lisp/calendar/lunar.el
@@ -194,31 +194,25 @@ remainder mod 4 gives the phase: 0 new moon, 1 first quarter, 2 full moon,
(y2 displayed-year))
(increment-calendar-month m1 y1 -1)
(increment-calendar-month m2 y2 1)
- (set-buffer (get-buffer-create lunar-phases-buffer))
- (setq buffer-read-only nil)
- (calendar-set-mode-line
- (if (= y1 y2)
- (format "Phases of the Moon from %s to %s, %d%%-"
- (calendar-month-name m1) (calendar-month-name m2) y2)
- (format "Phases of the Moon from %s, %d to %s, %d%%-"
- (calendar-month-name m1) y1 (calendar-month-name m2) y2)))
- (erase-buffer)
- (insert
- (mapconcat
- (lambda (x)
- (let ((date (car x))
- (time (cadr x))
- (phase (nth 2 x)))
- (concat (calendar-date-string date)
- ": "
- (lunar-phase-name phase)
- " "
- time)))
- (lunar-phase-list m1 y1) "\n"))
- (goto-char (point-min))
- (set-buffer-modified-p nil)
- (setq buffer-read-only t)
- (display-buffer lunar-phases-buffer)
+ (calendar-in-read-only-buffer lunar-phases-buffer
+ (calendar-set-mode-line
+ (if (= y1 y2)
+ (format "Phases of the Moon from %s to %s, %d%%-"
+ (calendar-month-name m1) (calendar-month-name m2) y2)
+ (format "Phases of the Moon from %s, %d to %s, %d%%-"
+ (calendar-month-name m1) y1 (calendar-month-name m2) y2)))
+ (insert
+ (mapconcat
+ (lambda (x)
+ (let ((date (car x))
+ (time (cadr x))
+ (phase (nth 2 x)))
+ (concat (calendar-date-string date)
+ ": "
+ (lunar-phase-name phase)
+ " "
+ time)))
+ (lunar-phase-list m1 y1) "\n")))
(message "Computing phases of the moon...done")))
;;;###autoload