aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Blandy1992-08-12 12:57:12 +0000
committerJim Blandy1992-08-12 12:57:12 +0000
commit9e2b097b2608f55d27df1e3521575be8dd670a0c (patch)
tree957a68070b4ce12f0392726f5446e93b88fb80bb
parent7e1dae733a5eda79d5681349ca39bfc36ca27871 (diff)
downloademacs-9e2b097b2608f55d27df1e3521575be8dd670a0c.tar.gz
emacs-9e2b097b2608f55d27df1e3521575be8dd670a0c.zip
*** empty log message ***
-rwxr-xr-xconfigure1.in2
-rw-r--r--lib-src/timer.c284
-rw-r--r--lisp/diary-lib.el487
-rw-r--r--lisp/emacs-lisp/bytecomp.el149
-rw-r--r--lisp/frame.el25
-rw-r--r--lisp/term/x-win.el5
6 files changed, 443 insertions, 509 deletions
diff --git a/configure1.in b/configure1.in
index 073a49843e8..38aa36ad0e3 100755
--- a/configure1.in
+++ b/configure1.in
@@ -325,7 +325,7 @@ case "${window_system}" in
325 "" ) 325 "" )
326 echo " No window system specifed. Looking for X Windows." 326 echo " No window system specifed. Looking for X Windows."
327 window_system=none 327 window_system=none
328 if [ -r /usr/lib/libX11.a -a -d /usr/include/X11 ]; then 328 if [ -r /usr/lib/libX11.a -o -d /usr/include/X11 ]; then
329 window_system=x11 329 window_system=x11
330 fi 330 fi
331 ;; 331 ;;
diff --git a/lib-src/timer.c b/lib-src/timer.c
index d7084bfcdc4..2c1b9a729f6 100644
--- a/lib-src/timer.c
+++ b/lib-src/timer.c
@@ -1,155 +1,221 @@
1/*
2 * timer.c --- daemon to provide a tagged interval timer service
3 *
4 * This little daemon runs forever waiting for signals. SIGIO (or SIGUSR1)
5 * causes it to read an event spec from stdin; that is, a date followed by
6 * colon followed by an event label. SIGALRM causes it to check its queue
7 * for events attached to the current second; if one is found, its label
8 * is written to stdout. SIGTERM causes it to terminate, printing a list
9 * of pending events.
10 *
11 * This program is intended to be used with the lisp package called timer.el.
12 * It was written anonymously in 1990. This version was documented and
13 * rewritten for portability by esr@snark,thyrsus.com, Aug 7 1992.
14 */
1#include <stdio.h> 15#include <stdio.h>
2#include <signal.h> 16#include <signal.h>
3#include <fcntl.h> /* FASYNC */ 17#include <fcntl.h> /* FASYNC */
4#ifdef USG /* FASYNC for SysV */
5#include <sys/file.h>
6#endif
7#include <sys/time.h> /* itimer */
8#include <sys/types.h> /* time_t */ 18#include <sys/types.h> /* time_t */
9 19
20#include "../src/config.h"
21#ifdef USG
22#undef SIGIO
23#define SIGIO SIGUSR1
24#endif
25
10extern int errno; 26extern int errno;
11extern char *sys_errlist[], *malloc(); 27extern char *sys_errlist[], *malloc();
12extern time_t time(); 28extern time_t time();
13 29
14#define MAXEVENTS 256 30#define MAXEVENTS 256
15#define FS 1 /* field seperator for input */
16 31
17struct event { 32/*
18 char *token; 33 * The field separator for input. This character shouldn't be legal in a date,
19 time_t reply_at; 34 * and should be printable so event strings are readable by people. Was
20} *events[MAXEVENTS]; 35 * originally ';', then got changed to bogus `\001'.
36 */
37#define FS '@'
38
39struct event
40{
41 char *token;
42 time_t reply_at;
43}
44events[MAXEVENTS];
21 45
22int slot; /* The next open place in the events array */
23int mevent = 0; /* 1+ the highest event number */
24char *pname; /* programme name for error messages */ 46char *pname; /* programme name for error messages */
25 47
26/* Accepts a string of two fields seperated by a ';' 48/* Accepts a string of two fields seperated by FS.
27 * First field is string for getdate, saying when to wake-up. 49 * First field is string for getdate, saying when to wake-up.
28 * Second field is a token to identify the request. 50 * Second field is a token to identify the request.
29 */ 51 */
30struct event * 52void schedule(str)
31schedule(str) 53 char *str;
32 char *str;
33
34{ 54{
35 extern time_t getdate(); 55 extern time_t getdate();
36 extern char *strcpy(); 56 extern char *strcpy();
37 time_t now; 57 time_t now;
38 register char *p; 58 register char *p;
39 static struct event e; 59 static struct event *ep;
40 60
41 for(p = str; *p && *p != FS; p++); 61#ifdef DEBUG
42 if (!*p) { 62 (void) fprintf(stderr, "Timer sees: %s", str);
43 (void)fprintf(stderr, "%s: bad input format: %s", pname, str); 63#endif /* DEBUG */
44 return((struct event *)NULL); 64
45 } 65 /* check entry format */
46 *p++ = 0; 66 for(p = str; *p && *p != FS; p++)
67 continue;
68 if (!*p)
69 {
70 (void)fprintf(stderr, "%s: bad input format: %s", pname, str);
71 return;
72 }
73 *p++ = 0;
47 74
48 if ((e.reply_at = get_date(str, NULL)) - time(&now) < 0) { 75 /* allocate an event slot */
49 (void)fprintf(stderr, "%s: bad time spec: %s%c%s", pname, str, FS, p); 76 for(ep = events; ep < events + MAXEVENTS; ep++)
50 return((struct event *)NULL); 77 if (ep->token == (char *)NULL)
51 } 78 break;
52 79 if (ep == events + MAXEVENTS)
53 if ((e.token = malloc((unsigned)strlen(p) + 1)) == NULL) { 80 (void) fprintf(stderr, "%s: too many events: %s", pname, str);
54 (void)fprintf(stderr, "%s: malloc %s: %s%c%s", 81
55 pname, sys_errlist[errno], str, FS, p); 82 /* don't allow users to schedule events in past time */
56 return((struct event *)NULL); 83 else if ((ep->reply_at = get_date(str, NULL)) - time(&now) < 0)
57 } 84 (void)fprintf(stderr, "%s: bad time spec: %s%c%s", pname, str, FS, p);
58 (void)strcpy(e.token,p); 85
59 86 /* save the event description */
60 return(&e); 87 else if ((ep->token = malloc((unsigned)strlen(p) + 1)) == NULL)
88 (void)fprintf(stderr, "%s: malloc %s: %s%c%s",
89 pname, sys_errlist[errno], str, FS, p);
90 else
91 {
92 (void)strcpy(ep->token, p);
93
94#ifdef DEBUG
95 (void) fprintf(stderr,
96 "New event: %ld: %s", ep->reply_at, ep->token);
97#endif /* DEBUG */
98 }
61} 99}
62 100
63void 101void
64notify() 102notify()
65
66{ 103{
67 time_t now, tdiff; 104 time_t now, tdiff, waitfor = -1;
68 register int i, newmax = 0; 105 register struct event *ep;
69 /* I prefer using the interval timer rather than alarm(); the latter 106
70 could be substituted if portability requires it. */ 107 now = time((time_t *)NULL);
71 struct itimerval itimer; 108
72 109 for(ep = events; ep < events + MAXEVENTS; ep++)
73 now = time((time_t *)NULL); 110 if (ep->token)
74 slot = mevent; 111 {
75 itimer.it_interval.tv_sec = itimer.it_interval.tv_usec = 0; 112 /* any events ready to fire? */
76 itimer.it_value.tv_usec = 0; 113 if (ep->reply_at <= now)
77 itimer.it_value.tv_sec = -1; 114 {
78 115#ifdef DEBUG
79 for(i=0; i < mevent; i++) { 116 (void) fprintf(stderr,
80 while (events[i] && events[i]->reply_at <= now) { 117 "Event %d firing: %ld @ %s",
81 (void)fputs(events[i]->token, stdout); 118 (ep - events), ep->reply_at, ep->token);
82 free(events[i]->token); 119#endif /* DEBUG */
83 free((char *)events[i]); 120 (void)fputs(ep->token, stdout);
84 events[i] = 0; 121 free(ep->token);
85 } 122 ep->token = (char *)NULL;
86 123 }
87 if (events[i]) { 124 else
88 newmax = i+1; 125 {
89 if ((tdiff = events[i]->reply_at - now) < (time_t)itimer.it_value.tv_sec 126#ifdef DEBUG
90 || itimer.it_value.tv_sec < 0) 127 (void) fprintf(stderr,
91 /* next timeout */ 128 "Event %d still waiting: %ld @ %s",
92 itimer.it_value.tv_sec = (long)tdiff; 129 (ep - events), ep->reply_at, ep->token);
93 } else { 130#endif /* DEBUG */
94 /* Keep slot as the lowest unused events element */ 131
95 if (i < slot) slot = i; 132 /* next timeout should be the soonest of any remaining */
133 if ((tdiff = ep->reply_at - now) < waitfor || waitfor < 0)
134 waitfor = (long)tdiff;
135 }
136 }
137
138 /* If there's no more events, SIGIO should be next wake-up */
139 if (waitfor != -1)
140 {
141#ifdef DEBUG
142 (void) fprintf(stderr,
143 "Setting %d-second alarm\n", waitfor);
144#endif /* DEBUG */
145 (void)alarm(waitfor);
96 } 146 }
97 }
98 /* if the array is full to mevent, slot should be the next available spot */
99 if (slot > (mevent = newmax)) slot = mevent;
100 /* If there's no more events, SIGIO should be next wake-up */
101 if (mevent) (void)setitimer(ITIMER_REAL, &itimer, (struct itimerval *)NULL);
102} 147}
103 148
104void 149void
105getevent() 150getevent()
151{
152 extern char *fgets();
153 struct event *ep;
154 char buf[BUFSIZ];
155
156 /* in principle the itimer should be disabled on entry to this function,
157 but it really doesn't make any important difference if it isn't */
158
159 if (fgets(buf, sizeof(buf), stdin) == NULL)
160 exit(0);
161
162 /* register the event */
163 schedule(buf);
106 164
165 /* Who knows what this interrupted, or if it said "now"? */
166 notify();
167}
168
169void
170sigcatch(sig)
171/* dispatch on incoming signal, then restore it */
107{ 172{
108 extern char *fgets(); 173 struct event *ep;
109 struct event *ep; 174
110 char buf[256]; 175 switch(sig)
111 176 {
112 /* in principle the itimer should be disabled on entry to this function, 177 case SIGALRM:
113 but it really doesn't make any important difference if it isn't */ 178#ifdef DEBUG
114 179 (void) fprintf(stderr, "Alarm signal received\n");
115 if (fgets(buf, sizeof(buf), stdin) == NULL) exit(0); 180#endif /* DEBUG */
116 181 notify();
117 if (slot == MAXEVENTS) 182 break;
118 (void)fprintf(stderr, "%s: too many events: %s", pname, buf); 183 case SIGIO:
119 184 getevent();
120 else { 185 break;
121 if ((events[slot] = (struct event *)malloc((sizeof(struct event)))) 186 case SIGTERM:
122 == NULL) 187 (void) fprintf(stderr, "Events still queued:\n");
123 (void)fprintf(stderr,"%s: malloc %s: %s", pname, sys_errlist[errno],buf); 188 for (ep = events; ep < events + MAXEVENTS; ep++)
124 189 if (ep->token)
125 else { 190 (void) fprintf(stderr, "%d = %ld @ %s",
126 if ((ep = schedule(buf)) == NULL) 191 ep - events, ep->reply_at, ep->token);
127 free((char *)events[slot]), events[slot] = 0; 192 exit(0);
128 193 break;
129 else { 194 }
130 memcpy((char *)events[slot],(char *)ep,sizeof(struct event)); 195
131 if (slot == mevent) mevent++; 196 /* required on older UNIXes; harmless on newer ones */
132 } /* schedule */ 197 (void) signal(sig, sigcatch);
133 } /* malloc */
134 } /* limit events */
135 /* timing, timing. Who knows what this interrupted, or if it said "now"? */
136 notify();
137} 198}
138 199
139/*ARGSUSED*/ 200/*ARGSUSED*/
140int 201int
141main(argc, argv) 202main(argc, argv)
142 int argc; 203 int argc;
143 char **argv; 204 char **argv;
144
145{ 205{
146 for (pname = argv[0] + strlen(argv[0]); *pname != '/' && pname != argv[0]; 206 for (pname = argv[0] + strlen(argv[0]); *pname != '/' && pname != argv[0];
147 pname--); 207 pname--);
148 if (*pname == '/') pname++; 208 if (*pname == '/') pname++;
149 209
150 (void)signal(SIGIO, getevent); 210 (void)signal(SIGIO, sigcatch);
151 (void)signal(SIGALRM, notify); 211 (void)signal(SIGALRM, sigcatch);
212 (void)signal(SIGTERM, sigcatch);
213
214#ifndef USG
152 (void)fcntl(0, F_SETFL, FASYNC); 215 (void)fcntl(0, F_SETFL, FASYNC);
216#endif /* USG */
153 217
154 while (1) pause(); 218 while (1) pause();
155} 219}
220
221/* timer.c ends here */
diff --git a/lisp/diary-lib.el b/lisp/diary-lib.el
index 0cf7c0769d6..a77be71cdf0 100644
--- a/lisp/diary-lib.el
+++ b/lisp/diary-lib.el
@@ -1,9 +1,9 @@
1;;; diary.el --- diary functions. 1;;; diary.el --- diary functions.
2 2
3;; Copyright (C) 1989, 1990 Free Software Foundation, Inc. 3;; Copyright (C) 1989, 1990, 1992 Free Software Foundation, Inc.
4 4
5;; Author: Edward M. Reingold <reingold@cs.uiuc.edu> 5;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
6;; Keyword: calendar 6;; Keywords: diary, calendar
7 7
8;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
9 9
@@ -76,11 +76,33 @@ calendar."
76(autoload 'check-calendar-holidays "holidays" 76(autoload 'check-calendar-holidays "holidays"
77 "Check the list of holidays for any that occur on DATE. 77 "Check the list of holidays for any that occur on DATE.
78The value returned is a list of strings of relevant holiday descriptions. 78The value returned is a list of strings of relevant holiday descriptions.
79The holidays are those in the list calendar-holidays.") 79The holidays are those in the list calendar-holidays."
80 t)
81
80 82
81(autoload 'calendar-holiday-list "holidays" 83(autoload 'calendar-holiday-list "holidays"
82 "Form the list of holidays that occur on dates in the calendar window. 84 "Form the list of holidays that occur on dates in the calendar window.
83The holidays are those in the list calendar-holidays.") 85The holidays are those in the list calendar-holidays."
86 t)
87
88(autoload 'diary-french-date "cal-french"
89 "French calendar equivalent of date diary entry."
90 t)
91
92(autoload 'diary-mayan-date "cal-mayan"
93 "Mayan calendar equivalent of date diary entry."
94 t)
95
96(autoload 'diary-phases-of-moon "lunar" "Moon phases diary entry." t)
97
98(autoload 'diary-sunrise-sunset "solar"
99 "Local time of sunrise and sunset as a diary entry."
100 t)
101
102(autoload 'diary-sabbath-candles "solar"
103 "Local time of candle lighting diary entry--applies if date is a Friday.
104No diary entry if there is no sunset on that date."
105 t)
84 106
85(defvar diary-syntax-table 107(defvar diary-syntax-table
86 (standard-syntax-table) 108 (standard-syntax-table)
@@ -100,7 +122,7 @@ Makes all diary entries in the diary file invisible (using selective display),
100Returns a list of all relevant diary entries found, if any, in order by date. 122Returns a list of all relevant diary entries found, if any, in order by date.
101The list entries have the form ((month day year) string). If the variable 123The list entries have the form ((month day year) string). If the variable
102`diary-list-include-blanks' is t, this list will include a dummy diary entry 124`diary-list-include-blanks' is t, this list will include a dummy diary entry
103\(consisting of the empty string\) for a date with no diary entries. 125(consisting of the empty string) for a date with no diary entries.
104 126
105After the list is prepared, the hooks `nongregorian-diary-listing-hook', 127After the list is prepared, the hooks `nongregorian-diary-listing-hook',
106`list-diary-entries-hook', and `diary-display-hook' are run. These hooks 128`list-diary-entries-hook', and `diary-display-hook' are run. These hooks
@@ -273,8 +295,7 @@ changing the variable `diary-include-string'."
273 (message msg) 295 (message msg)
274 (set-buffer (get-buffer-create holiday-buffer)) 296 (set-buffer (get-buffer-create holiday-buffer))
275 (setq buffer-read-only nil) 297 (setq buffer-read-only nil)
276 (setq mode-line-format 298 (calendar-set-mode-line date-string)
277 (format "--------------------------%s%%-" date-string))
278 (erase-buffer) 299 (erase-buffer)
279 (insert (mapconcat 'identity holiday-list "\n")) 300 (insert (mapconcat 'identity holiday-list "\n"))
280 (goto-char (point-min)) 301 (goto-char (point-min))
@@ -282,13 +303,10 @@ changing the variable `diary-include-string'."
282 (setq buffer-read-only t) 303 (setq buffer-read-only t)
283 (display-buffer holiday-buffer) 304 (display-buffer holiday-buffer)
284 (message "No diary entries for %s" date-string)) 305 (message "No diary entries for %s" date-string))
285 (setq mode-line-format 306 (calendar-set-mode-line
286 (format "%%*--%sDiary %s %s%s%s%%-" 307 (concat "Diary for " date-string
287 (if holiday-list "" "---------------") 308 (if holiday-list ": " "")
288 (if holiday-list "for" "entries for") 309 (mapconcat 'identity holiday-list "; ")))
289 date-string
290 (if holiday-list ": " "")
291 (mapconcat 'identity holiday-list "; ")))
292 (display-buffer (get-file-buffer d-file)) 310 (display-buffer (get-file-buffer d-file))
293 (message "Preparing diary...done")))) 311 (message "Preparing diary...done"))))
294 312
@@ -307,8 +325,7 @@ This function is provided for optional use as the `list-diary-entries-hook'."
307 (message msg) 325 (message msg)
308 (set-buffer (get-buffer-create holiday-buffer)) 326 (set-buffer (get-buffer-create holiday-buffer))
309 (setq buffer-read-only nil) 327 (setq buffer-read-only nil)
310 (setq mode-line-format 328 (calendar-set-mode-line date-string)
311 (format "--------------------------%s%%-" date-string))
312 (erase-buffer) 329 (erase-buffer)
313 (insert (mapconcat 'identity holiday-list "\n")) 330 (insert (mapconcat 'identity holiday-list "\n"))
314 (goto-char (point-min)) 331 (goto-char (point-min))
@@ -327,7 +344,7 @@ This function is provided for optional use as the `list-diary-entries-hook'."
327 (set-buffer (get-buffer-create fancy-diary-buffer)) 344 (set-buffer (get-buffer-create fancy-diary-buffer))
328 (setq buffer-read-only nil) 345 (setq buffer-read-only nil)
329 (make-local-variable 'mode-line-format) 346 (make-local-variable 'mode-line-format)
330 (setq mode-line-format "---------------------------Diary Entries%-") 347 (calendar-set-mode-line "Diary Entries")
331 (erase-buffer) 348 (erase-buffer)
332 (let ((entry-list diary-entries-list) 349 (let ((entry-list diary-entries-list)
333 (holiday-list) 350 (holiday-list)
@@ -386,38 +403,44 @@ This function is provided for optional use as the `list-diary-entries-hook'."
386 (message "Preparing diary...done")))) 403 (message "Preparing diary...done"))))
387 404
388(defun print-diary-entries () 405(defun print-diary-entries ()
389 "Print a hard copy of the entries visible in the diary window. 406 "Print a hard copy of the diary display.
390The hooks given by the variable `print-diary-entries-hook' are called after 407
391the temporary buffer of visible diary entries is prepared; it is the hooks 408If the simple diary display is being used, prepare a temp buffer with the
392that do the actual printing and kill the buffer." 409visible lines of the diary buffer, add a heading line composed from the mode
410line, print the temp buffer, and destroy it.
411
412If the fancy diary display is being used, just print the buffer.
413
414The hooks given by the variable `print-diary-entries-hook' are called to do
415the actual printing."
393 (interactive) 416 (interactive)
394 (let ((diary-buffer (get-file-buffer (substitute-in-file-name diary-file)))) 417 (if (bufferp (get-buffer fancy-diary-buffer))
395 (if diary-buffer 418 (save-excursion
396 (let ((temp-buffer (get-buffer-create "*Printable Diary Entries*"))) 419 (set-buffer (get-buffer fancy-diary-buffer))
397 (save-excursion 420 (run-hooks 'print-diary-entries-hook))
398 (set-buffer diary-buffer) 421 (let ((diary-buffer
399 (copy-to-buffer temp-buffer (point-min) (point-max)) 422 (get-file-buffer (substitute-in-file-name diary-file))))
400 (set-buffer temp-buffer) 423 (if diary-buffer
401 (while (re-search-forward "\^M.*$" nil t) 424 (let ((temp-buffer (get-buffer-create "*Printable Diary Entries*"))
402 (replace-match "")) 425 (heading))
403 (run-hooks 'print-diary-entries-hook))) 426 (save-excursion
404 (error "You don't have a diary buffer!")))) 427 (set-buffer diary-buffer)
405 428 (setq heading
406(defun add-diary-heading () 429 (if (not (stringp mode-line-format))
407 "Add a heading to the diary entries for printing. 430 "All Diary Entries"
408The heading is formed from the mode line of the diary buffer. This function 431 (string-match "^-*\\([^-].*[^-]\\)-*$" mode-line-format)
409is used in the default value of the variable `print-diary-entry-hooks'." 432 (substring mode-line-format
410 (save-excursion 433 (match-beginning 1) (match-end 1))))
411 (let ((heading)) 434 (copy-to-buffer temp-buffer (point-min) (point-max))
412 (set-buffer diary-buffer) 435 (set-buffer temp-buffer)
413 (setq heading mode-line-format) 436 (while (re-search-forward "\^M.*$" nil t)
414 (string-match "%\\*-*\\([^-].*\\)%-$" heading) 437 (replace-match ""))
415 (setq heading 438 (goto-char (point-min))
416 (substring heading (match-beginning 1) (match-end 1))) 439 (insert heading "\n"
417 (set-buffer temp-buffer) 440 (make-string (length heading) ?=) "\n")
418 (goto-char (point-min)) 441 (run-hooks 'print-diary-entries-hook)
419 (insert heading "\n" 442 (kill-buffer temp-buffer)))
420 (make-string (length heading) ?=) "\n")))) 443 (error "You don't have a diary buffer!")))))
421 444
422(defun show-all-diary-entries () 445(defun show-all-diary-entries ()
423 "Show all of the diary entries in the diary-file. 446 "Show all of the diary entries in the diary-file.
@@ -438,8 +461,7 @@ is created."
438 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t) 461 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)
439 (setq selective-display nil) 462 (setq selective-display nil)
440 (make-local-variable 'mode-line-format) 463 (make-local-variable 'mode-line-format)
441 (setq mode-line-format 464 (setq mode-line-format default-mode-line-format)
442 "%*---------------------------All Diary Entries%-")
443 (display-buffer (current-buffer)) 465 (display-buffer (current-buffer))
444 (set-buffer-modified-p diary-modified)))) 466 (set-buffer-modified-p diary-modified))))
445 (error "Your diary file is not readable!")) 467 (error "Your diary file is not readable!"))
@@ -718,6 +740,10 @@ A value of 0 in any position of the pattern is a wild-card."
718 (mark-visible-calendar-date (list month i year))) 740 (mark-visible-calendar-date (list month i year)))
719 (mark-visible-calendar-date (list month p-day year))))) 741 (mark-visible-calendar-date (list month p-day year)))))
720 742
743(defun sort-diary-entries ()
744 "Sort the list of diary entries by time of day."
745 (setq diary-entries-list (sort diary-entries-list 'diary-entry-compare)))
746
721(defun diary-entry-compare (e1 e2) 747(defun diary-entry-compare (e1 e2)
722 "Returns t if E1 is earlier than E2." 748 "Returns t if E1 is earlier than E2."
723 (or (calendar-date-compare e1 e2) 749 (or (calendar-date-compare e1 e2)
@@ -757,7 +783,7 @@ and XX:XXam or XX:XXpm."
757(defun list-hebrew-diary-entries () 783(defun list-hebrew-diary-entries ()
758 "Add any Hebrew date entries from the diary-file to diary-entries-list. 784 "Add any Hebrew date entries from the diary-file to diary-entries-list.
759Hebrew date diary entries must be prefaced by a hebrew-diary-entry-symbol 785Hebrew date diary entries must be prefaced by a hebrew-diary-entry-symbol
760\(normally an `H'\). The same diary-date-forms govern the style of the Hebrew 786(normally an `H'). The same diary-date-forms govern the style of the Hebrew
761calendar entries, except that the Hebrew month names must be spelled in full. 787calendar entries, except that the Hebrew month names must be spelled in full.
762The Hebrew months are numbered from 1 to 13 with Nisan being 1, 12 being 788The Hebrew months are numbered from 1 to 13 with Nisan being 1, 12 being
763Adar I and 13 being Adar II; you must use `Adar I' if you want Adar of a 789Adar I and 13 being Adar II; you must use `Adar I' if you want Adar of a
@@ -841,7 +867,7 @@ nongregorian-diary-listing-hook."
841 "Mark days in the calendar window that have Hebrew date diary entries. 867 "Mark days in the calendar window that have Hebrew date diary entries.
842Each entry in diary-file (or included files) visible in the calendar window 868Each entry in diary-file (or included files) visible in the calendar window
843is marked. Hebrew date entries are prefaced by a hebrew-diary-entry-symbol 869is marked. Hebrew date entries are prefaced by a hebrew-diary-entry-symbol
844\(normally an `H'\). The same diary-date-forms govern the style of the Hebrew 870(normally an `H'). The same diary-date-forms govern the style of the Hebrew
845calendar entries, except that the Hebrew month names must be spelled in full. 871calendar entries, except that the Hebrew month names must be spelled in full.
846The Hebrew months are numbered from 1 to 13 with Nisan being 1, 12 being 872The Hebrew months are numbered from 1 to 13 with Nisan being 1, 12 being
847Adar I and 13 being Adar II; you must use `Adar I' if you want Adar of a 873Adar I and 13 being Adar II; you must use `Adar I' if you want Adar of a
@@ -1104,6 +1130,28 @@ A number of built-in functions are available for this type of diary entry:
1104 made every day. Note that since there is no text, it 1130 made every day. Note that since there is no text, it
1105 makes sense only if the fancy diary display is used. 1131 makes sense only if the fancy diary display is used.
1106 1132
1133 %%(diary-astro-day-number) Diary entries giving the corresponding
1134 astronomical (Julian) day number will be made every day.
1135 Note that since there is no text, it makes sense only if the
1136 fancy diary display is used.
1137
1138 %%(diary-julian-date) Diary entries giving the corresponding
1139 Julian date will be made every day. Note that since
1140 there is no text, it makes sense only if the fancy diary
1141 display is used.
1142
1143 %%(diary-sunrise-sunset)
1144 Diary entries giving the local times of sunrise and sunset
1145 will be made every day. Note that since there is no text,
1146 it makes sense only if the fancy diary display is used.
1147 Floating point required.
1148
1149 %%(diary-phases-of-moon)
1150 Diary entries giving the times of the phases of the moon
1151 will be when appropriate. Note that since there is no text,
1152 it makes sense only if the fancy diary display is used.
1153 Floating point required.
1154
1107 %%(diary-yahrzeit MONTH DAY YEAR) text 1155 %%(diary-yahrzeit MONTH DAY YEAR) text
1108 Text is assumed to be the name of the person; the date is 1156 Text is assumed to be the name of the person; the date is
1109 the date of death on the *civil* calendar. The diary entry 1157 the date of death on the *civil* calendar. The diary entry
@@ -1111,6 +1159,12 @@ A number of built-in functions are available for this type of diary entry:
1111 day before. (If `european-calendar-style' is t, the order 1159 day before. (If `european-calendar-style' is t, the order
1112 of the parameters should be changed to DAY, MONTH, YEAR.) 1160 of the parameters should be changed to DAY, MONTH, YEAR.)
1113 1161
1162 %%(diary-sunrise-sunset)
1163 Diary entries giving the local times of Sabbath candle
1164 lighting will be made every day. Note that since there is
1165 no text, it makes sense only if the fancy diary display is
1166 used. Floating point required.
1167
1114 %%(diary-rosh-hodesh) 1168 %%(diary-rosh-hodesh)
1115 Diary entries will be made on the dates of Rosh Hodesh on 1169 Diary entries will be made on the dates of Rosh Hodesh on
1116 the Hebrew calendar. Note that since there is no text, it 1170 the Hebrew calendar. Note that since there is no text, it
@@ -1288,48 +1342,35 @@ ending of that number (that is, `st', `nd', `rd' or `th', as appropriate."
1288 1342
1289(defun diary-islamic-date () 1343(defun diary-islamic-date ()
1290 "Islamic calendar equivalent of date diary entry." 1344 "Islamic calendar equivalent of date diary entry."
1291 (let* ((calendar-date-display-form 1345 (let* ((i-date (calendar-islamic-from-absolute
1292 (if european-calendar-style
1293 '(day " " monthname " " year)
1294 '(monthname " " day ", " year)))
1295 (i-date (calendar-islamic-from-absolute
1296 (calendar-absolute-from-gregorian date))) 1346 (calendar-absolute-from-gregorian date)))
1297 (calendar-month-name-array calendar-islamic-month-name-array)) 1347 (calendar-month-name-array calendar-islamic-month-name-array))
1298 (if (>= (extract-calendar-year i-date) 1) 1348 (if (>= (extract-calendar-year i-date) 1)
1299 (format "Islamic date: %s" (calendar-date-string i-date))))) 1349 (format "Islamic date: %s" (calendar-date-string i-date nil t)))))
1300 1350
1301(defun diary-hebrew-date () 1351(defun diary-hebrew-date ()
1302 "Hebrew calendar equivalent of date diary entry." 1352 "Hebrew calendar equivalent of date diary entry."
1303 (let* ((calendar-date-display-form 1353 (let* ((h-date (calendar-hebrew-from-absolute
1304 (if european-calendar-style
1305 '(day " " monthname " " year)
1306 '(monthname " " day ", " year)))
1307 (h-date (calendar-hebrew-from-absolute
1308 (calendar-absolute-from-gregorian date))) 1354 (calendar-absolute-from-gregorian date)))
1309 (calendar-month-name-array 1355 (calendar-month-name-array
1310 (if (hebrew-calendar-leap-year-p 1356 (if (hebrew-calendar-leap-year-p
1311 (extract-calendar-year h-date)) 1357 (extract-calendar-year h-date))
1312 calendar-hebrew-month-name-array-leap-year 1358 calendar-hebrew-month-name-array-leap-year
1313 calendar-hebrew-month-name-array-common-year))) 1359 calendar-hebrew-month-name-array-common-year)))
1314 (format "Hebrew date: %s" (calendar-date-string h-date)))) 1360 (format "Hebrew date: %s" (calendar-date-string h-date nil t))))
1315 1361
1316(defun diary-french-date () 1362(defun diary-julian-date ()
1317 "French calendar equivalent of date diary entry." 1363 "Julian calendar equivalent of date diary entry."
1318 (let* ((french-date (calendar-french-from-absolute 1364 (format "Julian date: %s"
1319 (calendar-absolute-from-gregorian date))) 1365 (calendar-date-string
1320 (y (extract-calendar-year french-date)) 1366 (calendar-julian-from-absolute
1321 (m (extract-calendar-month french-date)) 1367 (calendar-absolute-from-gregorian date)))
1322 (d (extract-calendar-day french-date))) 1368 nil t))
1323 (if (> y 0) 1369
1324 (if (= m 13) 1370(defun diary-astro-day-number ()
1325 (format "Jour %s de l'Annee %d de la Revolution" 1371 "Astronomical (Julian) day number diary entry."
1326 (aref french-calendar-special-days-array (1- d)) 1372 (format "Astronomical (Julian) day number %d"
1327 y) 1373 (+ 1721425 (calendar-absolute-from-gregorian date))))
1328 (format "Decade %s, %s de %s de l'Annee %d de la Revolution"
1329 (make-string (1+ (/ (1- d) 10)) ?I)
1330 (aref french-calendar-day-name-array (% (1- d) 10))
1331 (aref french-calendar-month-name-array (1- m))
1332 y)))))
1333 1374
1334(defun diary-omer () 1375(defun diary-omer ()
1335 "Omer count diary entry--entry applies if date is within 50 days after 1376 "Omer count diary entry--entry applies if date is within 50 days after
@@ -1412,7 +1453,7 @@ before, or the Saturday before."
1412 (if (= h-yesterday 30) 1453 (if (= h-yesterday 30)
1413 (format "%s (second day)" this-month) 1454 (format "%s (second day)" this-month)
1414 this-month))) 1455 this-month)))
1415 (if (= (mod d 7) 6);; Saturday--check for Shabbat Mevarhim 1456 (if (= (% d 7) 6);; Saturday--check for Shabbat Mevarhim
1416 (cond ((and (> h-day 22) (/= h-month 6) (= 29 last-day)) 1457 (cond ((and (> h-day 22) (/= h-month 6) (= 29 last-day))
1417 (format "Mevarhim Rosh Hodesh %s (%s)" 1458 (format "Mevarhim Rosh Hodesh %s (%s)"
1418 (aref h-month-names 1459 (aref h-month-names
@@ -1428,7 +1469,7 @@ before, or the Saturday before."
1428 "tomorrow" 1469 "tomorrow"
1429 (aref calendar-day-name-array (- 29 h-day))) 1470 (aref calendar-day-name-array (- 29 h-day)))
1430 (aref calendar-day-name-array 1471 (aref calendar-day-name-array
1431 (mod (- 30 h-day) 7))))) 1472 (% (- 30 h-day) 7)))))
1432 (if (and (= h-day 29) (/= h-month 6)) 1473 (if (and (= h-day 29) (/= h-month 6))
1433 (format "Erev Rosh Hodesh %s" 1474 (format "Erev Rosh Hodesh %s"
1434 (aref h-month-names 1475 (aref h-month-names
@@ -1525,25 +1566,25 @@ start on Tuesday.")
1525 1566
1526(defconst hebrew-calendar-year-Monday-complete-Thursday 1567(defconst hebrew-calendar-year-Monday-complete-Thursday
1527 [51 52 nil 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 [21 22] 1568 [51 52 nil 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 [21 22]
1528 23 24 nil 25 [26 27] [28 29] 30 [31 32] 33 (nil . 34) (34.35) (35.36) 1569 23 24 nil 25 [26 27] [28 29] 30 [31 32] 33 (nil . 34) (34 . 35) (35 . 36)
1529 (36.37) (37.38) ([38 39].39) 40 [41 42] 43 44 45 46 47 48 49 [50 51]] 1570 (36 . 37) (37 . 38) ([38 39] . 39) 40 [41 42] 43 44 45 46 47 48 49 [50 51]]
1530 "The structure of the parashiot in a Hebrew year that starts on Monday, 1571 "The structure of the parashiot in a Hebrew year that starts on Monday,
1531is `complete' (Heshvan and Kislev each have 30 days), and has Passover 1572is `complete' (Heshvan and Kislev each have 30 days), and has Passover
1532start on Thursday.") 1573start on Thursday.")
1533 1574
1534(defconst hebrew-calendar-year-Tuesday-regular-Thursday 1575(defconst hebrew-calendar-year-Tuesday-regular-Thursday
1535 [51 52 nil 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 [21 22] 1576 [51 52 nil 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 [21 22]
1536 23 24 nil 25 [26 27] [28 29] 30 [31 32] 33 (nil . 34) (34.35) (35.36) 1577 23 24 nil 25 [26 27] [28 29] 30 [31 32] 33 (nil . 34) (34 . 35) (35 . 36)
1537 (36.37) (37.38) ([38 39].39) 40 [41 42] 43 44 45 46 47 48 49 [50 51]] 1578 (36 . 37) (37 . 38) ([38 39] . 39) 40 [41 42] 43 44 45 46 47 48 49 [50 51]]
1538 "The structure of the parashiot in a Hebrew year that starts on Tuesday, 1579 "The structure of the parashiot in a Hebrew year that starts on Tuesday,
1539is `regular' (Heshvan has 29 days and Kislev has 30 days), and has Passover 1580is `regular' (Heshvan has 29 days and Kislev has 30 days), and has Passover
1540start on Thursday.") 1581start on Thursday.")
1541 1582
1542(defconst hebrew-calendar-year-Thursday-regular-Saturday 1583(defconst hebrew-calendar-year-Thursday-regular-Saturday
1543 [52 nil nil 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 [21 22] 1584 [52 nil nil 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 [21 22] 23
1544 23 24 nil (nil . 25) (25.[26 27]) ([26 27].[28 29]) ([28 29].30) (30.31) 1585 24 nil (nil . 25) (25 . [26 27]) ([26 27] . [28 29]) ([28 29] . 30)
1545 ([31 32].32) 33 34 35 36 37 38 39 40 [41 42] 1586 (30 . 31) ([31 32] . 32) 33 34 35 36 37 38 39 40 [41 42] 43 44 45 46 47 48
1546 43 44 45 46 47 48 49 50] 1587 49 50]
1547 "The structure of the parashiot in a Hebrew year that starts on Thursday, 1588 "The structure of the parashiot in a Hebrew year that starts on Thursday,
1548is `regular' (Heshvan has 29 days and Kislev has 30 days), and has Passover 1589is `regular' (Heshvan has 29 days and Kislev has 30 days), and has Passover
1549start on Saturday.") 1590start on Saturday.")
@@ -1568,34 +1609,34 @@ start on Tuesday.")
1568 1609
1569(defconst hebrew-calendar-year-Saturday-complete-Thursday 1610(defconst hebrew-calendar-year-Saturday-complete-Thursday
1570 [nil 52 nil nil 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1611 [nil 52 nil nil 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
1571 23 24 25 26 27 nil 28 29 30 31 32 33 (nil . 34) (34.35) (35.36) (36.37) 1612 23 24 25 26 27 nil 28 29 30 31 32 33 (nil . 34) (34 . 35) (35 . 36)
1572 (37.38) ([38 39].39) 40 [41 42] 43 44 45 46 47 48 49 [50 51]] 1613 (36 . 37) (37 . 38) ([38 39] . 39) 40 [41 42] 43 44 45 46 47 48 49 [50 51]]
1573 "The structure of the parashiot in a Hebrew year that starts on Saturday, 1614 "The structure of the parashiot in a Hebrew year that starts on Saturday,
1574is `complete' (Heshvan and Kislev each have 30 days), and has Passover 1615is `complete' (Heshvan and Kislev each have 30 days), and has Passover
1575start on Thursday.") 1616start on Thursday.")
1576 1617
1577(defconst hebrew-calendar-year-Monday-incomplete-Thursday 1618(defconst hebrew-calendar-year-Monday-incomplete-Thursday
1578 [51 52 nil 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1619 [51 52 nil 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
1579 23 24 25 26 27 nil 28 29 30 31 32 33 (nil . 34) (34.35) (35.36) (36.37) 1620 23 24 25 26 27 nil 28 29 30 31 32 33 (nil . 34) (34 . 35) (35 . 36)
1580 (37.38) ([38 39].39) 40 [41 42] 43 44 45 46 47 48 49 [50 51]] 1621 (36 . 37) (37 . 38) ([38 39] . 39) 40 [41 42] 43 44 45 46 47 48 49 [50 51]]
1581 "The structure of the parashiot in a Hebrew year that starts on Monday, 1622 "The structure of the parashiot in a Hebrew year that starts on Monday,
1582is `incomplete' (Heshvan and Kislev each have 29 days), and has Passover 1623is `incomplete' (Heshvan and Kislev each have 29 days), and has Passover
1583start on Thursday.") 1624start on Thursday.")
1584 1625
1585(defconst hebrew-calendar-year-Monday-complete-Saturday 1626(defconst hebrew-calendar-year-Monday-complete-Saturday
1586 [51 52 nil 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1627 [51 52 nil 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
1587 23 24 25 26 27 nil (nil . 28) (28.29) (29.30) (30.31) (31.32) (32.33) 1628 23 24 25 26 27 nil (nil . 28) (28 . 29) (29 . 30) (30 . 31) (31 . 32)
1588 (33.34) (34.35) (35.36) (36.37) (37.38) (38.39) (39.40) (40.41) ([41 42].42) 1629 (32 . 33) (33 . 34) (34 . 35) (35 . 36) (36 . 37) (37 . 38) (38 . 39)
1589 43 44 45 46 47 48 49 50] 1630 (39 . 40) (40 . 41) ([41 42] . 42) 43 44 45 46 47 48 49 50]
1590 "The structure of the parashiot in a Hebrew year that starts on Monday, 1631 "The structure of the parashiot in a Hebrew year that starts on Monday,
1591is `complete' (Heshvan and Kislev each have 30 days), and has Passover 1632is `complete' (Heshvan and Kislev each have 30 days), and has Passover
1592start on Saturday.") 1633start on Saturday.")
1593 1634
1594(defconst hebrew-calendar-year-Tuesday-regular-Saturday 1635(defconst hebrew-calendar-year-Tuesday-regular-Saturday
1595 [51 52 nil 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1636 [51 52 nil 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
1596 23 24 25 26 27 nil (nil . 28) (28.29) (29.30) (30.31) (31.32) (32.33) 1637 23 24 25 26 27 nil (nil . 28) (28 . 29) (29 . 30) (30 . 31) (31 . 32)
1597 (33.34) (34.35) (35.36) (36.37) (37.38) (38.39) (39.40) (40.41) ([41 42].42) 1638 (32 . 33) (33 . 34) (34 . 35) (35 . 36) (36 . 37) (37 . 38) (38 . 39)
1598 43 44 45 46 47 48 49 50] 1639 (39 . 40) (40 . 41) ([41 42] . 42) 43 44 45 46 47 48 49 50]
1599 "The structure of the parashiot in a Hebrew year that starts on Tuesday, 1640 "The structure of the parashiot in a Hebrew year that starts on Tuesday,
1600is `regular' (Heshvan has 29 days and Kislev has 30 days), and has Passover 1641is `regular' (Heshvan has 29 days and Kislev has 30 days), and has Passover
1601start on Saturday.") 1642start on Saturday.")
@@ -1627,7 +1668,7 @@ start on Tuesday.")
1627(defun list-islamic-diary-entries () 1668(defun list-islamic-diary-entries ()
1628 "Add any Islamic date entries from the diary-file to diary-entries-list. 1669 "Add any Islamic date entries from the diary-file to diary-entries-list.
1629Islamic date diary entries must be prefaced by an islamic-diary-entry-symbol 1670Islamic date diary entries must be prefaced by an islamic-diary-entry-symbol
1630\(normally an `I'\). The same diary-date-forms govern the style of the Islamic 1671(normally an `I'). The same diary-date-forms govern the style of the Islamic
1631calendar entries, except that the Islamic month names must be spelled in full. 1672calendar entries, except that the Islamic month names must be spelled in full.
1632The Islamic months are numbered from 1 to 12 with Muharram being 1 and 12 being 1673The Islamic months are numbered from 1 to 12 with Muharram being 1 and 12 being
1633Dhu al-Hijjah. If an Islamic date diary entry begins with a 1674Dhu al-Hijjah. If an Islamic date diary entry begins with a
@@ -1710,7 +1751,7 @@ nongregorian-diary-listing-hook."
1710 "Mark days in the calendar window that have Islamic date diary entries. 1751 "Mark days in the calendar window that have Islamic date diary entries.
1711Each entry in diary-file (or included files) visible in the calendar window 1752Each entry in diary-file (or included files) visible in the calendar window
1712is marked. Islamic date entries are prefaced by a islamic-diary-entry-symbol 1753is marked. Islamic date entries are prefaced by a islamic-diary-entry-symbol
1713\(normally an `I'\). The same diary-date-forms govern the style of the Islamic 1754(normally an `I'). The same diary-date-forms govern the style of the Islamic
1714calendar entries, except that the Islamic month names must be spelled in full. 1755calendar entries, except that the Islamic month names must be spelled in full.
1715The Islamic months are numbered from 1 to 12 with Muharram being 1 and 12 being 1756The Islamic months are numbered from 1 to 12 with Muharram being 1 and 12 being
1716Dhu al-Hijjah. Islamic date diary entries that begin with a 1757Dhu al-Hijjah. Islamic date diary entries that begin with a
@@ -1870,246 +1911,6 @@ MONTH/DAY/YEAR. A value of 0 in any position is a wild-card."
1870 (mark-visible-calendar-date 1911 (mark-visible-calendar-date
1871 (calendar-gregorian-from-absolute date))))))))) 1912 (calendar-gregorian-from-absolute date)))))))))
1872 1913
1873(defun make-diary-entry (string &optional nonmarking file)
1874 "Insert a diary entry STRING which may be NONMARKING in FILE.
1875If omitted, NONMARKING defaults to nil and FILE defaults to diary-file."
1876 (find-file-other-window
1877 (substitute-in-file-name (if file file diary-file)))
1878 (goto-char (point-max))
1879 (insert
1880 (if (bolp) "" "\n")
1881 (if nonmarking diary-nonmarking-symbol "")
1882 string " "))
1883
1884(defun insert-diary-entry (arg)
1885 "Insert a diary entry for the date indicated by point.
1886Prefix arg will make the entry nonmarking."
1887 (interactive "P")
1888 (let* ((calendar-date-display-form
1889 (if european-calendar-style
1890 '(day " " monthname " " year)
1891 '(monthname " " day ", " year))))
1892 (make-diary-entry
1893 (calendar-date-string
1894 (or (calendar-cursor-to-date)
1895 (error "Cursor is not on a date!"))
1896 t)
1897 arg)))
1898
1899(defun insert-weekly-diary-entry (arg)
1900 "Insert a weekly diary entry for the day of the week indicated by point.
1901Prefix arg will make the entry nonmarking."
1902 (interactive "P")
1903 (make-diary-entry
1904 (calendar-day-name
1905 (or (calendar-cursor-to-date)
1906 (error "Cursor is not on a date!")))
1907 arg))
1908
1909(defun insert-monthly-diary-entry (arg)
1910 "Insert a monthly diary entry for the day of the month indicated by point.
1911Prefix arg will make the entry nonmarking."
1912 (interactive "P")
1913 (let* ((calendar-date-display-form
1914 (if european-calendar-style
1915 '(day " * ")
1916 '("* " day))))
1917 (make-diary-entry
1918 (calendar-date-string
1919 (or (calendar-cursor-to-date)
1920 (error "Cursor is not on a date!"))
1921 t)
1922 arg)))
1923
1924(defun insert-yearly-diary-entry (arg)
1925 "Insert an annual diary entry for the day of the year indicated by point.
1926Prefix arg will make the entry nonmarking."
1927 (interactive "P")
1928 (let* ((calendar-date-display-form
1929 (if european-calendar-style
1930 '(day " " monthname)
1931 '(monthname " " day))))
1932 (make-diary-entry
1933 (calendar-date-string
1934 (or (calendar-cursor-to-date)
1935 (error "Cursor is not on a date!"))
1936 t)
1937 arg)))
1938
1939(defun insert-anniversary-diary-entry (arg)
1940 "Insert an anniversary diary entry for the date given by point.
1941Prefix arg will make the entry nonmarking."
1942 (interactive "P")
1943 (let* ((calendar-date-display-form
1944 (if european-calendar-style
1945 '(day " " month " " year)
1946 '(month " " day " " year))))
1947 (make-diary-entry
1948 (format "%s(diary-anniversary %s)"
1949 sexp-diary-entry-symbol
1950 (calendar-date-string
1951 (or (calendar-cursor-to-date)
1952 (error "Cursor is not on a date!"))))
1953 arg)))
1954
1955(defun insert-block-diary-entry (arg)
1956 "Insert a block diary entry for the days between the point and marked date.
1957Prefix arg will make the entry nonmarking."
1958 (interactive "P")
1959 (let* ((calendar-date-display-form
1960 (if european-calendar-style
1961 '(day " " month " " year)
1962 '(month " " day " " year)))
1963 (cursor (or (calendar-cursor-to-date)
1964 (error "Cursor is not on a date!")))
1965 (mark (or (car calendar-mark-ring)
1966 (error "No mark set in this buffer")))
1967 (start)
1968 (end))
1969 (if (< (calendar-absolute-from-gregorian mark)
1970 (calendar-absolute-from-gregorian cursor))
1971 (setq start mark
1972 end cursor)
1973 (setq start cursor
1974 end mark))
1975 (make-diary-entry
1976 (format "%s(diary-block %s %s)"
1977 sexp-diary-entry-symbol
1978 (calendar-date-string start)
1979 (calendar-date-string end))
1980 arg)))
1981
1982(defun insert-cyclic-diary-entry (arg)
1983 "Insert a cyclic diary entry starting at the date given by point.
1984Prefix arg will make the entry nonmarking."
1985 (interactive "P")
1986 (let* ((calendar-date-display-form
1987 (if european-calendar-style
1988 '(day " " month " " year)
1989 '(month " " day " " year))))
1990 (make-diary-entry
1991 (format "%s(diary-cyclic %d %s)"
1992 sexp-diary-entry-symbol
1993 (calendar-read "Repeat every how many days: "
1994 '(lambda (x) (> x 0)))
1995 (calendar-date-string
1996 (or (calendar-cursor-to-date)
1997 (error "Cursor is not on a date!"))))
1998 arg)))
1999
2000(defun insert-hebrew-diary-entry (arg)
2001 "Insert a diary entry for the Hebrew date corresponding to the date
2002indicated by point. Prefix arg will make the entry nonmarking."
2003 (interactive "P")
2004 (let* ((calendar-date-display-form
2005 (if european-calendar-style
2006 '(day " " monthname " " year)
2007 '(monthname " " day ", " year)))
2008 (calendar-month-name-array
2009 calendar-hebrew-month-name-array-leap-year))
2010 (make-diary-entry
2011 (concat
2012 hebrew-diary-entry-symbol
2013 (calendar-date-string
2014 (calendar-hebrew-from-absolute
2015 (calendar-absolute-from-gregorian
2016 (or (calendar-cursor-to-date)
2017 (error "Cursor is not on a date!"))))))
2018 arg)))
2019
2020(defun insert-monthly-hebrew-diary-entry (arg)
2021 "Insert a monthly diary entry for the day of the Hebrew month corresponding
2022to the date indicated by point. Prefix arg will make the entry nonmarking."
2023 (interactive "P")
2024 (let* ((calendar-date-display-form
2025 (if european-calendar-style '(day " * ") '("* " day )))
2026 (calendar-month-name-array
2027 calendar-hebrew-month-name-array-leap-year))
2028 (make-diary-entry
2029 (concat
2030 hebrew-diary-entry-symbol
2031 (calendar-date-string
2032 (calendar-hebrew-from-absolute
2033 (calendar-absolute-from-gregorian
2034 (or (calendar-cursor-to-date)
2035 (error "Cursor is not on a date!"))))))
2036 arg)))
2037
2038(defun insert-yearly-hebrew-diary-entry (arg)
2039 "Insert an annual diary entry for the day of the Hebrew year corresponding
2040to the date indicated by point. Prefix arg will make the entry nonmarking."
2041 (interactive "P")
2042 (let* ((calendar-date-display-form
2043 (if european-calendar-style
2044 '(day " " monthname)
2045 '(monthname " " day)))
2046 (calendar-month-name-array
2047 calendar-hebrew-month-name-array-leap-year))
2048 (make-diary-entry
2049 (concat
2050 hebrew-diary-entry-symbol
2051 (calendar-date-string
2052 (calendar-hebrew-from-absolute
2053 (calendar-absolute-from-gregorian
2054 (or (calendar-cursor-to-date)
2055 (error "Cursor is not on a date!"))))))
2056 arg)))
2057
2058(defun insert-islamic-diary-entry (arg)
2059 "Insert a diary entry for the Islamic date corresponding to the date
2060indicated by point. Prefix arg will make the entry nonmarking."
2061 (interactive "P")
2062 (let* ((calendar-date-display-form
2063 (if european-calendar-style
2064 '(day " " monthname " " year)
2065 '(monthname " " day ", " year)))
2066 (calendar-month-name-array calendar-islamic-month-name-array))
2067 (make-diary-entry
2068 (concat
2069 islamic-diary-entry-symbol
2070 (calendar-date-string
2071 (calendar-islamic-from-absolute
2072 (calendar-absolute-from-gregorian
2073 (or (calendar-cursor-to-date)
2074 (error "Cursor is not on a date!"))))))
2075 arg)))
2076
2077(defun insert-monthly-islamic-diary-entry (arg)
2078 "Insert a monthly diary entry for the day of the Islamic month corresponding
2079to the date indicated by point. Prefix arg will make the entry nonmarking."
2080 (interactive "P")
2081 (let* ((calendar-date-display-form
2082 (if european-calendar-style '(day " * ") '("* " day )))
2083 (calendar-month-name-array calendar-islamic-month-name-array))
2084 (make-diary-entry
2085 (concat
2086 islamic-diary-entry-symbol
2087 (calendar-date-string
2088 (calendar-islamic-from-absolute
2089 (calendar-absolute-from-gregorian
2090 (or (calendar-cursor-to-date)
2091 (error "Cursor is not on a date!"))))))
2092 arg)))
2093
2094(defun insert-yearly-islamic-diary-entry (arg)
2095 "Insert an annual diary entry for the day of the Islamic year corresponding
2096to the date indicated by point. Prefix arg will make the entry nonmarking."
2097 (interactive "P")
2098 (let* ((calendar-date-display-form
2099 (if european-calendar-style
2100 '(day " " monthname)
2101 '(monthname " " day)))
2102 (calendar-month-name-array calendar-islamic-month-name-array))
2103 (make-diary-entry
2104 (concat
2105 islamic-diary-entry-symbol
2106 (calendar-date-string
2107 (calendar-islamic-from-absolute
2108 (calendar-absolute-from-gregorian
2109 (or (calendar-cursor-to-date)
2110 (error "Cursor is not on a date!"))))))
2111 arg)))
2112
2113(provide 'diary) 1914(provide 'diary)
2114 1915
2115;;; diary.el ends here 1916;;; diary.el ends here
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index e878f5dea5f..6e7886e70bc 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -8,7 +8,9 @@
8 8
9;; Subsequently modified by RMS. 9;; Subsequently modified by RMS.
10 10
11(defconst byte-compile-version "FSF 2.1") 11;;; This version incorporates changes up to version 2.08 of the
12;;; Zawinski-Furuseth compiler.
13(defconst byte-compile-version "FSF 2.08")
12 14
13;; This file is part of GNU Emacs. 15;; This file is part of GNU Emacs.
14 16
@@ -95,9 +97,13 @@
95;;; generic emacs 18. 97;;; generic emacs 18.
96;;; byte-compile-single-version Normally the byte-compiler will consult the 98;;; byte-compile-single-version Normally the byte-compiler will consult the
97;;; above two variables at runtime, but if this 99;;; above two variables at runtime, but if this
98;;; variable is true when the compiler itself is 100;;; is true before the compiler itself is loaded/
99;;; compiled, then the runtime checks will not be 101;;; compiled, then the runtime checks will not be
100;;; made, and compilation will be slightly faster. 102;;; made, and compilation will be slightly faster.
103;;; To use this, start up a fresh emacs, set this
104;;; to t, reload the compiler's .el files, and
105;;; recompile. Don't do this in an emacs that has
106;;; already had the compiler loaded.
101;;; byte-compile-overwrite-file If nil, delete old .elc files before saving. 107;;; byte-compile-overwrite-file If nil, delete old .elc files before saving.
102 108
103;;; New Features: 109;;; New Features:
@@ -242,19 +248,17 @@ If it is 'byte, then only byte-level optimizations will be logged.")
242of `message.'") 248of `message.'")
243 249
244(defconst byte-compile-warning-types '(redefine callargs free-vars unresolved)) 250(defconst byte-compile-warning-types '(redefine callargs free-vars unresolved))
245(defvar byte-compile-warnings (not noninteractive) 251(defvar byte-compile-warnings t
246 "*List of warnings that the byte-compiler should issue (t for all). 252 "*List of warnings that the byte-compiler should issue (t for all).
247Valid elements of this list are: 253Elements of the list may be be:
248`free-vars' (references to variables not in the 254
249 current lexical scope) 255 free-vars references to variables not in the current lexical scope.
250`unresolved' (calls to unknown functions) 256 unresolved calls to unknown functions.
251`callargs' (lambda calls with args that don't 257 callargs lambda calls with args that don't match the definition.
252 match the lambda's definition) 258 redefine function cell redefined from a macro to a lambda or vice
253`redefine' (function cell redefined from 259 versa, or redefined to take a different number of arguments.
254 a macro to a lambda or vice versa, 260
255 or redefined to take other args) 261See also the macro byte-compiler-options.")
256This variable defaults to nil in -batch mode, which is
257slightly faster.")
258 262
259(defvar byte-compile-generate-call-tree nil 263(defvar byte-compile-generate-call-tree nil
260 "*Non-nil means collect call-graph information when compiling. 264 "*Non-nil means collect call-graph information when compiling.
@@ -388,7 +392,7 @@ Each element is (INDEX . VALUE)")
388(byte-defop 24 -1 byte-varbind "for binding a variable") 392(byte-defop 24 -1 byte-varbind "for binding a variable")
389(byte-defop 32 0 byte-call "for calling a function") 393(byte-defop 32 0 byte-call "for calling a function")
390(byte-defop 40 0 byte-unbind "for unbinding special bindings") 394(byte-defop 40 0 byte-unbind "for unbinding special bindings")
391;; codes 41-47 are consumed by the preceeding opcodes 395;; codes 8-47 are consumed by the preceeding opcodes
392 396
393;; unused: 48-55 397;; unused: 48-55
394 398
@@ -684,7 +688,7 @@ otherwise pop it")
684 688
685(defconst byte-compile-last-warned-form nil) 689(defconst byte-compile-last-warned-form nil)
686 690
687(defun byte-compile-log-1 (string) 691(defun byte-compile-log-1 (string &optional fill)
688 (cond (noninteractive 692 (cond (noninteractive
689 (if (or byte-compile-current-file 693 (if (or byte-compile-current-file
690 (and byte-compile-last-warned-form 694 (and byte-compile-last-warned-form
@@ -719,7 +723,12 @@ otherwise pop it")
719 (insert " in buffer " 723 (insert " in buffer "
720 (buffer-name byte-compile-current-file)))) 724 (buffer-name byte-compile-current-file))))
721 (insert ":\n"))) 725 (insert ":\n")))
722 (insert " " string "\n")))) 726 (insert " " string "\n")
727 (if (and fill (not (string-match "\n" string)))
728 (let ((fill-prefix " ")
729 (fill-column 78))
730 (fill-paragraph nil)))
731 )))
723 (setq byte-compile-current-file nil 732 (setq byte-compile-current-file nil
724 byte-compile-last-warned-form byte-compile-current-form)) 733 byte-compile-last-warned-form byte-compile-current-form))
725 734
@@ -727,7 +736,7 @@ otherwise pop it")
727 (setq format (apply 'format format args)) 736 (setq format (apply 'format format args))
728 (if byte-compile-error-on-warn 737 (if byte-compile-error-on-warn
729 (error "%s" format) ; byte-compile-file catches and logs it 738 (error "%s" format) ; byte-compile-file catches and logs it
730 (byte-compile-log-1 (concat "** " format)) 739 (byte-compile-log-1 (concat "** " format) t)
731;;; It is useless to flash warnings too fast to be read. 740;;; It is useless to flash warnings too fast to be read.
732;;; Besides, they will all be shown at the end. 741;;; Besides, they will all be shown at the end.
733;;; (or noninteractive ; already written on stdout. 742;;; (or noninteractive ; already written on stdout.
@@ -737,10 +746,11 @@ otherwise pop it")
737;;; This function should be used to report errors that have halted 746;;; This function should be used to report errors that have halted
738;;; compilation of the current file. 747;;; compilation of the current file.
739(defun byte-compile-report-error (error-info) 748(defun byte-compile-report-error (error-info)
740 (setq format (format (if (cdr error-info) "%s (%s)" "%s") 749 (byte-compile-log-1
741 (get (car error-info) 'error-message) 750 (concat "!! "
742 (prin1-to-string (cdr error-info)))) 751 (format (if (cdr error-info) "%s (%s)" "%s")
743 (byte-compile-log-1 (concat "!! " format))) 752 (get (car error-info) 'error-message)
753 (prin1-to-string (cdr error-info))))))
744 754
745;;; Used by make-obsolete. 755;;; Used by make-obsolete.
746(defun byte-compile-obsolete (form) 756(defun byte-compile-obsolete (form)
@@ -1036,26 +1046,49 @@ This is if a `.elc' file exists but is older than the `.el' file.
1036 1046
1037If the `.elc' file does not exist, normally the `.el' file is *not* compiled. 1047If the `.elc' file does not exist, normally the `.el' file is *not* compiled.
1038But a prefix argument (optional second arg) means ask user, 1048But a prefix argument (optional second arg) means ask user,
1039for each such `.el' file, whether to compile it." 1049for each such `.el' file, whether to compile it. Prefix argument 0 means
1050don't ask and compile the file anyway."
1040 (interactive "DByte recompile directory: \nP") 1051 (interactive "DByte recompile directory: \nP")
1041 (save-some-buffers) 1052 (save-some-buffers)
1042 (set-buffer-modified-p (buffer-modified-p)) ;Update the mode line. 1053 (set-buffer-modified-p (buffer-modified-p)) ;Update the mode line.
1043 (setq directory (expand-file-name directory)) 1054 (let ((directories (list (expand-file-name directory)))
1044 (let ((files (directory-files directory nil emacs-lisp-file-regexp)) 1055 (file-count 0)
1045 (count 0) 1056 (dir-count 0)
1046 source dest) 1057 last-dir)
1047 (while files 1058 (displaying-byte-compile-warnings
1048 (if (and (not (auto-save-file-name-p (car files))) 1059 (while directories
1049 (setq source (expand-file-name (car files) directory)) 1060 (setq directory (car directories))
1050 (setq dest (byte-compile-dest-file source)) 1061 (message "Checking %s..." directory)
1051 (if (file-exists-p dest) 1062 (let ((files (directory-files directory))
1052 (file-newer-than-file-p source dest) 1063 source dest)
1053 (and arg (y-or-n-p (concat "Compile " source "? "))))) 1064 (while files
1054 (progn (byte-compile-file source) 1065 (setq source (expand-file-name (car files) directory))
1055 (setq count (1+ count)))) 1066 (if (and (not (member (car files) '("." ".." "RCS" "CVS")))
1056 (setq files (cdr files))) 1067 (file-directory-p source))
1057 (message "Done (Total of %d file%s compiled)" 1068 (if (or (null arg)
1058 count (if (= count 1) "" "s")))) 1069 (eq arg 0)
1070 (y-or-n-p (concat "Check " source "? ")))
1071 (setq directories
1072 (nconc directories (list source))))
1073 (if (and (string-match emacs-lisp-file-regexp source)
1074 (not (auto-save-file-name-p source))
1075 (setq dest (byte-compile-dest-file source))
1076 (if (file-exists-p dest)
1077 (file-newer-than-file-p source dest)
1078 (and arg
1079 (or (zerop arg)
1080 (y-or-n-p (concat "Compile " source "? "))))))
1081 (progn (byte-compile-file source)
1082 (setq file-count (1+ file-count))
1083 (if (not (eq last-dir directory))
1084 (setq last-dir directory
1085 dir-count (1+ dir-count)))
1086 )))
1087 (setq files (cdr files))))
1088 (setq directories (cdr directories))))
1089 (message "Done (Total of %d file%s compiled%s)"
1090 file-count (if (= file-count 1) "" "s")
1091 (if (> dir-count 1) (format " in %d directories" dir-count) ""))))
1059 1092
1060;;;###autoload 1093;;;###autoload
1061(defun byte-compile-file (filename &optional load) 1094(defun byte-compile-file (filename &optional load)
@@ -1276,7 +1309,8 @@ With argument, insert value in current buffer after the form."
1276 (stringp (nth 3 form))) 1309 (stringp (nth 3 form)))
1277 (byte-compile-output-docform '("\n(" 3 ")") form) 1310 (byte-compile-output-docform '("\n(" 3 ")") form)
1278 (let ((print-escape-newlines t) 1311 (let ((print-escape-newlines t)
1279 (print-readably t)) 1312 (print-readably t) ; print #[] for bytecode, 'x for (quote x)
1313 (print-gensym nil)) ; this is too dangerous for now
1280 (princ "\n" outbuffer) 1314 (princ "\n" outbuffer)
1281 (prin1 form outbuffer) 1315 (prin1 form outbuffer)
1282 nil))) 1316 nil)))
@@ -1289,7 +1323,8 @@ With argument, insert value in current buffer after the form."
1289 (insert (car info)) 1323 (insert (car info))
1290 (let ((docl (nthcdr (nth 1 info) form)) 1324 (let ((docl (nthcdr (nth 1 info) form))
1291 (print-escape-newlines t) 1325 (print-escape-newlines t)
1292 (print-readably t)) 1326 (print-readably t) ; print #[] for bytecode, 'x for (quote x)
1327 (print-gensym nil)) ; this is too dangerous for now
1293 (prin1 (car form) outbuffer) 1328 (prin1 (car form) outbuffer)
1294 (while (setq form (cdr form)) 1329 (while (setq form (cdr form))
1295 (insert " ") 1330 (insert " ")
@@ -1813,6 +1848,8 @@ If FORM is a lambda or a macro, byte-compile it as a function."
1813 ((symbolp (car form)) 1848 ((symbolp (car form))
1814 (let* ((fn (car form)) 1849 (let* ((fn (car form))
1815 (handler (get fn 'byte-compile))) 1850 (handler (get fn 'byte-compile)))
1851 (if (memq fn '(t nil))
1852 (byte-compile-warn "%s called as a function" fn))
1816 (if (and handler 1853 (if (and handler
1817 (or (byte-compile-version-cond 1854 (or (byte-compile-version-cond
1818 byte-compile-compatibility) 1855 byte-compile-compatibility)
@@ -1846,6 +1883,12 @@ If FORM is a lambda or a macro, byte-compile it as a function."
1846 "Variable reference to %s %s") 1883 "Variable reference to %s %s")
1847 (if (symbolp var) "constant" "nonvariable") 1884 (if (symbolp var) "constant" "nonvariable")
1848 (prin1-to-string var)) 1885 (prin1-to-string var))
1886 (if (get var 'byte-obsolete-variable)
1887 (let ((ob (get var 'byte-obsolete-variable)))
1888 (byte-compile-warn "%s is an obsolete variable; %s" var
1889 (if (stringp ob)
1890 ob
1891 (format "use %s instead." ob)))))
1849 (if (memq 'free-vars byte-compile-warnings) 1892 (if (memq 'free-vars byte-compile-warnings)
1850 (if (eq base-op 'byte-varbind) 1893 (if (eq base-op 'byte-varbind)
1851 (setq byte-compile-bound-variables 1894 (setq byte-compile-bound-variables
@@ -1933,6 +1976,9 @@ If FORM is a lambda or a macro, byte-compile it as a function."
1933 ;; be used when byte-compile-compatibility is true. 1976 ;; be used when byte-compile-compatibility is true.
1934 (if (and (byte-compile-single-version) 1977 (if (and (byte-compile-single-version)
1935 (not byte-compile-compatibility)) 1978 (not byte-compile-compatibility))
1979 ;; #### instead of doing nothing, this should do some remprops,
1980 ;; #### to protect against the case where a single-version compiler
1981 ;; #### is loaded into a world that has contained a multi-version one.
1936 nil 1982 nil
1937 (list 'progn 1983 (list 'progn
1938 (list 'put 1984 (list 'put
@@ -2020,7 +2066,7 @@ If FORM is a lambda or a macro, byte-compile it as a function."
2020(byte-defop-compiler get 2) 2066(byte-defop-compiler get 2)
2021(byte-defop-compiler nth 2) 2067(byte-defop-compiler nth 2)
2022(byte-defop-compiler substring 2-3) 2068(byte-defop-compiler substring 2-3)
2023(byte-defop-compiler (move-marker byte-set-marker) 2-3) 2069(byte-defop-compiler19 (move-marker byte-set-marker) 2-3)
2024(byte-defop-compiler19 set-marker 2-3) 2070(byte-defop-compiler19 set-marker 2-3)
2025(byte-defop-compiler19 match-beginning 1) 2071(byte-defop-compiler19 match-beginning 1)
2026(byte-defop-compiler19 match-end 1) 2072(byte-defop-compiler19 match-end 1)
@@ -2028,21 +2074,21 @@ If FORM is a lambda or a macro, byte-compile it as a function."
2028(byte-defop-compiler19 downcase 1) 2074(byte-defop-compiler19 downcase 1)
2029(byte-defop-compiler19 string= 2) 2075(byte-defop-compiler19 string= 2)
2030(byte-defop-compiler19 string< 2) 2076(byte-defop-compiler19 string< 2)
2031(byte-defop-compiler (string-equal byte-string=) 2) 2077(byte-defop-compiler19 (string-equal byte-string=) 2)
2032(byte-defop-compiler (string-lessp byte-string<) 2) 2078(byte-defop-compiler19 (string-lessp byte-string<) 2)
2033(byte-defop-compiler19 equal 2) 2079(byte-defop-compiler19 equal 2)
2034(byte-defop-compiler19 nthcdr 2) 2080(byte-defop-compiler19 nthcdr 2)
2035(byte-defop-compiler19 elt 2) 2081(byte-defop-compiler19 elt 2)
2036(byte-defop-compiler19 member 2) 2082(byte-defop-compiler19 member 2)
2037(byte-defop-compiler19 assq 2) 2083(byte-defop-compiler19 assq 2)
2038(byte-defop-compiler (rplaca byte-setcar) 2) 2084(byte-defop-compiler19 (rplaca byte-setcar) 2)
2039(byte-defop-compiler (rplacd byte-setcdr) 2) 2085(byte-defop-compiler19 (rplacd byte-setcdr) 2)
2040(byte-defop-compiler19 setcar 2) 2086(byte-defop-compiler19 setcar 2)
2041(byte-defop-compiler19 setcdr 2) 2087(byte-defop-compiler19 setcdr 2)
2042(byte-defop-compiler19 buffer-substring 2) 2088(byte-defop-compiler19 buffer-substring 2)
2043(byte-defop-compiler19 delete-region 2) 2089(byte-defop-compiler19 delete-region 2)
2044(byte-defop-compiler19 narrow-to-region 2) 2090(byte-defop-compiler19 narrow-to-region 2)
2045(byte-defop-compiler (mod byte-rem) 2) 2091(byte-defop-compiler19 (mod byte-rem) 2)
2046(byte-defop-compiler19 (% byte-rem) 2) 2092(byte-defop-compiler19 (% byte-rem) 2)
2047(byte-defop-compiler aset 3) 2093(byte-defop-compiler aset 3)
2048 2094
@@ -2903,6 +2949,13 @@ For example, invoke \"emacs -batch -f batch-byte-compile $emacs/ ~/*.el\""
2903 2949
2904(make-obsolete 'buffer-flush-undo 'buffer-disable-undo) 2950(make-obsolete 'buffer-flush-undo 'buffer-disable-undo)
2905(make-obsolete 'baud-rate "use the baud-rate variable instead") 2951(make-obsolete 'baud-rate "use the baud-rate variable instead")
2952(make-obsolete-variable 'auto-fill-hook 'auto-fill-function)
2953(make-obsolete-variable 'blink-paren-hook 'blink-paren-function)
2954(make-obsolete-variable 'lisp-indent-hook 'lisp-indent-function)
2955(make-obsolete-variable 'temp-buffer-show-hook
2956 'temp-buffer-show-function)
2957(make-obsolete-variable 'inhibit-local-variables
2958 "use enable-local-variables (with the reversed sense.)")
2906 2959
2907(provide 'byte-compile) 2960(provide 'byte-compile)
2908 2961
diff --git a/lisp/frame.el b/lisp/frame.el
index 41f01d713af..2a598778245 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -31,7 +31,7 @@ function, which should take an alist of parameters as its argument.")
31;;; The default value for this must ask for a minibuffer. There must 31;;; The default value for this must ask for a minibuffer. There must
32;;; always exist a frame with a minibuffer, and after we delete the 32;;; always exist a frame with a minibuffer, and after we delete the
33;;; terminal frame, this will be the only frame. 33;;; terminal frame, this will be the only frame.
34(defvar initial-frame-alist '((minibuffer . nil)) 34(defvar initial-frame-alist '((minibuffer . t))
35 "Alist of values used when creating the initial emacs text frame. 35 "Alist of values used when creating the initial emacs text frame.
36These may be set in your init file, like this: 36These may be set in your init file, like this:
37 (setq initial-frame-alist '((top . 1) (left . 1) (width . 80) (height . 55))) 37 (setq initial-frame-alist '((top . 1) (left . 1) (width . 80) (height . 55)))
@@ -286,8 +286,27 @@ If FRAME is omitted, describe the currently selected frame."
286;;;; Aliases for backward compatibility with Emacs 18. 286;;;; Aliases for backward compatibility with Emacs 18.
287(fset 'screen-height 'frame-height) 287(fset 'screen-height 'frame-height)
288(fset 'screen-width 'frame-width) 288(fset 'screen-width 'frame-width)
289(fset 'set-screen-width 'set-frame-width) 289
290(fset 'set-screen-height 'set-frame-height) 290(defun set-screen-width (cols &optional pretend)
291 "Obsolete function to change the size of the screen to COLS columns.\n\
292Optional second arg non-nil means that redisplay should use COLS columns\n\
293but that the idea of the actual width of the frame should not be changed.\n\
294This function is provided only for compatibility with Emacs 18; new code\n\
295should use set-frame-width instead."
296 (set-frame-width (selected-frame) cols pretend))
297
298(defun set-screen-height (lines &optional pretend)
299 "Obsolete function to change the height of the screen to LINES lines.\n\
300Optional second arg non-nil means that redisplay should use LINES lines\n\
301but that the idea of the actual height of the screen should not be changed.\n\
302This function is provided only for compatibility with Emacs 18; new code\n\
303should use set-frame-width instead."
304 (set-frame-height (selected-frame) lines pretend))
305
306(make-obsolete 'screen-height 'frame-height)
307(make-obsolete 'screen-width 'frame-width)
308(make-obsolete 'set-screen-width 'set-frame-width)
309(make-obsolete 'set-screen-height 'set-frame-height)
291 310
292 311
293;;;; Key bindings 312;;;; Key bindings
diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el
index 799e90ff6c3..68923a0b8db 100644
--- a/lisp/term/x-win.el
+++ b/lisp/term/x-win.el
@@ -437,11 +437,6 @@ This returns ARGS with the arguments that have been processed removed."
437(x-open-connection (or x-display-name 437(x-open-connection (or x-display-name
438 (setq x-display-name (getenv "DISPLAY")))) 438 (setq x-display-name (getenv "DISPLAY"))))
439 439
440;;; xterm.c depends on using interrupt-driven input, but we don't want
441;;; the fcntls to apply to the terminal, so we do this after opening
442;;; the display.
443(set-input-mode t nil t)
444
445(setq frame-creation-function 'x-create-frame) 440(setq frame-creation-function 'x-create-frame)
446(setq suspend-hook 441(setq suspend-hook
447 '(lambda () 442 '(lambda ()