From 3dfa7993b098a3438ba2451ebd4c97eff18dd49c Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 21 Jul 2012 12:48:11 +0300 Subject: [PATCH 01/89] Fix bug #11958 with description of mouse-2 in the Emacs manual. doc/emacs/frames.texi (Mouse Commands): Fix the description of mouse-2. --- doc/emacs/ChangeLog | 5 +++++ doc/emacs/frames.texi | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index 5430883abd0..b5038ae0948 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,3 +1,8 @@ +2012-07-21 Eli Zaretskii + + * frames.texi (Mouse Commands): Fix the description of mouse-2. + (Bug#11958) + 2012-07-19 Chong Yidong * emacs.texi: Update ISBN. diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi index cf276c44d0f..a1c13d6a57b 100644 --- a/doc/emacs/frames.texi +++ b/doc/emacs/frames.texi @@ -81,8 +81,8 @@ Activate the region around the text selected by dragging, and copy it to the kill ring (@code{mouse-set-region}). @item Mouse-2 -Yank the last killed text at the click position -(@code{mouse-yank-at-click}). +Move point to where you click, and insert the contents of the primary +selection there (@code{mouse-yank-primary}). @item Mouse-3 If the region is active, move the nearer end of the region to the From 971635eeb9b999afd6f8eda10c978f8641022fb2 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Wed, 25 Jul 2012 14:14:30 +0800 Subject: [PATCH 02/89] Backport fix for Bug#11989 from trunk. * mouse.el (mouse-drag-track): Do not set the mark if the user releases the mouse without selecting anything. --- lisp/ChangeLog | 5 +++++ lisp/mouse.el | 15 +++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9cda817fab6..e693f1a62f6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-07-25 Chong Yidong + + * mouse.el (mouse-drag-track): Do not set the mark if the user + releases the mouse without selecting anything (Bug#11588). + 2012-07-21 Leo Liu * progmodes/cc-cmds.el (c-defun-name): Use diff --git a/lisp/mouse.el b/lisp/mouse.el index 20a78e55651..d9511c722ca 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -806,7 +806,7 @@ DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by ;; when setting point near the right fringe (but see below). (automatic-hscrolling-saved automatic-hscrolling) (automatic-hscrolling nil) - event end end-point) + moved-off-start event end end-point) (setq mouse-selection-click-count click-count) ;; In case the down click is in the middle of some intangible text, @@ -841,6 +841,9 @@ DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by (redisplay)) (setq end (event-end event) end-point (posn-point end)) + ;; Note whether the mouse has left the starting position. + (unless (eq end-point start-point) + (setq moved-off-start t)) (if (and (eq (posn-window end) start-window) (integer-or-marker-p end-point)) (mouse--drag-set-mark-and-point start-point @@ -881,11 +884,11 @@ DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by (let (deactivate-mark) (copy-region-as-kill (mark) (point))))) - ;; If point hasn't moved, run the binding of the - ;; terminating up-event. - (if do-multi-click - (goto-char start-point) - (deactivate-mark)) + ;; Otherwise, run binding of terminating up-event. + (cond + (do-multi-click (goto-char start-point)) + (moved-off-start (deactivate-mark)) + (t (pop-mark))) (when (and (functionp fun) (= start-hscroll (window-hscroll start-window)) ;; Don't run the up-event handler if the window From 9a0f8f2e959c1867c848a0c33cfaee70a201c83f Mon Sep 17 00:00:00 2001 From: Leo Liu Date: Thu, 26 Jul 2012 00:11:23 +0800 Subject: [PATCH 03/89] Avoid leaving nil in the alist in cc-imenu-objc-function Fixes: debbugs:12029 --- lisp/ChangeLog | 5 +++++ lisp/progmodes/cc-menus.el | 8 ++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e693f1a62f6..ac1482df4e1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-07-25 Leo Liu + + * progmodes/cc-menus.el (cc-imenu-objc-function): Avoid leaving nil in + the alist (bug#12029). + 2012-07-25 Chong Yidong * mouse.el (mouse-drag-track): Do not set the mark if the user diff --git a/lisp/progmodes/cc-menus.el b/lisp/progmodes/cc-menus.el index a53d65f6307..76e3002abd2 100644 --- a/lisp/progmodes/cc-menus.el +++ b/lisp/progmodes/cc-menus.el @@ -399,14 +399,10 @@ Example: str2 "@protocol"))) (setq str (cc-imenu-objc-remove-white-space str)) (setq methodlist (cons (cons str2 - (match-beginning langnum)) + (match-beginning langnum)) methodlist)) - (setq toplist (cons nil (cons (cons str - methodlist) toplist)) + (setq toplist (cons (cons str methodlist) toplist) methodlist nil)))) - ;; - (if (eq (car toplist) nil) - (setq toplist (cdr toplist))) ;; In this buffer, there is only one or zero @{interface|implementation|protocol}. (if (< classcount 2) From 6195f3845db9aa785e644f55c86270788b293740 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Fri, 27 Jul 2012 06:47:07 +0400 Subject: [PATCH 04/89] Fast save_excursion_save and save_excursion_restore. * lisp.h (struct Lisp_Excursion): New data type. (PVEC_EXCURSION): New pseudovector type. (XEXCURSION, XSETEXCURSION, EXCURSIONP): Convenient macros to deal with it. Adjust comments. (init_marker, attach_marker): New prototype. (unchain_marker): Adjust prototype. * marker.c (attach_marker): Change to global. (init_marker): New function. * alloc.c (Fmake_marker, build_marker): Use it. (build_marker): More easserts. (mark_object): Handle struct Lisp_Excursion. * editfns.c (save_excursion_save, save_excursion_restore): Reimplement to use struct Lisp_Excursion. Add comments. --- src/ChangeLog | 17 +++++ src/alloc.c | 51 ++++++++------- src/editfns.c | 168 +++++++++++++++++++++++++------------------------- src/lisp.h | 47 ++++++++++++-- src/marker.c | 21 ++++++- 5 files changed, 192 insertions(+), 112 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 7e91158ee36..e78a0365288 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,20 @@ +2012-07-27 Dmitry Antipov + + Fast save_excursion_save and save_excursion_restore. + * lisp.h (struct Lisp_Excursion): New data type. + (PVEC_EXCURSION): New pseudovector type. + (XEXCURSION, XSETEXCURSION, EXCURSIONP): Convenient macros + to deal with it. Adjust comments. + (init_marker, attach_marker): New prototype. + (unchain_marker): Adjust prototype. + * marker.c (attach_marker): Change to global. + (init_marker): New function. + * alloc.c (Fmake_marker, build_marker): Use it. + (build_marker): More easserts. + (mark_object): Handle struct Lisp_Excursion. + * editfns.c (save_excursion_save, save_excursion_restore): + Reimplement to use struct Lisp_Excursion. Add comments. + 2012-07-26 Paul Eggert Fix export of symbols to GDB (Bug#12036). diff --git a/src/alloc.c b/src/alloc.c index ac6cb861c4d..5377b27e329 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -3653,17 +3653,10 @@ DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 0, doc: /* Return a newly allocated marker which does not point at any place. */) (void) { - register Lisp_Object val; - register struct Lisp_Marker *p; + register Lisp_Object marker = allocate_misc (Lisp_Misc_Marker); - val = allocate_misc (Lisp_Misc_Marker); - p = XMARKER (val); - p->buffer = 0; - p->bytepos = 0; - p->charpos = 0; - p->next = NULL; - p->insertion_type = 0; - return val; + init_marker (XMARKER (marker), NULL, 0, 0, 0); + return marker; } /* Return a newly allocated marker which points into BUF @@ -3672,24 +3665,23 @@ DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 0, Lisp_Object build_marker (struct buffer *buf, ptrdiff_t charpos, ptrdiff_t bytepos) { - Lisp_Object obj; - struct Lisp_Marker *m; + register Lisp_Object marker = allocate_misc (Lisp_Misc_Marker); + + /* Use Fmake_marker to create marker points to nowhere. */ + eassert (buf != NULL); /* No dead buffers here. */ eassert (!NILP (BVAR (buf, name))); - /* Every character is at least one byte. */ - eassert (charpos <= bytepos); + /* In a single-byte buffer, two positions must be equal. + Otherwise, every character is at least one byte. */ + if (BUF_Z (buf) == BUF_Z_BYTE (buf)) + eassert (charpos == bytepos); + else + eassert (charpos <= bytepos); - obj = allocate_misc (Lisp_Misc_Marker); - m = XMARKER (obj); - m->buffer = buf; - m->charpos = charpos; - m->bytepos = bytepos; - m->insertion_type = 0; - m->next = BUF_MARKERS (buf); - BUF_MARKERS (buf) = m; - return obj; + init_marker (XMARKER (marker), buf, charpos, bytepos, 0); + return marker; } /* Put MARKER back on the free list after using it temporarily. */ @@ -6057,6 +6049,19 @@ mark_object (Lisp_Object arg) case PVEC_SUBR: break; + case PVEC_EXCURSION: + { + struct Lisp_Excursion *e = (struct Lisp_Excursion *) ptr; + /* No Lisp_Objects but two special pointers to mark here. */ + eassert (e->buffer != NULL); + eassert (e->window != NULL); + if (!VECTOR_MARKED_P (e->buffer)) + mark_buffer (e->buffer); + if (!VECTOR_MARKED_P (e->window)) + mark_vectorlike ((struct Lisp_Vector *) e->window); + } + break; + case PVEC_FREE: abort (); diff --git a/src/editfns.c b/src/editfns.c index f174594dd97..8b6c29bc934 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -821,104 +821,104 @@ This function does not move point. */) Qnil, Qt, Qnil); } - +/* Record buffer state before entering Fsave_excursion. */ + Lisp_Object save_excursion_save (void) { - int visible = (XBUFFER (XWINDOW (selected_window)->buffer) - == current_buffer); + Lisp_Object excursion; + struct buffer *b = current_buffer; + struct window *w = XWINDOW (selected_window); + struct Lisp_Excursion *ex = xmalloc (sizeof *ex); + struct Lisp_Marker *m = XMARKER (BVAR (b, mark)); - return Fcons (Fpoint_marker (), - Fcons (Fcopy_marker (BVAR (current_buffer, mark), Qnil), - Fcons (visible ? Qt : Qnil, - Fcons (BVAR (current_buffer, mark_active), - selected_window)))); + ex->size = 0; + ex->buffer = b; + ex->window = w; + ex->visible = (XBUFFER (w->buffer) == b); + ex->active = !NILP (BVAR (b, mark_active)); + + /* We do not initialize type and gcmarkbit since this marker + is never referenced via Lisp_Object and invisible for GC. */ + init_marker (&ex->point, b, PT, PT_BYTE, 0); + + /* Likewise. Note that charpos and bytepos may be zero. */ + init_marker (&ex->mark, m->buffer, m->charpos, + m->bytepos, m->insertion_type); + + /* Make it a pseudovector and return excursion object. */ + XSETTYPED_PVECTYPE (ex, size, PVEC_EXCURSION); + XSETEXCURSION (excursion, ex); + return excursion; } +/* Restore buffer state before leaving Fsave_excursion. */ + Lisp_Object -save_excursion_restore (Lisp_Object info) +save_excursion_restore (Lisp_Object obj) { - Lisp_Object tem, tem1, omark, nmark; - struct gcpro gcpro1, gcpro2, gcpro3; - int visible_p; + struct Lisp_Excursion *ex = XEXCURSION (obj); + struct buffer *b = ex->buffer; - tem = Fmarker_buffer (XCAR (info)); - /* If buffer being returned to is now deleted, avoid error */ - /* Otherwise could get error here while unwinding to top level - and crash */ - /* In that case, Fmarker_buffer returns nil now. */ - if (NILP (tem)) - return Qnil; + eassert (b != NULL); + eassert (ex->window != NULL); - omark = nmark = Qnil; - GCPRO3 (info, omark, nmark); + /* Restore buffer state only if the buffer is live. + Otherwise, just cancel an excursion state. */ - Fset_buffer (tem); - - /* Point marker. */ - tem = XCAR (info); - Fgoto_char (tem); - unchain_marker (XMARKER (tem)); - - /* Mark marker. */ - info = XCDR (info); - tem = XCAR (info); - omark = Fmarker_position (BVAR (current_buffer, mark)); - Fset_marker (BVAR (current_buffer, mark), tem, Fcurrent_buffer ()); - nmark = Fmarker_position (tem); - unchain_marker (XMARKER (tem)); - - /* visible */ - info = XCDR (info); - visible_p = !NILP (XCAR (info)); - -#if 0 /* We used to make the current buffer visible in the selected window - if that was true previously. That avoids some anomalies. - But it creates others, and it wasn't documented, and it is simpler - and cleaner never to alter the window/buffer connections. */ - tem1 = Fcar (tem); - if (!NILP (tem1) - && current_buffer != XBUFFER (XWINDOW (selected_window)->buffer)) - Fswitch_to_buffer (Fcurrent_buffer (), Qnil); -#endif /* 0 */ - - /* Mark active */ - info = XCDR (info); - tem = XCAR (info); - tem1 = BVAR (current_buffer, mark_active); - BVAR (current_buffer, mark_active) = tem; - - /* If mark is active now, and either was not active - or was at a different place, run the activate hook. */ - if (! NILP (tem)) + if (!NILP (BVAR (b, name))) { - if (! EQ (omark, nmark)) - { - tem = intern ("activate-mark-hook"); - Frun_hooks (1, &tem); - } - } - /* If mark has ceased to be active, run deactivate hook. */ - else if (! NILP (tem1)) - { - tem = intern ("deactivate-mark-hook"); - Frun_hooks (1, &tem); + int active; + struct Lisp_Marker *m; + ptrdiff_t oldpos, newpos; + + /* Restore current buffer. */ + set_buffer_internal (b); + + /* Restore buffer position. */ + SET_PT_BOTH (clip_to_bounds (BEGV, ex->point.charpos, ZV), + clip_to_bounds (BEGV_BYTE, ex->point.bytepos, ZV_BYTE)); + unchain_marker (&ex->point); + + /* Restore mark if it was non-zero. */ + m = XMARKER (BVAR (b, mark)); + oldpos = m->charpos; + if (BEGV <= ex->mark.charpos) + attach_marker (m, b, ex->mark.charpos, ex->mark.bytepos); + newpos = ex->mark.charpos; + unchain_marker (&ex->mark); + + /* If mark and region was active, restore them. */ + active = !NILP (BVAR (b, mark_active)); + BVAR (b, mark_active) = ex->active ? Qt : Qnil; + + /* If mark is active now, and either was not active + or was at a different place, run the activate hook. */ + if (ex->active && oldpos != newpos) + { + obj = intern ("activate-mark-hook"); + Frun_hooks (1, &obj); + } + /* If mark has ceased to be active, run deactivate hook. */ + else if (active) + { + obj = intern ("deactivate-mark-hook"); + Frun_hooks (1, &obj); + } + + /* If buffer was visible in a window, and a different window + was selected, and the old selected window is still showing + this buffer, restore point in that window. */ + if (ex->visible) + { + struct window *w = ex->window; + + if (w != XWINDOW (selected_window) && XBUFFER (w->buffer) == b) + attach_marker (XMARKER (w->pointm), b, PT, PT_BYTE); + } } - /* If buffer was visible in a window, and a different window was - selected, and the old selected window is still showing this - buffer, restore point in that window. */ - tem = XCDR (info); - if (visible_p - && !EQ (tem, selected_window) - && (tem1 = XWINDOW (tem)->buffer, - (/* Window is live... */ - BUFFERP (tem1) - /* ...and it shows the current buffer. */ - && XBUFFER (tem1) == current_buffer))) - Fset_window_point (tem, make_number (PT)); - - UNGCPRO; + xfree (ex); return Qnil; } diff --git a/src/lisp.h b/src/lisp.h index f845ea6bd12..55a4a297a39 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -379,6 +379,7 @@ enum pvec_type PVEC_TERMINAL, PVEC_WINDOW_CONFIGURATION, PVEC_SUBR, + PVEC_EXCURSION, PVEC_OTHER, /* These last 4 are special because we OR them in fns.c:internal_equal, so they have to use a disjoint bit pattern: @@ -551,6 +552,8 @@ clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper) (struct terminal *) XUNTAG (a, Lisp_Vectorlike)) #define XSUBR(a) (eassert (SUBRP (a)), \ (struct Lisp_Subr *) XUNTAG (a, Lisp_Vectorlike)) +#define XEXCURSION(a) (eassert (EXCURSIONP (a)), \ + (struct Lisp_Excursion *) XUNTAG (a, Lisp_Vectorlike)) #define XBUFFER(a) (eassert (BUFFERP (a)), \ (struct buffer *) XUNTAG (a, Lisp_Vectorlike)) #define XCHAR_TABLE(a) (eassert (CHAR_TABLE_P (a)), \ @@ -603,9 +606,12 @@ clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper) #define XSETPROCESS(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_PROCESS)) #define XSETWINDOW(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW)) #define XSETTERMINAL(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_TERMINAL)) -/* XSETSUBR is special since Lisp_Subr lacks struct vectorlike_header. */ +/* These are special because both Lisp_Subr and Lisp_Excursion lacks + struct vectorlike_header. */ #define XSETSUBR(a, b) \ XSETTYPED_PSEUDOVECTOR (a, b, XSUBR (a)->size, PVEC_SUBR) +#define XSETEXCURSION(a, b) \ + XSETTYPED_PSEUDOVECTOR (a, b, XEXCURSION (a)->size, PVEC_EXCURSION) #define XSETCOMPILED(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_COMPILED)) #define XSETBUFFER(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BUFFER)) #define XSETCHAR_TABLE(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_CHAR_TABLE)) @@ -1522,6 +1528,33 @@ struct Lisp_Float #define XFLOAT_INIT(f,n) (XFLOAT (f)->u.data = (n)) #endif +/* This structure is used to record buffer state for Fsave_excursion. + It's mostly treated as Lisp_Vector but allocated and freed explicitly + with xmalloc and xfree, so there is no vectorlike_header here. */ + +struct Lisp_Excursion +{ + ptrdiff_t size; + + /* Saved value of XWINDOW (selected_window). */ + struct window *window; + + /* Buffer where this excursion is in effect. */ + struct buffer *buffer; + + /* Non-zero if the window above has displayed the buffer. */ + unsigned visible : 1; + + /* Non-zero if this buffer has the mark active. */ + unsigned active : 1; + + /* Saved point. */ + struct Lisp_Marker point; + + /* Saved mark. May point to nowhere. */ + struct Lisp_Marker mark; +}; + /* A character, declared with the following typedef, is a member of some character set associated with the current buffer. */ #ifndef _UCHAR_T /* Protect against something in ctab.h on AIX. */ @@ -1704,8 +1737,10 @@ typedef struct { #define PROCESSP(x) PSEUDOVECTORP (x, PVEC_PROCESS) #define WINDOWP(x) PSEUDOVECTORP (x, PVEC_WINDOW) #define TERMINALP(x) PSEUDOVECTORP (x, PVEC_TERMINAL) -/* SUBRP is special since Lisp_Subr lacks struct vectorlike_header. */ +/* These are special because both Lisp_Subr and Lisp_Excursion lacks + struct vectorlike_header. */ #define SUBRP(x) TYPED_PSEUDOVECTORP (x, Lisp_Subr, PVEC_SUBR) +#define EXCURSIONP(x) TYPED_PSEUDOVECTORP (x, Lisp_Excursion, PVEC_EXCURSION) #define COMPILEDP(x) PSEUDOVECTORP (x, PVEC_COMPILED) #define BUFFERP(x) PSEUDOVECTORP (x, PVEC_BUFFER) #define CHAR_TABLE_P(x) PSEUDOVECTORP (x, PVEC_CHAR_TABLE) @@ -2919,11 +2954,15 @@ extern void clear_charpos_cache (struct buffer *); extern ptrdiff_t charpos_to_bytepos (ptrdiff_t); extern ptrdiff_t buf_charpos_to_bytepos (struct buffer *, ptrdiff_t); extern ptrdiff_t buf_bytepos_to_charpos (struct buffer *, ptrdiff_t); -extern void unchain_marker (struct Lisp_Marker *marker); +extern void unchain_marker (struct Lisp_Marker *); extern Lisp_Object set_marker_restricted (Lisp_Object, Lisp_Object, Lisp_Object); extern Lisp_Object set_marker_both (Lisp_Object, Lisp_Object, ptrdiff_t, ptrdiff_t); extern Lisp_Object set_marker_restricted_both (Lisp_Object, Lisp_Object, - ptrdiff_t, ptrdiff_t); + ptrdiff_t, ptrdiff_t); +extern void init_marker (struct Lisp_Marker *, struct buffer *, + ptrdiff_t, ptrdiff_t, int); +extern void attach_marker (struct Lisp_Marker *, struct buffer *, + ptrdiff_t, ptrdiff_t); extern Lisp_Object build_marker (struct buffer *, ptrdiff_t, ptrdiff_t); extern void syms_of_marker (void); diff --git a/src/marker.c b/src/marker.c index 0a93f4c180f..d63947d8c31 100644 --- a/src/marker.c +++ b/src/marker.c @@ -425,9 +425,28 @@ Returns nil if MARKER points nowhere. */) return Qnil; } +/* Initialize just allocated Lisp_Marker. */ + +void +init_marker (struct Lisp_Marker *m, struct buffer *b, + ptrdiff_t charpos, ptrdiff_t bytepos, int type) +{ + m->buffer = b; + m->charpos = charpos; + m->bytepos = bytepos; + m->insertion_type = type; + if (b) + { + m->next = BUF_MARKERS (b); + BUF_MARKERS (b) = m; + } + else + m->next = NULL; +} + /* Change M so it points to B at CHARPOS and BYTEPOS. */ -static inline void +void attach_marker (struct Lisp_Marker *m, struct buffer *b, ptrdiff_t charpos, ptrdiff_t bytepos) { From ca1302a40a560521627fd6a2954a51a79d105a16 Mon Sep 17 00:00:00 2001 From: Jay Belanger Date: Thu, 26 Jul 2012 22:48:40 -0500 Subject: [PATCH 05/89] calccomp.el (math-compose-expr): Use parentheses when there is a product in the denominator of a fraction. --- lisp/ChangeLog | 5 +++++ lisp/calc/calccomp.el | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5e848134cb2..99d41ee19bc 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-07-27 Jay Belanger + + * calc/calccomp.el (math-compose-expr): Use parentheses when + there is a product in the denominator of a fraction. + 2012-07-26 Eli Zaretskii * makefile.w32-in ($(lisp)/calendar/cal-loaddefs.el) diff --git a/lisp/calc/calccomp.el b/lisp/calc/calccomp.el index d8ad7e2cede..73e745bcf75 100644 --- a/lisp/calc/calccomp.el +++ b/lisp/calc/calccomp.el @@ -87,7 +87,8 @@ sn))) (defun math-compose-expr (a prec) - (let ((math-compose-level (1+ math-compose-level)) + (let ((calc-multiplication-has-precedence nil) + (math-compose-level (1+ math-compose-level)) (math-expr-opers (math-expr-ops)) spfn) (cond From 694b6c97ebb8310bc18dd305c2f277bcc11cebca Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Fri, 27 Jul 2012 10:04:35 +0400 Subject: [PATCH 06/89] Utility function to make a list from specified amount of objects. * lisp.h (enum constype): New datatype. (listn): New prototype. * alloc.c (listn): New function. (Fmemory_use_count, syms_of_alloc): Use it. * buffer.c (syms_of_buffer): Likewise. * callint.c (syms_of_callint): Likewise. * charset.c (define_charset_internal): Likewise. * coding.c (syms_of_coding): Likewise. * keymap.c (syms_of_keymap): Likewise. * search.c (syms_of_search): Likewise. * syntax.c (syms_of_syntax): Likewise. * w32.c (init_environment): Likewise. * w32fns.c (Fw32_battery_status, syms_of_w32fns): Likewise. * xdisp.c (syms_of_xdisp): Likewise. * xfns.c (syms_of_xfns): Likewise. --- src/ChangeLog | 19 +++++++++++++++++ src/alloc.c | 57 ++++++++++++++++++++++++++++++++++++++------------- src/buffer.c | 2 +- src/callint.c | 9 ++++---- src/charset.c | 33 +++++++++++++++-------------- src/coding.c | 2 +- src/keymap.c | 33 +++++++++++++++-------------- src/lisp.h | 2 ++ src/search.c | 4 ++-- src/syntax.c | 2 +- src/w32.c | 12 +++++------ src/w32fns.c | 21 +++++++++---------- src/xdisp.c | 16 +++++++-------- src/xfns.c | 2 +- 14 files changed, 130 insertions(+), 84 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index e78a0365288..e1d0ef8e90e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,22 @@ +2012-07-27 Dmitry Antipov + + Utility function to make a list from specified amount of objects. + * lisp.h (enum constype): New datatype. + (listn): New prototype. + * alloc.c (listn): New function. + (Fmemory_use_count, syms_of_alloc): Use it. + * buffer.c (syms_of_buffer): Likewise. + * callint.c (syms_of_callint): Likewise. + * charset.c (define_charset_internal): Likewise. + * coding.c (syms_of_coding): Likewise. + * keymap.c (syms_of_keymap): Likewise. + * search.c (syms_of_search): Likewise. + * syntax.c (syms_of_syntax): Likewise. + * w32.c (init_environment): Likewise. + * w32fns.c (Fw32_battery_status, syms_of_w32fns): Likewise. + * xdisp.c (syms_of_xdisp): Likewise. + * xfns.c (syms_of_xfns): Likewise. + 2012-07-27 Dmitry Antipov Fast save_excursion_save and save_excursion_restore. diff --git a/src/alloc.c b/src/alloc.c index 5377b27e329..3d8b7a54d06 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -2811,6 +2811,38 @@ list5 (Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, Lisp_Object arg4, L Fcons (arg5, Qnil))))); } +/* Make a list of COUNT Lisp_Objects, where ARG is the + first one. Allocate conses from pure space if TYPE + is PURE, or allocate as usual if type is HEAP. */ + +Lisp_Object +listn (enum constype type, ptrdiff_t count, Lisp_Object arg, ...) +{ + va_list ap; + ptrdiff_t i; + Lisp_Object val, *objp; + + /* Change to SAFE_ALLOCA if you hit this eassert. */ + eassert (count <= MAX_ALLOCA / sizeof (Lisp_Object)); + + objp = alloca (count * sizeof (Lisp_Object)); + objp[0] = arg; + va_start (ap, arg); + for (i = 1; i < count; i++) + objp[i] = va_arg (ap, Lisp_Object); + va_end (ap); + + for (i = 0, val = Qnil; i < count; i++) + { + if (type == PURE) + val = pure_cons (objp[i], val); + else if (type == HEAP) + val = Fcons (objp[i], val); + else + abort (); + } + return val; +} DEFUN ("list", Flist, Slist, 0, MANY, 0, doc: /* Return a newly created list with specified arguments as elements. @@ -6649,18 +6681,15 @@ Frames, windows, buffers, and subprocesses count as vectors (but the contents of a buffer's text do not count here). */) (void) { - Lisp_Object consed[8]; - - consed[0] = bounded_number (cons_cells_consed); - consed[1] = bounded_number (floats_consed); - consed[2] = bounded_number (vector_cells_consed); - consed[3] = bounded_number (symbols_consed); - consed[4] = bounded_number (string_chars_consed); - consed[5] = bounded_number (misc_objects_consed); - consed[6] = bounded_number (intervals_consed); - consed[7] = bounded_number (strings_consed); - - return Flist (8, consed); + return listn (HEAP, 8, + bounded_number (cons_cells_consed), + bounded_number (floats_consed), + bounded_number (vector_cells_consed), + bounded_number (symbols_consed), + bounded_number (string_chars_consed), + bounded_number (misc_objects_consed), + bounded_number (intervals_consed), + bounded_number (strings_consed)); } /* Find at most FIND_MAX symbols which have OBJ as their value or @@ -6841,8 +6870,8 @@ do hash-consing of the objects allocated to pure space. */); /* We build this in advance because if we wait until we need it, we might not be able to allocate the memory to hold it. */ Vmemory_signal_data - = pure_cons (Qerror, - pure_cons (build_pure_c_string ("Memory exhausted--use M-x save-some-buffers then exit and restart Emacs"), Qnil)); + = listn (PURE, 2, Qerror, + build_pure_c_string ("Memory exhausted--use M-x save-some-buffers then exit and restart Emacs")); DEFVAR_LISP ("memory-full", Vmemory_full, doc: /* Non-nil means Emacs cannot get much more Lisp memory. */); diff --git a/src/buffer.c b/src/buffer.c index 06d385110c6..c2afd7f4a5e 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -5212,7 +5212,7 @@ syms_of_buffer (void) DEFSYM (Qkill_buffer_query_functions, "kill-buffer-query-functions"); Fput (Qprotected_field, Qerror_conditions, - pure_cons (Qprotected_field, pure_cons (Qerror, Qnil))); + listn (PURE, 2, Qprotected_field, Qerror)); Fput (Qprotected_field, Qerror_message, build_pure_c_string ("Attempt to modify a protected field")); diff --git a/src/callint.c b/src/callint.c index 58e1a5be2f4..4454b1fdb16 100644 --- a/src/callint.c +++ b/src/callint.c @@ -888,10 +888,11 @@ syms_of_callint (void) callint_message = Qnil; staticpro (&callint_message); - preserved_fns = pure_cons (intern_c_string ("region-beginning"), - pure_cons (intern_c_string ("region-end"), - pure_cons (intern_c_string ("point"), - pure_cons (intern_c_string ("mark"), Qnil)))); + preserved_fns = listn (PURE, 4, + intern_c_string ("region-beginning"), + intern_c_string ("region-end"), + intern_c_string ("point"), + intern_c_string ("mark")); DEFSYM (Qlist, "list"); DEFSYM (Qlet, "let"); diff --git a/src/charset.c b/src/charset.c index 4c47ba45fb6..ae822544006 100644 --- a/src/charset.c +++ b/src/charset.c @@ -1257,7 +1257,6 @@ define_charset_internal (Lisp_Object name, { const unsigned char *code_space = (const unsigned char *) code_space_chars; Lisp_Object args[charset_arg_max]; - Lisp_Object plist[14]; Lisp_Object val; int i; @@ -1283,22 +1282,22 @@ define_charset_internal (Lisp_Object name, args[charset_arg_superset] = Qnil; args[charset_arg_unify_map] = Qnil; - plist[0] = intern_c_string (":name"); - plist[1] = args[charset_arg_name]; - plist[2] = intern_c_string (":dimension"); - plist[3] = args[charset_arg_dimension]; - plist[4] = intern_c_string (":code-space"); - plist[5] = args[charset_arg_code_space]; - plist[6] = intern_c_string (":iso-final-char"); - plist[7] = args[charset_arg_iso_final]; - plist[8] = intern_c_string (":emacs-mule-id"); - plist[9] = args[charset_arg_emacs_mule_id]; - plist[10] = intern_c_string (":ascii-compatible-p"); - plist[11] = args[charset_arg_ascii_compatible_p]; - plist[12] = intern_c_string (":code-offset"); - plist[13] = args[charset_arg_code_offset]; - - args[charset_arg_plist] = Flist (14, plist); + args[charset_arg_plist] = + listn (HEAP, 14, + intern_c_string (":name"), + args[charset_arg_name], + intern_c_string (":dimension"), + args[charset_arg_dimension], + intern_c_string (":code-space"), + args[charset_arg_code_space], + intern_c_string (":iso-final-char"), + args[charset_arg_iso_final], + intern_c_string (":emacs-mule-id"), + args[charset_arg_emacs_mule_id], + intern_c_string (":ascii-compatible-p"), + args[charset_arg_ascii_compatible_p], + intern_c_string (":code-offset"), + args[charset_arg_code_offset]); Fdefine_charset_internal (charset_arg_max, args); return XINT (CHARSET_SYMBOL_ID (name)); diff --git a/src/coding.c b/src/coding.c index 212eb8275fe..8b858aa218e 100644 --- a/src/coding.c +++ b/src/coding.c @@ -10411,7 +10411,7 @@ syms_of_coding (void) DEFSYM (Qcoding_system_error, "coding-system-error"); Fput (Qcoding_system_error, Qerror_conditions, - pure_cons (Qcoding_system_error, pure_cons (Qerror, Qnil))); + listn (PURE, 2, Qcoding_system_error, Qerror)); Fput (Qcoding_system_error, Qerror_message, build_pure_c_string ("Invalid coding system")); diff --git a/src/keymap.c b/src/keymap.c index feaf0cfd961..d86a4cd74de 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -3702,13 +3702,12 @@ syms_of_keymap (void) Fset (intern_c_string ("ctl-x-map"), control_x_map); Ffset (intern_c_string ("Control-X-prefix"), control_x_map); - exclude_keys - = pure_cons (pure_cons (build_pure_c_string ("DEL"), build_pure_c_string ("\\d")), - pure_cons (pure_cons (build_pure_c_string ("TAB"), build_pure_c_string ("\\t")), - pure_cons (pure_cons (build_pure_c_string ("RET"), build_pure_c_string ("\\r")), - pure_cons (pure_cons (build_pure_c_string ("ESC"), build_pure_c_string ("\\e")), - pure_cons (pure_cons (build_pure_c_string ("SPC"), build_pure_c_string (" ")), - Qnil))))); + exclude_keys = listn (PURE, 5, + pure_cons (build_pure_c_string ("DEL"), build_pure_c_string ("\\d")), + pure_cons (build_pure_c_string ("TAB"), build_pure_c_string ("\\t")), + pure_cons (build_pure_c_string ("RET"), build_pure_c_string ("\\r")), + pure_cons (build_pure_c_string ("ESC"), build_pure_c_string ("\\e")), + pure_cons (build_pure_c_string ("SPC"), build_pure_c_string (" "))); staticpro (&exclude_keys); DEFVAR_LISP ("define-key-rebound-commands", Vdefine_key_rebound_commands, @@ -3761,16 +3760,16 @@ be preferred. */); where_is_preferred_modifier = 0; staticpro (&Vmouse_events); - Vmouse_events = pure_cons (intern_c_string ("menu-bar"), - pure_cons (intern_c_string ("tool-bar"), - pure_cons (intern_c_string ("header-line"), - pure_cons (intern_c_string ("mode-line"), - pure_cons (intern_c_string ("mouse-1"), - pure_cons (intern_c_string ("mouse-2"), - pure_cons (intern_c_string ("mouse-3"), - pure_cons (intern_c_string ("mouse-4"), - pure_cons (intern_c_string ("mouse-5"), - Qnil))))))))); + Vmouse_events = listn (PURE, 9, + intern_c_string ("menu-bar"), + intern_c_string ("tool-bar"), + intern_c_string ("header-line"), + intern_c_string ("mode-line"), + intern_c_string ("mouse-1"), + intern_c_string ("mouse-2"), + intern_c_string ("mouse-3"), + intern_c_string ("mouse-4"), + intern_c_string ("mouse-5")); DEFSYM (Qsingle_key_description, "single-key-description"); DEFSYM (Qkey_description, "key-description"); diff --git a/src/lisp.h b/src/lisp.h index 55a4a297a39..c217b946e81 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2685,6 +2685,8 @@ extern Lisp_Object list3 (Lisp_Object, Lisp_Object, Lisp_Object); extern Lisp_Object list4 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); extern Lisp_Object list5 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); +enum constype {HEAP, PURE}; +extern Lisp_Object listn (enum constype, ptrdiff_t, Lisp_Object, ...); extern _Noreturn void string_overflow (void); extern Lisp_Object make_string (const char *, ptrdiff_t); extern Lisp_Object make_formatted_string (char *, const char *, ...) diff --git a/src/search.c b/src/search.c index 118cec4af48..c4329dcdf3e 100644 --- a/src/search.c +++ b/src/search.c @@ -3054,12 +3054,12 @@ syms_of_search (void) DEFSYM (Qinvalid_regexp, "invalid-regexp"); Fput (Qsearch_failed, Qerror_conditions, - pure_cons (Qsearch_failed, pure_cons (Qerror, Qnil))); + listn (PURE, 2, Qsearch_failed, Qerror)); Fput (Qsearch_failed, Qerror_message, build_pure_c_string ("Search failed")); Fput (Qinvalid_regexp, Qerror_conditions, - pure_cons (Qinvalid_regexp, pure_cons (Qerror, Qnil))); + listn (PURE, 2, Qinvalid_regexp, Qerror)); Fput (Qinvalid_regexp, Qerror_message, build_pure_c_string ("Invalid regexp")); diff --git a/src/syntax.c b/src/syntax.c index 69c2789ed39..1e57c00e512 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -3473,7 +3473,7 @@ syms_of_syntax (void) DEFSYM (Qscan_error, "scan-error"); Fput (Qscan_error, Qerror_conditions, - pure_cons (Qscan_error, pure_cons (Qerror, Qnil))); + listn (PURE, 2, Qscan_error, Qerror)); Fput (Qscan_error, Qerror_message, build_pure_c_string ("Scan error")); diff --git a/src/w32.c b/src/w32.c index e8c48a50a97..6f7cc9506ec 100644 --- a/src/w32.c +++ b/src/w32.c @@ -1722,13 +1722,11 @@ init_environment (char ** argv) dwType = REG_EXPAND_SZ; dont_free = 1; if (!strcmp (env_vars[i].name, "HOME") && !appdata) - { - Lisp_Object warning[2]; - warning[0] = intern ("initialization"); - warning[1] = build_string ("Setting HOME to C:\\ by default is deprecated"); - Vdelayed_warnings_list = Fcons (Flist (2, warning), - Vdelayed_warnings_list); - } + Vdelayed_warnings_list + = Fcons (listn (HEAP, 2, + intern ("initialization"); + build_string ("Setting HOME to C:\\ by default is deprecated")), + Vdelayed_warnings_list); } if (lpval) diff --git a/src/w32fns.c b/src/w32fns.c index 06938e3124b..0dd5379cf01 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -6470,7 +6470,6 @@ The following %-sequences are provided: { Lisp_Object line_status, battery_status, battery_status_symbol; Lisp_Object load_percentage, seconds, minutes, hours, remain; - Lisp_Object sequences[8]; long seconds_left = (long) system_status.BatteryLifeTime; @@ -6544,16 +6543,16 @@ The following %-sequences are provided: _snprintf (buffer, 16, "%ld:%02ld", m / 60, m % 60); remain = build_string (buffer); } - sequences[0] = Fcons (make_number ('L'), line_status); - sequences[1] = Fcons (make_number ('B'), battery_status); - sequences[2] = Fcons (make_number ('b'), battery_status_symbol); - sequences[3] = Fcons (make_number ('p'), load_percentage); - sequences[4] = Fcons (make_number ('s'), seconds); - sequences[5] = Fcons (make_number ('m'), minutes); - sequences[6] = Fcons (make_number ('h'), hours); - sequences[7] = Fcons (make_number ('t'), remain); - status = Flist (8, sequences); + status = listn (HEAP, 8, + Fcons (make_number ('L'), line_status), + Fcons (make_number ('B'), battery_status), + Fcons (make_number ('b'), battery_status_symbol), + Fcons (make_number ('p'), load_percentage), + Fcons (make_number ('s'), seconds), + Fcons (make_number ('m'), minutes), + Fcons (make_number ('h'), hours), + Fcons (make_number ('t'), remain)); } return status; } @@ -6795,7 +6794,7 @@ syms_of_w32fns (void) Fput (Qundefined_color, Qerror_conditions, - pure_cons (Qundefined_color, pure_cons (Qerror, Qnil))); + listn (PURE, 2, Qundefined_color, Qerror); Fput (Qundefined_color, Qerror_message, build_pure_c_string ("Undefined color")); diff --git a/src/xdisp.c b/src/xdisp.c index 1d3de61c5a3..aac34d35ef4 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -28932,14 +28932,14 @@ and is used only on frames for which no explicit name has been set \(see `modify-frame-parameters'). */); Vicon_title_format = Vframe_title_format - = pure_cons (intern_c_string ("multiple-frames"), - pure_cons (build_pure_c_string ("%b"), - pure_cons (pure_cons (empty_unibyte_string, - pure_cons (intern_c_string ("invocation-name"), - pure_cons (build_pure_c_string ("@"), - pure_cons (intern_c_string ("system-name"), - Qnil)))), - Qnil))); + = listn (PURE, 3, + intern_c_string ("multiple-frames"), + build_pure_c_string ("%b"), + listn (PURE, 4, + empty_unibyte_string, + intern_c_string ("invocation-name"), + build_pure_c_string ("@"), + intern_c_string ("system-name"))); DEFVAR_LISP ("message-log-max", Vmessage_log_max, doc: /* Maximum number of lines to keep in the message log buffer. diff --git a/src/xfns.c b/src/xfns.c index e431651d93a..cd29dabc71a 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -5822,7 +5822,7 @@ syms_of_xfns (void) /* This is the end of symbol initialization. */ Fput (Qundefined_color, Qerror_conditions, - pure_cons (Qundefined_color, pure_cons (Qerror, Qnil))); + listn (PURE, 2, Qundefined_color, Qerror)); Fput (Qundefined_color, Qerror_message, build_pure_c_string ("Undefined color")); From 4706125e2f5181d21c0e3b23b4aa5c96b21c3b67 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 26 Jul 2012 23:18:36 -0700 Subject: [PATCH 07/89] Improve GDB symbol export. * .gdbinit (xgetptr, xgetint, xgettype): Set $bugfix in different arms of an 'if', not using conditional expressions; otherwise GDB complains about the types in the unevaluated arm when the argument is an integer literal. (xgetint): Simplify expression. * alloc.c (gdb_make_enums_visible): New constant. This ports to GCC 3.4.2 the export of symbols to GDB. Problem reported by Eli Zaretskii in . * lisp.h (PUBLISH_TO_GDB): Remove. All uses removed. No longer needed now that we have gdb_make_enums_visible. (enum CHECK_LISP_OBJECT_TYPE, enum Lisp_Bits, enum More_Lisp_Bits) (enum enum_USE_LSB_TAG): New enum types, packaging up enums that need to be exported to GDB. --- src/.gdbinit | 20 ++++++++--- src/ChangeLog | 17 ++++++++++ src/alloc.c | 23 ++++++++++--- src/lisp.h | 93 ++++++++++++++++++++++++--------------------------- 4 files changed, 94 insertions(+), 59 deletions(-) diff --git a/src/.gdbinit b/src/.gdbinit index c044b404f9b..25b555b8540 100644 --- a/src/.gdbinit +++ b/src/.gdbinit @@ -46,17 +46,29 @@ handle SIGALRM ignore # Use $bugfix so that the value isn't a constant. # Using a constant runs into GDB bugs sometimes. define xgetptr - set $bugfix = CHECK_LISP_OBJECT_TYPE ? $arg0.i : $arg0 + if (CHECK_LISP_OBJECT_TYPE) + set $bugfix = $arg0.i + else + set $bugfix = $arg0 + end set $ptr = ($bugfix & VALMASK) | DATA_SEG_BITS end define xgetint - set $bugfix = CHECK_LISP_OBJECT_TYPE ? $arg0.i : $arg0 - set $int = USE_LSB_TAG ? $bugfix >> INTTYPEBITS : $bugfix << INTTYPEBITS >> INTTYPEBITS + if (CHECK_LISP_OBJECT_TYPE) + set $bugfix = $arg0.i + else + set $bugfix = $arg0 + end + set $int = $bugfix << (USE_LSB_TAG ? 0 : INTTYPEBITS) >> INTTYPEBITS end define xgettype - set $bugfix = CHECK_LISP_OBJECT_TYPE ? $arg0.i : $arg0 + if (CHECK_LISP_OBJECT_TYPE) + set $bugfix = $arg0.i + else + set $bugfix = $arg0 + end set $type = (enum Lisp_Type) (USE_LSB_TAG ? $bugfix & (1 << GCTYPEBITS) - 1 : $bugfix >> VALBITS) end diff --git a/src/ChangeLog b/src/ChangeLog index e1d0ef8e90e..cf90a35f230 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,20 @@ +2012-07-27 Paul Eggert + + Improve GDB symbol export (Bug#12036). + * .gdbinit (xgetptr, xgetint, xgettype): Set $bugfix in different + arms of an 'if', not using conditional expressions; otherwise GDB + complains about the types in the unevaluated arm when the argument + is an integer literal. + (xgetint): Simplify expression. + * alloc.c (gdb_make_enums_visible): New constant. This ports to + GCC 3.4.2 the export of symbols to GDB. Problem reported by Eli + Zaretskii in . + * lisp.h (PUBLISH_TO_GDB): Remove. All uses removed. No longer + needed now that we have gdb_make_enums_visible. + (enum CHECK_LISP_OBJECT_TYPE, enum Lisp_Bits, enum More_Lisp_Bits) + (enum enum_USE_LSB_TAG): + New enum types, packaging up enums that need to be exported to GDB. + 2012-07-27 Dmitry Antipov Utility function to make a list from specified amount of objects. diff --git a/src/alloc.c b/src/alloc.c index 3d8b7a54d06..948ce7b6f5c 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -6910,12 +6910,25 @@ The time is in seconds as a floating point value. */); #endif } -/* Make some symbols visible to GDB. These cannot be done as enums, like - GCTYPEBITS or USE_LSB_TAG, since values might not be in 'int' range. - Each symbol X has a corresponding X_VAL symbol, verified to have - the correct value. +/* Make some symbols visible to GDB. This section is last, so that + the #undef lines don't mess up later code. */ - This is last, so that the #undef lines don't mess up later code. */ +/* When compiled with GCC, GDB might say "No enum type named + pvec_type" if we don't have at least one symbol with that type, and + then xbacktrace could fail. Similarly for the other enums and + their values. */ +union +{ + enum CHECK_LISP_OBJECT_TYPE CHECK_LISP_OBJECT_TYPE; + enum enum_USE_LSB_TAG enum_USE_LSB_TAG; + enum Lisp_Bits Lisp_Bits; + enum More_Lisp_Bits More_Lisp_Bits; + enum pvec_type pvec_type; +} const EXTERNALLY_VISIBLE gdb_make_enums_visible = {0}; + +/* These symbols cannot be done as enums, since values might not be + in 'int' range. Each symbol X has a corresponding X_VAL symbol, + verified to have the correct value. */ #define ARRAY_MARK_FLAG_VAL PTRDIFF_MIN #define PSEUDOVECTOR_FLAG_VAL (PTRDIFF_MAX - PTRDIFF_MAX / 2) diff --git a/src/lisp.h b/src/lisp.h index c217b946e81..dd03a130c7c 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -64,12 +64,6 @@ typedef unsigned int EMACS_UINT; # endif #endif -/* If an enum type is not used, the enum symbols are not put into the - executable so the debugger cannot see them on many systems, e.g., - GCC 4.7.1 + GDB 7.4.1 + GNU/Linux. Work around this problem by - explicitly using the names in the integer constant expression EXPR. */ -#define PUBLISH_TO_GDB(expr) extern int (*gdb_dummy (int))[(expr) || 1] - /* Number of bits in some machine integer types. */ enum { @@ -161,14 +155,23 @@ extern int suppress_checking EXTERNALLY_VISIBLE; variable VAR of type TYPE with the added requirement that it be TYPEBITS-aligned. */ -/* Number of bits in a Lisp_Object tag. This can be used in #if, - and for GDB's sake also as a regular symbol. */ -enum { GCTYPEBITS = 3 }; -PUBLISH_TO_GDB (GCTYPEBITS); +enum Lisp_Bits + { + /* Number of bits in a Lisp_Object tag. This can be used in #if, + and for GDB's sake also as a regular symbol. */ + GCTYPEBITS = #define GCTYPEBITS 3 + GCTYPEBITS, -/* Number of bits in a Lisp_Object value, not counting the tag. */ -enum { VALBITS = BITS_PER_EMACS_INT - GCTYPEBITS }; + /* Number of bits in a Lisp_Object value, not counting the tag. */ + VALBITS = BITS_PER_EMACS_INT - GCTYPEBITS, + + /* Number of bits in a Lisp fixnum tag. */ + INTTYPEBITS = GCTYPEBITS - 1, + + /* Number of bits in a Lisp fixnum value, not counting the tag. */ + FIXNUM_BITS = VALBITS + 1 + }; /* The maximum value that can be stored in a EMACS_INT, assuming all bits other than the type bits contribute to a nonnegative signed value. @@ -211,16 +214,12 @@ enum { VALBITS = BITS_PER_EMACS_INT - GCTYPEBITS }; # endif # endif #endif -/* USE_LSB_TAG can be used in #if; default it to 0 and make it visible - to GDB. */ #ifdef USE_LSB_TAG # undef USE_LSB_TAG -enum { USE_LSB_TAG = 1 }; -PUBLISH_TO_GDB (USE_LSB_TAG); +enum enum_USE_LSB_TAG { USE_LSB_TAG = 1 }; # define USE_LSB_TAG 1 #else -enum { USE_LSB_TAG = 0 }; -PUBLISH_TO_GDB (USE_LSB_TAG); +enum enum_USE_LSB_TAG { USE_LSB_TAG = 0 }; # define USE_LSB_TAG 0 #endif @@ -239,8 +238,6 @@ PUBLISH_TO_GDB (USE_LSB_TAG); /* Lisp integers use 2 tags, to give them one extra bit, thus extending their range from, e.g., -2^28..2^28-1 to -2^29..2^29-1. */ -enum { INTTYPEBITS = GCTYPEBITS - 1 }; -enum { FIXNUM_BITS = VALBITS + 1 }; #define INTMASK (EMACS_INT_MAX >> (INTTYPEBITS - 1)) #define LISP_INT_TAG Lisp_Int0 #define case_Lisp_Int case Lisp_Int0: case Lisp_Int1 @@ -335,9 +332,9 @@ LISP_MAKE_RVALUE (Lisp_Object o) } #define LISP_INITIALLY_ZERO {0} -#undef CHECK_LISP_OBJECT_TYPE -enum { CHECK_LISP_OBJECT_TYPE = 1 }; +#undef CHECK_LISP_OBJECT_TYPE +enum CHECK_LISP_OBJECT_TYPE { CHECK_LISP_OBJECT_TYPE = 1 }; #else /* CHECK_LISP_OBJECT_TYPE */ /* If a struct type is not wanted, define Lisp_Object as just a number. */ @@ -347,9 +344,8 @@ typedef EMACS_INT Lisp_Object; #define XIL(i) (i) #define LISP_MAKE_RVALUE(o) (0+(o)) #define LISP_INITIALLY_ZERO 0 -enum { CHECK_LISP_OBJECT_TYPE = 0 }; +enum CHECK_LISP_OBJECT_TYPE { CHECK_LISP_OBJECT_TYPE = 0 }; #endif /* CHECK_LISP_OBJECT_TYPE */ -PUBLISH_TO_GDB (CHECK_LISP_OBJECT_TYPE); /* In the size word of a vector, this bit means the vector has been marked. */ @@ -390,35 +386,32 @@ enum pvec_type PVEC_SUB_CHAR_TABLE = 0x30, PVEC_FONT = 0x40 }; -PUBLISH_TO_GDB ((enum pvec_type) 0); /* This also publishes PVEC_*. */ - -/* For convenience, we also store the number of elements in these bits. - Note that this size is not necessarily the memory-footprint size, but - only the number of Lisp_Object fields (that need to be traced by the GC). - The distinction is used e.g. by Lisp_Process which places extra - non-Lisp_Object fields at the end of the structure. */ -enum - { - PSEUDOVECTOR_SIZE_BITS = 16, - PSEUDOVECTOR_SIZE_MASK = (1 << PSEUDOVECTOR_SIZE_BITS) - 1, - PVEC_TYPE_MASK = 0x0fff << PSEUDOVECTOR_SIZE_BITS - }; - -/* Number of bits to put in each character in the internal representation - of bool vectors. This should not vary across implementations. */ -enum { BOOL_VECTOR_BITS_PER_CHAR = 8 }; /* DATA_SEG_BITS forces extra bits to be or'd in with any pointers - which were stored in a Lisp_Object. It is not needed in #if, so - for GDB's sake change it from a macro to a regular symbol. */ -#ifdef DATA_SEG_BITS -enum { gdb_DATA_SEG_BITS = DATA_SEG_BITS }; -# undef DATA_SEG_BITS -enum { DATA_SEG_BITS = gdb_DATA_SEG_BITS }; -#else -enum { DATA_SEG_BITS = 0 }; + which were stored in a Lisp_Object. */ +#ifndef DATA_SEG_BITS +# define DATA_SEG_BITS 0 #endif -PUBLISH_TO_GDB (DATA_SEG_BITS); +enum { gdb_DATA_SEG_BITS = DATA_SEG_BITS }; +#undef DATA_SEG_BITS + +enum More_Lisp_Bits + { + DATA_SEG_BITS = gdb_DATA_SEG_BITS, + + /* For convenience, we also store the number of elements in these bits. + Note that this size is not necessarily the memory-footprint size, but + only the number of Lisp_Object fields (that need to be traced by GC). + The distinction is used, e.g., by Lisp_Process, which places extra + non-Lisp_Object fields at the end of the structure. */ + PSEUDOVECTOR_SIZE_BITS = 16, + PSEUDOVECTOR_SIZE_MASK = (1 << PSEUDOVECTOR_SIZE_BITS) - 1, + PVEC_TYPE_MASK = 0x0fff << PSEUDOVECTOR_SIZE_BITS, + + /* Number of bits to put in each character in the internal representation + of bool vectors. This should not vary across implementations. */ + BOOL_VECTOR_BITS_PER_CHAR = 8 + }; /* These macros extract various sorts of values from a Lisp_Object. For example, if tem is a Lisp_Object whose type is Lisp_Cons, From 073c88c22c0064b60ec57b6dadef9d3a4736e6b5 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Fri, 27 Jul 2012 11:36:33 +0400 Subject: [PATCH 08/89] Fix recently-introduced typos in Windows port. Reported by Martin Rudalics . * w32.c (init_environment): Replace comma with semicolon. * w32fns.c (syms_of_w32fns): Likewise. --- src/ChangeLog | 7 +++++++ src/w32.c | 4 ++-- src/w32fns.c | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index cf90a35f230..adcdfb7c056 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2012-07-27 Dmitry Antipov + + Fix recently-introduced typos in Windows port. + Reported by Martin Rudalics . + * w32.c (init_environment): Replace comma with semicolon. + * w32fns.c (syms_of_w32fns): Likewise. + 2012-07-27 Paul Eggert Improve GDB symbol export (Bug#12036). diff --git a/src/w32.c b/src/w32.c index 6f7cc9506ec..fe1007fceda 100644 --- a/src/w32.c +++ b/src/w32.c @@ -1724,9 +1724,9 @@ init_environment (char ** argv) if (!strcmp (env_vars[i].name, "HOME") && !appdata) Vdelayed_warnings_list = Fcons (listn (HEAP, 2, - intern ("initialization"); + intern ("initialization"), build_string ("Setting HOME to C:\\ by default is deprecated")), - Vdelayed_warnings_list); + Vdelayed_warnings_list); } if (lpval) diff --git a/src/w32fns.c b/src/w32fns.c index 0dd5379cf01..265af7378c4 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -6794,7 +6794,7 @@ syms_of_w32fns (void) Fput (Qundefined_color, Qerror_conditions, - listn (PURE, 2, Qundefined_color, Qerror); + listn (PURE, 2, Qundefined_color, Qerror)); Fput (Qundefined_color, Qerror_message, build_pure_c_string ("Undefined color")); From eeaea515623db982d4e7d453711e6f0fad9c08d8 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Fri, 27 Jul 2012 11:51:52 +0400 Subject: [PATCH 09/89] Revert last save_excursion_save and save_excursion_restore changes. * alloc.c, editfns.c, marker.c, lisp.h: Revert. Lots of crashes reported by Chong Yidong . --- src/ChangeLog | 8 ++- src/alloc.c | 51 +++++++-------- src/editfns.c | 168 +++++++++++++++++++++++++------------------------- src/lisp.h | 47 ++------------ src/marker.c | 21 +------ 5 files changed, 119 insertions(+), 176 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index adcdfb7c056..93697303cbb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,9 +1,15 @@ +2012-07-27 Dmitry Antipov + + Revert last save_excursion_save and save_excursion_restore changes. + * alloc.c, editfns.c, marker.c, lisp.h: Revert. + Lots of crashes reported by Chong Yidong . + 2012-07-27 Dmitry Antipov Fix recently-introduced typos in Windows port. Reported by Martin Rudalics . * w32.c (init_environment): Replace comma with semicolon. - * w32fns.c (syms_of_w32fns): Likewise. + * w32fns.c (syms_of_w32fns): Add missing parenthesis. 2012-07-27 Paul Eggert diff --git a/src/alloc.c b/src/alloc.c index 948ce7b6f5c..c7936921a09 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -3685,10 +3685,17 @@ DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 0, doc: /* Return a newly allocated marker which does not point at any place. */) (void) { - register Lisp_Object marker = allocate_misc (Lisp_Misc_Marker); + register Lisp_Object val; + register struct Lisp_Marker *p; - init_marker (XMARKER (marker), NULL, 0, 0, 0); - return marker; + val = allocate_misc (Lisp_Misc_Marker); + p = XMARKER (val); + p->buffer = 0; + p->bytepos = 0; + p->charpos = 0; + p->next = NULL; + p->insertion_type = 0; + return val; } /* Return a newly allocated marker which points into BUF @@ -3697,23 +3704,24 @@ DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 0, Lisp_Object build_marker (struct buffer *buf, ptrdiff_t charpos, ptrdiff_t bytepos) { - register Lisp_Object marker = allocate_misc (Lisp_Misc_Marker); - - /* Use Fmake_marker to create marker points to nowhere. */ - eassert (buf != NULL); + Lisp_Object obj; + struct Lisp_Marker *m; /* No dead buffers here. */ eassert (!NILP (BVAR (buf, name))); - /* In a single-byte buffer, two positions must be equal. - Otherwise, every character is at least one byte. */ - if (BUF_Z (buf) == BUF_Z_BYTE (buf)) - eassert (charpos == bytepos); - else - eassert (charpos <= bytepos); + /* Every character is at least one byte. */ + eassert (charpos <= bytepos); - init_marker (XMARKER (marker), buf, charpos, bytepos, 0); - return marker; + obj = allocate_misc (Lisp_Misc_Marker); + m = XMARKER (obj); + m->buffer = buf; + m->charpos = charpos; + m->bytepos = bytepos; + m->insertion_type = 0; + m->next = BUF_MARKERS (buf); + BUF_MARKERS (buf) = m; + return obj; } /* Put MARKER back on the free list after using it temporarily. */ @@ -6081,19 +6089,6 @@ mark_object (Lisp_Object arg) case PVEC_SUBR: break; - case PVEC_EXCURSION: - { - struct Lisp_Excursion *e = (struct Lisp_Excursion *) ptr; - /* No Lisp_Objects but two special pointers to mark here. */ - eassert (e->buffer != NULL); - eassert (e->window != NULL); - if (!VECTOR_MARKED_P (e->buffer)) - mark_buffer (e->buffer); - if (!VECTOR_MARKED_P (e->window)) - mark_vectorlike ((struct Lisp_Vector *) e->window); - } - break; - case PVEC_FREE: abort (); diff --git a/src/editfns.c b/src/editfns.c index 8b6c29bc934..f174594dd97 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -821,104 +821,104 @@ This function does not move point. */) Qnil, Qt, Qnil); } -/* Record buffer state before entering Fsave_excursion. */ - + Lisp_Object save_excursion_save (void) { - Lisp_Object excursion; - struct buffer *b = current_buffer; - struct window *w = XWINDOW (selected_window); - struct Lisp_Excursion *ex = xmalloc (sizeof *ex); - struct Lisp_Marker *m = XMARKER (BVAR (b, mark)); + int visible = (XBUFFER (XWINDOW (selected_window)->buffer) + == current_buffer); - ex->size = 0; - ex->buffer = b; - ex->window = w; - ex->visible = (XBUFFER (w->buffer) == b); - ex->active = !NILP (BVAR (b, mark_active)); - - /* We do not initialize type and gcmarkbit since this marker - is never referenced via Lisp_Object and invisible for GC. */ - init_marker (&ex->point, b, PT, PT_BYTE, 0); - - /* Likewise. Note that charpos and bytepos may be zero. */ - init_marker (&ex->mark, m->buffer, m->charpos, - m->bytepos, m->insertion_type); - - /* Make it a pseudovector and return excursion object. */ - XSETTYPED_PVECTYPE (ex, size, PVEC_EXCURSION); - XSETEXCURSION (excursion, ex); - return excursion; + return Fcons (Fpoint_marker (), + Fcons (Fcopy_marker (BVAR (current_buffer, mark), Qnil), + Fcons (visible ? Qt : Qnil, + Fcons (BVAR (current_buffer, mark_active), + selected_window)))); } -/* Restore buffer state before leaving Fsave_excursion. */ - Lisp_Object -save_excursion_restore (Lisp_Object obj) +save_excursion_restore (Lisp_Object info) { - struct Lisp_Excursion *ex = XEXCURSION (obj); - struct buffer *b = ex->buffer; + Lisp_Object tem, tem1, omark, nmark; + struct gcpro gcpro1, gcpro2, gcpro3; + int visible_p; - eassert (b != NULL); - eassert (ex->window != NULL); + tem = Fmarker_buffer (XCAR (info)); + /* If buffer being returned to is now deleted, avoid error */ + /* Otherwise could get error here while unwinding to top level + and crash */ + /* In that case, Fmarker_buffer returns nil now. */ + if (NILP (tem)) + return Qnil; - /* Restore buffer state only if the buffer is live. - Otherwise, just cancel an excursion state. */ + omark = nmark = Qnil; + GCPRO3 (info, omark, nmark); - if (!NILP (BVAR (b, name))) + Fset_buffer (tem); + + /* Point marker. */ + tem = XCAR (info); + Fgoto_char (tem); + unchain_marker (XMARKER (tem)); + + /* Mark marker. */ + info = XCDR (info); + tem = XCAR (info); + omark = Fmarker_position (BVAR (current_buffer, mark)); + Fset_marker (BVAR (current_buffer, mark), tem, Fcurrent_buffer ()); + nmark = Fmarker_position (tem); + unchain_marker (XMARKER (tem)); + + /* visible */ + info = XCDR (info); + visible_p = !NILP (XCAR (info)); + +#if 0 /* We used to make the current buffer visible in the selected window + if that was true previously. That avoids some anomalies. + But it creates others, and it wasn't documented, and it is simpler + and cleaner never to alter the window/buffer connections. */ + tem1 = Fcar (tem); + if (!NILP (tem1) + && current_buffer != XBUFFER (XWINDOW (selected_window)->buffer)) + Fswitch_to_buffer (Fcurrent_buffer (), Qnil); +#endif /* 0 */ + + /* Mark active */ + info = XCDR (info); + tem = XCAR (info); + tem1 = BVAR (current_buffer, mark_active); + BVAR (current_buffer, mark_active) = tem; + + /* If mark is active now, and either was not active + or was at a different place, run the activate hook. */ + if (! NILP (tem)) { - int active; - struct Lisp_Marker *m; - ptrdiff_t oldpos, newpos; - - /* Restore current buffer. */ - set_buffer_internal (b); - - /* Restore buffer position. */ - SET_PT_BOTH (clip_to_bounds (BEGV, ex->point.charpos, ZV), - clip_to_bounds (BEGV_BYTE, ex->point.bytepos, ZV_BYTE)); - unchain_marker (&ex->point); - - /* Restore mark if it was non-zero. */ - m = XMARKER (BVAR (b, mark)); - oldpos = m->charpos; - if (BEGV <= ex->mark.charpos) - attach_marker (m, b, ex->mark.charpos, ex->mark.bytepos); - newpos = ex->mark.charpos; - unchain_marker (&ex->mark); - - /* If mark and region was active, restore them. */ - active = !NILP (BVAR (b, mark_active)); - BVAR (b, mark_active) = ex->active ? Qt : Qnil; - - /* If mark is active now, and either was not active - or was at a different place, run the activate hook. */ - if (ex->active && oldpos != newpos) - { - obj = intern ("activate-mark-hook"); - Frun_hooks (1, &obj); - } - /* If mark has ceased to be active, run deactivate hook. */ - else if (active) - { - obj = intern ("deactivate-mark-hook"); - Frun_hooks (1, &obj); - } - - /* If buffer was visible in a window, and a different window - was selected, and the old selected window is still showing - this buffer, restore point in that window. */ - if (ex->visible) - { - struct window *w = ex->window; - - if (w != XWINDOW (selected_window) && XBUFFER (w->buffer) == b) - attach_marker (XMARKER (w->pointm), b, PT, PT_BYTE); - } + if (! EQ (omark, nmark)) + { + tem = intern ("activate-mark-hook"); + Frun_hooks (1, &tem); + } + } + /* If mark has ceased to be active, run deactivate hook. */ + else if (! NILP (tem1)) + { + tem = intern ("deactivate-mark-hook"); + Frun_hooks (1, &tem); } - xfree (ex); + /* If buffer was visible in a window, and a different window was + selected, and the old selected window is still showing this + buffer, restore point in that window. */ + tem = XCDR (info); + if (visible_p + && !EQ (tem, selected_window) + && (tem1 = XWINDOW (tem)->buffer, + (/* Window is live... */ + BUFFERP (tem1) + /* ...and it shows the current buffer. */ + && XBUFFER (tem1) == current_buffer))) + Fset_window_point (tem, make_number (PT)); + + UNGCPRO; return Qnil; } diff --git a/src/lisp.h b/src/lisp.h index dd03a130c7c..f0129f05efd 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -375,7 +375,6 @@ enum pvec_type PVEC_TERMINAL, PVEC_WINDOW_CONFIGURATION, PVEC_SUBR, - PVEC_EXCURSION, PVEC_OTHER, /* These last 4 are special because we OR them in fns.c:internal_equal, so they have to use a disjoint bit pattern: @@ -545,8 +544,6 @@ clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper) (struct terminal *) XUNTAG (a, Lisp_Vectorlike)) #define XSUBR(a) (eassert (SUBRP (a)), \ (struct Lisp_Subr *) XUNTAG (a, Lisp_Vectorlike)) -#define XEXCURSION(a) (eassert (EXCURSIONP (a)), \ - (struct Lisp_Excursion *) XUNTAG (a, Lisp_Vectorlike)) #define XBUFFER(a) (eassert (BUFFERP (a)), \ (struct buffer *) XUNTAG (a, Lisp_Vectorlike)) #define XCHAR_TABLE(a) (eassert (CHAR_TABLE_P (a)), \ @@ -599,12 +596,9 @@ clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper) #define XSETPROCESS(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_PROCESS)) #define XSETWINDOW(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW)) #define XSETTERMINAL(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_TERMINAL)) -/* These are special because both Lisp_Subr and Lisp_Excursion lacks - struct vectorlike_header. */ +/* XSETSUBR is special since Lisp_Subr lacks struct vectorlike_header. */ #define XSETSUBR(a, b) \ XSETTYPED_PSEUDOVECTOR (a, b, XSUBR (a)->size, PVEC_SUBR) -#define XSETEXCURSION(a, b) \ - XSETTYPED_PSEUDOVECTOR (a, b, XEXCURSION (a)->size, PVEC_EXCURSION) #define XSETCOMPILED(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_COMPILED)) #define XSETBUFFER(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BUFFER)) #define XSETCHAR_TABLE(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_CHAR_TABLE)) @@ -1521,33 +1515,6 @@ struct Lisp_Float #define XFLOAT_INIT(f,n) (XFLOAT (f)->u.data = (n)) #endif -/* This structure is used to record buffer state for Fsave_excursion. - It's mostly treated as Lisp_Vector but allocated and freed explicitly - with xmalloc and xfree, so there is no vectorlike_header here. */ - -struct Lisp_Excursion -{ - ptrdiff_t size; - - /* Saved value of XWINDOW (selected_window). */ - struct window *window; - - /* Buffer where this excursion is in effect. */ - struct buffer *buffer; - - /* Non-zero if the window above has displayed the buffer. */ - unsigned visible : 1; - - /* Non-zero if this buffer has the mark active. */ - unsigned active : 1; - - /* Saved point. */ - struct Lisp_Marker point; - - /* Saved mark. May point to nowhere. */ - struct Lisp_Marker mark; -}; - /* A character, declared with the following typedef, is a member of some character set associated with the current buffer. */ #ifndef _UCHAR_T /* Protect against something in ctab.h on AIX. */ @@ -1730,10 +1697,8 @@ typedef struct { #define PROCESSP(x) PSEUDOVECTORP (x, PVEC_PROCESS) #define WINDOWP(x) PSEUDOVECTORP (x, PVEC_WINDOW) #define TERMINALP(x) PSEUDOVECTORP (x, PVEC_TERMINAL) -/* These are special because both Lisp_Subr and Lisp_Excursion lacks - struct vectorlike_header. */ +/* SUBRP is special since Lisp_Subr lacks struct vectorlike_header. */ #define SUBRP(x) TYPED_PSEUDOVECTORP (x, Lisp_Subr, PVEC_SUBR) -#define EXCURSIONP(x) TYPED_PSEUDOVECTORP (x, Lisp_Excursion, PVEC_EXCURSION) #define COMPILEDP(x) PSEUDOVECTORP (x, PVEC_COMPILED) #define BUFFERP(x) PSEUDOVECTORP (x, PVEC_BUFFER) #define CHAR_TABLE_P(x) PSEUDOVECTORP (x, PVEC_CHAR_TABLE) @@ -2949,15 +2914,11 @@ extern void clear_charpos_cache (struct buffer *); extern ptrdiff_t charpos_to_bytepos (ptrdiff_t); extern ptrdiff_t buf_charpos_to_bytepos (struct buffer *, ptrdiff_t); extern ptrdiff_t buf_bytepos_to_charpos (struct buffer *, ptrdiff_t); -extern void unchain_marker (struct Lisp_Marker *); +extern void unchain_marker (struct Lisp_Marker *marker); extern Lisp_Object set_marker_restricted (Lisp_Object, Lisp_Object, Lisp_Object); extern Lisp_Object set_marker_both (Lisp_Object, Lisp_Object, ptrdiff_t, ptrdiff_t); extern Lisp_Object set_marker_restricted_both (Lisp_Object, Lisp_Object, - ptrdiff_t, ptrdiff_t); -extern void init_marker (struct Lisp_Marker *, struct buffer *, - ptrdiff_t, ptrdiff_t, int); -extern void attach_marker (struct Lisp_Marker *, struct buffer *, - ptrdiff_t, ptrdiff_t); + ptrdiff_t, ptrdiff_t); extern Lisp_Object build_marker (struct buffer *, ptrdiff_t, ptrdiff_t); extern void syms_of_marker (void); diff --git a/src/marker.c b/src/marker.c index d63947d8c31..0a93f4c180f 100644 --- a/src/marker.c +++ b/src/marker.c @@ -425,28 +425,9 @@ Returns nil if MARKER points nowhere. */) return Qnil; } -/* Initialize just allocated Lisp_Marker. */ - -void -init_marker (struct Lisp_Marker *m, struct buffer *b, - ptrdiff_t charpos, ptrdiff_t bytepos, int type) -{ - m->buffer = b; - m->charpos = charpos; - m->bytepos = bytepos; - m->insertion_type = type; - if (b) - { - m->next = BUF_MARKERS (b); - BUF_MARKERS (b) = m; - } - else - m->next = NULL; -} - /* Change M so it points to B at CHARPOS and BYTEPOS. */ -void +static inline void attach_marker (struct Lisp_Marker *m, struct buffer *b, ptrdiff_t charpos, ptrdiff_t bytepos) { From 86332df22ae3934334c7ced64aa6aedd5767b121 Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Fri, 27 Jul 2012 09:59:50 +0200 Subject: [PATCH 10/89] * textmodes/reftex-vars.el (reftex-label-alist-builtin): Add support for the lstlisting and minted environments, and for the ctable macro. * textmodes/reftex.el (reftex-compile-variables): Also recognize labels written in keyvals syntax. --- lisp/ChangeLog | 8 ++++++++ lisp/textmodes/reftex-vars.el | 9 ++++++++- lisp/textmodes/reftex.el | 12 +++++++++++- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 99d41ee19bc..a91d5a2ea98 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2012-07-27 Tassilo Horn + + * textmodes/reftex-vars.el (reftex-label-alist-builtin): Add + support for the lstlisting and minted environments, and for the + ctable macro. + * textmodes/reftex.el (reftex-compile-variables): Also recognize + labels written in keyvals syntax. + 2012-07-27 Jay Belanger * calc/calccomp.el (math-compose-expr): Use parentheses when diff --git a/lisp/textmodes/reftex-vars.el b/lisp/textmodes/reftex-vars.el index 4c875a35b3e..187c98af21f 100644 --- a/lisp/textmodes/reftex-vars.el +++ b/lisp/textmodes/reftex-vars.el @@ -122,7 +122,14 @@ ;;("\\label{*}" nil nil nil nil) )) - ) + (ctable "The ctable package" + (("\\ctable[]{}{}{}" ?t "tab:" "\\ref{%s}" 1 ("table" "Tabelle")))) + + (listings "The listings package" + (("lstlisting" ?l "lst:" "~\\ref{%s}" nil (regexp "[Ll]isting")))) + + (minted "The minted package" + (("minted" ?l "lst:" "~\\ref{%s}" nil (regexp "[Ll]isting"))))) "The default label environment descriptions. Lower-case symbols correspond to a style file of the same name in the LaTeX distribution. Mixed-case symbols are convenience aliases.") diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el index 8c349a2e20a..c2270323843 100644 --- a/lisp/textmodes/reftex.el +++ b/lisp/textmodes/reftex.el @@ -1284,7 +1284,15 @@ This enforces rescanning the buffer on next use." ; (wbol "\\(\\`\\|[\n\r]\\)[ \t]*") (wbol "\\(^\\)[ \t]*") ; Need to keep the empty group because ;;; because match number are hard coded - (label-re "\\\\label{\\([^}]*\\)}") + (label-re (concat "\\(?:" + ;; Normal \label{...} + "\\\\label{\\([^}]*\\)}" + "\\|" + ;; keyvals [..., label = {foo}, ...] + ;; forms used by ctable, listings, + ;; minted, ... + "\\[[^]]*label[[:space:]]*=[[:space:]]*{?\\(?1:[^],}]+\\)}?[^[]*\\]" + "\\)")) (include-re (concat wbol "\\\\\\(" (mapconcat 'identity @@ -1312,6 +1320,8 @@ This enforces rescanning the buffer on next use." "\\)\\([[{][^]}]*[]}]\\)*[[{]\\(%s\\)[]}]")) (find-label-re-format (concat "\\(" + "\\[[^]]*label[[:space:]]*=[[:space:]]*{?\\(?1:[^],}]+\\)}?[^[]*\\]" + "\\|" (mapconcat 'regexp-quote (append '("\\label") macros-with-labels) "\\|") "\\)\\([[{][^]}]*[]}]\\)*[[{]\\(%s\\)[]}]")) From 0000d0d54bb9cbc835172d9f5f8ff7595786af62 Mon Sep 17 00:00:00 2001 From: Katsumi Yamaoka Date: Fri, 27 Jul 2012 08:01:44 +0000 Subject: [PATCH 11/89] message.el: Make header fill function work properly --- lisp/gnus/ChangeLog | 6 ++++++ lisp/gnus/message.el | 31 ++++++++++++++++++------------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 83cb55d3594..80ede10c8c4 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,9 @@ +2012-07-27 Katsumi Yamaoka + + * message.el (message-kill-address): Don't kill last newline. + (message-skip-to-next-address): Don't move to the next header. + (message-fill-field-address): Work properly. + 2012-07-25 Julien Danjou * gnus-art.el (gnus-kill-sticky-article-buffers): Reintroduce. diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index ecc797314c4..e56a6c6d078 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -2603,7 +2603,7 @@ Point is left at the beginning of the narrowed-to region." (interactive) (let ((start (point))) (message-skip-to-next-address) - (kill-region start (point)))) + (kill-region start (if (bolp) (1- (point)) (point))))) (autoload 'Info-goto-node "info") @@ -6099,7 +6099,7 @@ Headers already prepared in the buffer are not modified." (while (and (not (= (point) end)) (or (not (eq char ?,)) quoted)) - (skip-chars-forward "^,\"" (point-max)) + (skip-chars-forward "^,\"" end) (when (eq (setq char (following-char)) ?\") (setq quoted (not quoted))) (unless (= (point) end) @@ -6136,17 +6136,22 @@ If the current line has `message-yank-prefix', insert it on the new line." (point-max)))) (defun message-fill-field-address () - (while (not (eobp)) - (message-skip-to-next-address) - (let (last) - (if (and (> (current-column) 78) - last) - (progn - (save-excursion - (goto-char last) - (insert "\n\t")) - (setq last (1+ (point)))) - (setq last (1+ (point))))))) + (let (end last) + (while (not end) + (message-skip-to-next-address) + (cond ((bolp) + (end-of-line 0) + (setq end 1)) + ((eobp) + (setq end 0))) + (when (and (> (current-column) 78) + last) + (save-excursion + (goto-char last) + (delete-char (- (skip-chars-backward " \t"))) + (insert "\n\t"))) + (setq last (point))) + (forward-line end))) (defun message-fill-field-general () (let ((begin (point)) From 3438fe218c77633ee2c5f106e3a335f906347247 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 27 Jul 2012 12:24:34 +0300 Subject: [PATCH 12/89] Fix failure to compile on Windows due to 2012-07-27T06:04:35Z!dmantipov@yandex.ru. src/lisp.h (enum constype): Use CONSTYPE_HEAP and CONSTYPE_PURE for enumeration constants, as PURE and HEAP are too general, and clash with other headers and sources, such as gmalloc.c and the MS-Windows system headers. All users changed. --- src/ChangeLog | 7 +++++++ src/alloc.c | 10 +++++----- src/buffer.c | 2 +- src/callint.c | 2 +- src/charset.c | 2 +- src/coding.c | 2 +- src/keymap.c | 4 ++-- src/lisp.h | 2 +- src/search.c | 4 ++-- src/syntax.c | 2 +- src/w32.c | 4 ++-- src/w32fns.c | 4 ++-- src/xdisp.c | 4 ++-- src/xfns.c | 2 +- 14 files changed, 29 insertions(+), 22 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 93697303cbb..54b34eb5c00 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2012-07-27 Eli Zaretskii + + * lisp.h (enum constype): Use CONSTYPE_HEAP and CONSTYPE_PURE for + enumeration constants, as PURE and HEAP are too general, and clash + with other headers and sources, such as gmalloc.c and the + MS-Windows system headers. All users changed. + 2012-07-27 Dmitry Antipov Revert last save_excursion_save and save_excursion_restore changes. diff --git a/src/alloc.c b/src/alloc.c index c7936921a09..27426cdff66 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -2813,7 +2813,7 @@ list5 (Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, Lisp_Object arg4, L /* Make a list of COUNT Lisp_Objects, where ARG is the first one. Allocate conses from pure space if TYPE - is PURE, or allocate as usual if type is HEAP. */ + is CONSTYPE_PURE, or allocate as usual if type is CONSTYPE_HEAP. */ Lisp_Object listn (enum constype type, ptrdiff_t count, Lisp_Object arg, ...) @@ -2834,9 +2834,9 @@ listn (enum constype type, ptrdiff_t count, Lisp_Object arg, ...) for (i = 0, val = Qnil; i < count; i++) { - if (type == PURE) + if (type == CONSTYPE_PURE) val = pure_cons (objp[i], val); - else if (type == HEAP) + else if (type == CONSTYPE_HEAP) val = Fcons (objp[i], val); else abort (); @@ -6676,7 +6676,7 @@ Frames, windows, buffers, and subprocesses count as vectors (but the contents of a buffer's text do not count here). */) (void) { - return listn (HEAP, 8, + return listn (CONSTYPE_HEAP, 8, bounded_number (cons_cells_consed), bounded_number (floats_consed), bounded_number (vector_cells_consed), @@ -6865,7 +6865,7 @@ do hash-consing of the objects allocated to pure space. */); /* We build this in advance because if we wait until we need it, we might not be able to allocate the memory to hold it. */ Vmemory_signal_data - = listn (PURE, 2, Qerror, + = listn (CONSTYPE_PURE, 2, Qerror, build_pure_c_string ("Memory exhausted--use M-x save-some-buffers then exit and restart Emacs")); DEFVAR_LISP ("memory-full", Vmemory_full, diff --git a/src/buffer.c b/src/buffer.c index c2afd7f4a5e..5e45882b892 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -5212,7 +5212,7 @@ syms_of_buffer (void) DEFSYM (Qkill_buffer_query_functions, "kill-buffer-query-functions"); Fput (Qprotected_field, Qerror_conditions, - listn (PURE, 2, Qprotected_field, Qerror)); + listn (CONSTYPE_PURE, 2, Qprotected_field, Qerror)); Fput (Qprotected_field, Qerror_message, build_pure_c_string ("Attempt to modify a protected field")); diff --git a/src/callint.c b/src/callint.c index 4454b1fdb16..4b53b5df34b 100644 --- a/src/callint.c +++ b/src/callint.c @@ -888,7 +888,7 @@ syms_of_callint (void) callint_message = Qnil; staticpro (&callint_message); - preserved_fns = listn (PURE, 4, + preserved_fns = listn (CONSTYPE_PURE, 4, intern_c_string ("region-beginning"), intern_c_string ("region-end"), intern_c_string ("point"), diff --git a/src/charset.c b/src/charset.c index ae822544006..b621109b75d 100644 --- a/src/charset.c +++ b/src/charset.c @@ -1283,7 +1283,7 @@ define_charset_internal (Lisp_Object name, args[charset_arg_unify_map] = Qnil; args[charset_arg_plist] = - listn (HEAP, 14, + listn (CONSTYPE_HEAP, 14, intern_c_string (":name"), args[charset_arg_name], intern_c_string (":dimension"), diff --git a/src/coding.c b/src/coding.c index 8b858aa218e..7b178b0ce14 100644 --- a/src/coding.c +++ b/src/coding.c @@ -10411,7 +10411,7 @@ syms_of_coding (void) DEFSYM (Qcoding_system_error, "coding-system-error"); Fput (Qcoding_system_error, Qerror_conditions, - listn (PURE, 2, Qcoding_system_error, Qerror)); + listn (CONSTYPE_PURE, 2, Qcoding_system_error, Qerror)); Fput (Qcoding_system_error, Qerror_message, build_pure_c_string ("Invalid coding system")); diff --git a/src/keymap.c b/src/keymap.c index d86a4cd74de..6cc76700542 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -3702,7 +3702,7 @@ syms_of_keymap (void) Fset (intern_c_string ("ctl-x-map"), control_x_map); Ffset (intern_c_string ("Control-X-prefix"), control_x_map); - exclude_keys = listn (PURE, 5, + exclude_keys = listn (CONSTYPE_PURE, 5, pure_cons (build_pure_c_string ("DEL"), build_pure_c_string ("\\d")), pure_cons (build_pure_c_string ("TAB"), build_pure_c_string ("\\t")), pure_cons (build_pure_c_string ("RET"), build_pure_c_string ("\\r")), @@ -3760,7 +3760,7 @@ be preferred. */); where_is_preferred_modifier = 0; staticpro (&Vmouse_events); - Vmouse_events = listn (PURE, 9, + Vmouse_events = listn (CONSTYPE_PURE, 9, intern_c_string ("menu-bar"), intern_c_string ("tool-bar"), intern_c_string ("header-line"), diff --git a/src/lisp.h b/src/lisp.h index f0129f05efd..80a9ab343c3 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2643,7 +2643,7 @@ extern Lisp_Object list3 (Lisp_Object, Lisp_Object, Lisp_Object); extern Lisp_Object list4 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); extern Lisp_Object list5 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); -enum constype {HEAP, PURE}; +enum constype {CONSTYPE_HEAP, CONSTYPE_PURE}; extern Lisp_Object listn (enum constype, ptrdiff_t, Lisp_Object, ...); extern _Noreturn void string_overflow (void); extern Lisp_Object make_string (const char *, ptrdiff_t); diff --git a/src/search.c b/src/search.c index c4329dcdf3e..480d0b75c70 100644 --- a/src/search.c +++ b/src/search.c @@ -3054,12 +3054,12 @@ syms_of_search (void) DEFSYM (Qinvalid_regexp, "invalid-regexp"); Fput (Qsearch_failed, Qerror_conditions, - listn (PURE, 2, Qsearch_failed, Qerror)); + listn (CONSTYPE_PURE, 2, Qsearch_failed, Qerror)); Fput (Qsearch_failed, Qerror_message, build_pure_c_string ("Search failed")); Fput (Qinvalid_regexp, Qerror_conditions, - listn (PURE, 2, Qinvalid_regexp, Qerror)); + listn (CONSTYPE_PURE, 2, Qinvalid_regexp, Qerror)); Fput (Qinvalid_regexp, Qerror_message, build_pure_c_string ("Invalid regexp")); diff --git a/src/syntax.c b/src/syntax.c index 1e57c00e512..14bec9a9c2f 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -3473,7 +3473,7 @@ syms_of_syntax (void) DEFSYM (Qscan_error, "scan-error"); Fput (Qscan_error, Qerror_conditions, - listn (PURE, 2, Qscan_error, Qerror)); + listn (CONSTYPE_PURE, 2, Qscan_error, Qerror)); Fput (Qscan_error, Qerror_message, build_pure_c_string ("Scan error")); diff --git a/src/w32.c b/src/w32.c index fe1007fceda..55b076e80f0 100644 --- a/src/w32.c +++ b/src/w32.c @@ -1722,8 +1722,8 @@ init_environment (char ** argv) dwType = REG_EXPAND_SZ; dont_free = 1; if (!strcmp (env_vars[i].name, "HOME") && !appdata) - Vdelayed_warnings_list - = Fcons (listn (HEAP, 2, + Vdelayed_warnings_list + = Fcons (listn (CONSTYPE_HEAP, 2, intern ("initialization"), build_string ("Setting HOME to C:\\ by default is deprecated")), Vdelayed_warnings_list); diff --git a/src/w32fns.c b/src/w32fns.c index 265af7378c4..1b1c5001344 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -6544,7 +6544,7 @@ The following %-sequences are provided: remain = build_string (buffer); } - status = listn (HEAP, 8, + status = listn (CONSTYPE_HEAP, 8, Fcons (make_number ('L'), line_status), Fcons (make_number ('B'), battery_status), Fcons (make_number ('b'), battery_status_symbol), @@ -6794,7 +6794,7 @@ syms_of_w32fns (void) Fput (Qundefined_color, Qerror_conditions, - listn (PURE, 2, Qundefined_color, Qerror)); + listn (CONSTYPE_PURE, 2, Qundefined_color, Qerror)); Fput (Qundefined_color, Qerror_message, build_pure_c_string ("Undefined color")); diff --git a/src/xdisp.c b/src/xdisp.c index aac34d35ef4..ecb9f0d50c9 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -28932,10 +28932,10 @@ and is used only on frames for which no explicit name has been set \(see `modify-frame-parameters'). */); Vicon_title_format = Vframe_title_format - = listn (PURE, 3, + = listn (CONSTYPE_PURE, 3, intern_c_string ("multiple-frames"), build_pure_c_string ("%b"), - listn (PURE, 4, + listn (CONSTYPE_PURE, 4, empty_unibyte_string, intern_c_string ("invocation-name"), build_pure_c_string ("@"), diff --git a/src/xfns.c b/src/xfns.c index cd29dabc71a..c8c96b642f0 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -5822,7 +5822,7 @@ syms_of_xfns (void) /* This is the end of symbol initialization. */ Fput (Qundefined_color, Qerror_conditions, - listn (PURE, 2, Qundefined_color, Qerror)); + listn (CONSTYPE_PURE, 2, Qundefined_color, Qerror)); Fput (Qundefined_color, Qerror_message, build_pure_c_string ("Undefined color")); From bcfbc9de654b0718d46349ca8ada284dba3dc761 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 27 Jul 2012 13:29:26 +0300 Subject: [PATCH 13/89] Fix listn introduced in 2012-07-27T06:04:35Z!dmantipov@yandex.ru. src/alloc.c (listn): Fix the order the arguments are consed onto the list. --- src/ChangeLog | 3 +++ src/alloc.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 54b34eb5c00..ab870b56f1e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2012-07-27 Eli Zaretskii + * alloc.c (listn): Fix the order the arguments are consed onto the + list. + * lisp.h (enum constype): Use CONSTYPE_HEAP and CONSTYPE_PURE for enumeration constants, as PURE and HEAP are too general, and clash with other headers and sources, such as gmalloc.c and the diff --git a/src/alloc.c b/src/alloc.c index 27426cdff66..a551dd821b8 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -2832,7 +2832,7 @@ listn (enum constype type, ptrdiff_t count, Lisp_Object arg, ...) objp[i] = va_arg (ap, Lisp_Object); va_end (ap); - for (i = 0, val = Qnil; i < count; i++) + for (val = Qnil, i = count - 1; i >= 0; i--) { if (type == CONSTYPE_PURE) val = pure_cons (objp[i], val); From e518bc71e8ae11ad81573d6dbf66317a047c4ba7 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Fri, 27 Jul 2012 12:46:58 +0200 Subject: [PATCH 14/89] * dbusbind.c (XD_DBUS_VALIDATE_BUS_ADDRESS): Canonicalize session bus address. (xd_close_bus, Fdbus_init_bus): Handle reference counter properly. --- src/ChangeLog | 6 +++ src/dbusbind.c | 129 +++++++++++++++++++++++++++---------------------- 2 files changed, 78 insertions(+), 57 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index ab870b56f1e..bd0422bd3c3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2012-07-27 Albinus Michael + + * dbusbind.c (XD_DBUS_VALIDATE_BUS_ADDRESS): Canonicalize session + bus address. + (xd_close_bus, Fdbus_init_bus): Handle reference counter properly. + 2012-07-27 Eli Zaretskii * alloc.c (listn): Fix the order the arguments are consed onto the diff --git a/src/dbusbind.c b/src/dbusbind.c index 86013d92c07..06f47643bbf 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c @@ -261,6 +261,7 @@ xd_symbol_to_dbus_type (Lisp_Object object) #define XD_DBUS_VALIDATE_BUS_ADDRESS(bus) \ do { \ + char const *session_bus_address = getenv ("DBUS_SESSION_BUS_ADDRESS"); \ if (STRINGP (bus)) \ { \ DBusAddressEntry **entries; \ @@ -272,6 +273,10 @@ xd_symbol_to_dbus_type (Lisp_Object object) /* Cleanup. */ \ dbus_error_free (&derror); \ dbus_address_entries_free (entries); \ + /* Canonicalize session bus address. */ \ + if (session_bus_address != NULL \ + && Fstring_equal (bus, build_string (session_bus_address))) \ + bus = QCdbus_session_bus; \ } \ \ else \ @@ -280,8 +285,7 @@ xd_symbol_to_dbus_type (Lisp_Object object) if (!(EQ (bus, QCdbus_system_bus) || EQ (bus, QCdbus_session_bus))) \ XD_SIGNAL2 (build_string ("Wrong bus name"), bus); \ /* We do not want to have an autolaunch for the session bus. */ \ - if (EQ (bus, QCdbus_session_bus) \ - && getenv ("DBUS_SESSION_BUS_ADDRESS") == NULL) \ + if (EQ (bus, QCdbus_session_bus) && session_bus_address == NULL) \ XD_SIGNAL2 (build_string ("No connection to bus"), bus); \ } \ } while (0) @@ -1071,19 +1075,19 @@ xd_close_bus (Lisp_Object bus) /* Retrieve bus address. */ connection = xd_get_connection_address (bus); - /* Close connection, if there isn't another shared application. */ if (xd_get_connection_references (connection) == 1) { + /* Close connection, if there isn't another shared application. */ XD_DEBUG_MESSAGE ("Close connection to bus %s", XD_OBJECT_TO_STRING (bus)); dbus_connection_close (connection); + + xd_registered_buses = Fdelete (val, xd_registered_buses); } - /* Decrement reference count. */ - dbus_connection_unref (connection); - - /* Remove bus from list of registered buses. */ - xd_registered_buses = Fdelete (val, xd_registered_buses); + else + /* Decrement reference count. */ + dbus_connection_unref (connection); /* Return. */ return; @@ -1124,65 +1128,76 @@ this connection to those buses. */) /* Close bus if it is already open. */ xd_close_bus (bus); - /* Initialize. */ - dbus_error_init (&derror); - - /* Open the connection. */ - if (STRINGP (bus)) - if (NILP (private)) - connection = dbus_connection_open (SSDATA (bus), &derror); - else - connection = dbus_connection_open_private (SSDATA (bus), &derror); + /* Check, whether we are still connected. */ + val = Fassoc (bus, xd_registered_buses); + if (!NILP (val)) + { + connection = xd_get_connection_address (bus); + dbus_connection_ref (connection); + } else - if (NILP (private)) - connection = dbus_bus_get (EQ (bus, QCdbus_system_bus) - ? DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, - &derror); - else - connection = dbus_bus_get_private (EQ (bus, QCdbus_system_bus) - ? DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, - &derror); + { + /* Initialize. */ + dbus_error_init (&derror); - if (dbus_error_is_set (&derror)) - XD_ERROR (derror); + /* Open the connection. */ + if (STRINGP (bus)) + if (NILP (private)) + connection = dbus_connection_open (SSDATA (bus), &derror); + else + connection = dbus_connection_open_private (SSDATA (bus), &derror); - if (connection == NULL) - XD_SIGNAL2 (build_string ("No connection to bus"), bus); + else + if (NILP (private)) + connection = dbus_bus_get (EQ (bus, QCdbus_system_bus) + ? DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, + &derror); + else + connection = dbus_bus_get_private (EQ (bus, QCdbus_system_bus) + ? DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, + &derror); - /* If it is not the system or session bus, we must register - ourselves. Otherwise, we have called dbus_bus_get, which has - configured us to exit if the connection closes - we undo this - setting. */ - if (STRINGP (bus)) - dbus_bus_register (connection, &derror); - else - dbus_connection_set_exit_on_disconnect (connection, FALSE); + if (dbus_error_is_set (&derror)) + XD_ERROR (derror); - if (dbus_error_is_set (&derror)) - XD_ERROR (derror); + if (connection == NULL) + XD_SIGNAL2 (build_string ("No connection to bus"), bus); - /* Add the watch functions. We pass also the bus as data, in order - to distinguish between the buses in xd_remove_watch. */ - if (!dbus_connection_set_watch_functions (connection, - xd_add_watch, - xd_remove_watch, - xd_toggle_watch, - SYMBOLP (bus) - ? (void *) XSYMBOL (bus) - : (void *) XSTRING (bus), - NULL)) - XD_SIGNAL1 (build_string ("Cannot add watch functions")); + /* If it is not the system or session bus, we must register + ourselves. Otherwise, we have called dbus_bus_get, which has + configured us to exit if the connection closes - we undo this + setting. */ + if (STRINGP (bus)) + dbus_bus_register (connection, &derror); + else + dbus_connection_set_exit_on_disconnect (connection, FALSE); - /* Add bus to list of registered buses. */ - XSETFASTINT (val, (intptr_t) connection); - xd_registered_buses = Fcons (Fcons (bus, val), xd_registered_buses); + if (dbus_error_is_set (&derror)) + XD_ERROR (derror); - /* We do not want to abort. */ - putenv ((char *) "DBUS_FATAL_WARNINGS=0"); + /* Add the watch functions. We pass also the bus as data, in + order to distinguish between the buses in xd_remove_watch. */ + if (!dbus_connection_set_watch_functions (connection, + xd_add_watch, + xd_remove_watch, + xd_toggle_watch, + SYMBOLP (bus) + ? (void *) XSYMBOL (bus) + : (void *) XSTRING (bus), + NULL)) + XD_SIGNAL1 (build_string ("Cannot add watch functions")); - /* Cleanup. */ - dbus_error_free (&derror); + /* Add bus to list of registered buses. */ + XSETFASTINT (val, (intptr_t) connection); + xd_registered_buses = Fcons (Fcons (bus, val), xd_registered_buses); + + /* We do not want to abort. */ + putenv ((char *) "DBUS_FATAL_WARNINGS=0"); + + /* Cleanup. */ + dbus_error_free (&derror); + } /* Return reference counter. */ refcount = xd_get_connection_references (connection); From 1c6ef030f8230690e3f7d8f31c1a2c1f293c9ae4 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Fri, 27 Jul 2012 12:56:03 +0200 Subject: [PATCH 15/89] * notifications.el (notifications-on-action-signal) (notifications-on-closed-signal): Use also the bus address for the map. (notifications-notify, notifications-close-notification) (notifications-get-capabilities): Add optional argument BUS. --- lisp/ChangeLog | 7 +++++++ lisp/notifications.el | 40 +++++++++++++++++++++++----------------- 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a91d5a2ea98..99adfb621f0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2012-07-27 Albinus Michael + + * notifications.el (notifications-on-action-signal) + (notifications-on-closed-signal): Use also the bus address for the map. + (notifications-notify, notifications-close-notification) + (notifications-get-capabilities): Add optional argument BUS. + 2012-07-27 Tassilo Horn * textmodes/reftex-vars.el (reftex-label-alist-builtin): Add diff --git a/lisp/notifications.el b/lisp/notifications.el index c762bb104ee..792298c26b7 100644 --- a/lisp/notifications.el +++ b/lisp/notifications.el @@ -93,8 +93,9 @@ (defun notifications-on-action-signal (id action) "Dispatch signals to callback functions from `notifications-on-action-map'." - (let* ((unique-name (dbus-event-service-name last-input-event)) - (entry (assoc (cons unique-name id) notifications-on-action-map))) + (let* ((bus (dbus-event-bus-name last-input-event)) + (unique-name (dbus-event-service-name last-input-event)) + (entry (assoc (list bus unique-name id) notifications-on-action-map))) (when entry (funcall (cadr entry) id action) (when (and (not (setq notifications-on-action-map @@ -107,8 +108,9 @@ "Dispatch signals to callback functions from `notifications-on-closed-map'." ;; notification-daemon prior 0.4.0 does not send a reason. So we ;; make it optional, and assume `undefined' as default. - (let* ((unique-name (dbus-event-service-name last-input-event)) - (entry (assoc (cons unique-name id) notifications-on-close-map)) + (let* ((bus (dbus-event-bus-name last-input-event)) + (unique-name (dbus-event-service-name last-input-event)) + (entry (assoc (list bus unique-name id) notifications-on-close-map)) (reason (or reason 4))) (when entry (funcall (cadr entry) @@ -123,6 +125,7 @@ "Send notification via D-Bus using the Freedesktop notification protocol. Various PARAMS can be set: + :bus The D-Bus bus, if different from `:session'. :title The notification title. :body The notification body text. :app-name The name of the application sending the notification. @@ -196,7 +199,8 @@ This function returns a notification id, an integer, which can be used to manipulate the notification item with `notifications-close-notification' or the `:replaces-id' argument of another `notifications-notify' call." - (let ((title (plist-get params :title)) + (let ((bus (or (plist-get params :bus) :session)) + (title (plist-get params :title)) (body (plist-get params :body)) (app-name (plist-get params :app-name)) (replaces-id (plist-get params :replaces-id)) @@ -272,9 +276,9 @@ of another `notifications-notify' call." (when y (add-to-list 'hints `(:dict-entry "y" (:variant :int32 ,y)) t)) - ;; Call Notify method + ;; Call Notify method. (setq id - (dbus-call-method :session + (dbus-call-method bus notifications-service notifications-path notifications-interface @@ -302,14 +306,14 @@ of another `notifications-notify' call." ;; restarted. (let ((on-action (plist-get params :on-action)) (on-close (plist-get params :on-close)) - (unique-name (dbus-get-name-owner :session notifications-service))) + (unique-name (dbus-get-name-owner bus notifications-service))) (when on-action (add-to-list 'notifications-on-action-map - (list (cons unique-name id) on-action)) + (list (list bus unique-name id) on-action)) (unless notifications-on-action-object (setq notifications-on-action-object (dbus-register-signal - :session + bus nil notifications-path notifications-interface @@ -318,11 +322,11 @@ of another `notifications-notify' call." (when on-close (add-to-list 'notifications-on-close-map - (list (cons unique-name id) on-close)) + (list (list bus unique-name id) on-close)) (unless notifications-on-close-object (setq notifications-on-close-object (dbus-register-signal - :session + bus nil notifications-path notifications-interface @@ -332,9 +336,10 @@ of another `notifications-notify' call." ;; Return notification id id)) -(defun notifications-close-notification (id) - "Close a notification with identifier ID." - (dbus-call-method :session +(defun notifications-close-notification (id &optional bus) + "Close a notification with identifier ID. +BUS can be a string denoting a D-Bus connection, the default is `:session'." + (dbus-call-method (or bus :session) notifications-service notifications-path notifications-interface @@ -343,8 +348,9 @@ of another `notifications-notify' call." (defvar dbus-debug) ; used in the macroexpansion of dbus-ignore-errors -(defun notifications-get-capabilities () +(defun notifications-get-capabilities (&optional bus) "Return the capabilities of the notification server, a list of strings. +BUS can be a string denoting a D-Bus connection, the default is `:session'. The following capabilities can be expected: :actions The server will provide the specified actions @@ -367,7 +373,7 @@ Further vendor-specific caps start with `:x-vendor', like `:x-gnome-foo-cap'." (dbus-ignore-errors (mapcar (lambda (x) (intern (concat ":" x))) - (dbus-call-method :session + (dbus-call-method (or bus :session) notifications-service notifications-path notifications-interface From 32770973be4d833eb33c277dad059cdb55217aaf Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Fri, 27 Jul 2012 13:10:53 +0200 Subject: [PATCH 16/89] Fix name typo. --- lisp/ChangeLog | 2 +- src/ChangeLog | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 99adfb621f0..b4ae3b2b877 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,4 +1,4 @@ -2012-07-27 Albinus Michael +2012-07-27 Michael Albinus * notifications.el (notifications-on-action-signal) (notifications-on-closed-signal): Use also the bus address for the map. diff --git a/src/ChangeLog b/src/ChangeLog index bd0422bd3c3..392e25398db 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,4 +1,4 @@ -2012-07-27 Albinus Michael +2012-07-27 Michael Albinus * dbusbind.c (XD_DBUS_VALIDATE_BUS_ADDRESS): Canonicalize session bus address. From 1e4be88cc192114695362edcffb7e31efe871983 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Fri, 27 Jul 2012 13:36:36 +0200 Subject: [PATCH 17/89] Fix type comparison error. --- src/dbusbind.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/dbusbind.c b/src/dbusbind.c index 06f47643bbf..93388d4b24a 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c @@ -274,8 +274,9 @@ xd_symbol_to_dbus_type (Lisp_Object object) dbus_error_free (&derror); \ dbus_address_entries_free (entries); \ /* Canonicalize session bus address. */ \ - if (session_bus_address != NULL \ - && Fstring_equal (bus, build_string (session_bus_address))) \ + if ((session_bus_address != NULL) \ + && (!NILP (Fstring_equal \ + (bus, build_string (session_bus_address))))) \ bus = QCdbus_session_bus; \ } \ \ From a90dfb95112ebff530ec5c7167c1402b10c2e49b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabi=C3=A1n=20Ezequiel=20Gallina?= Date: Fri, 27 Jul 2012 09:38:19 -0300 Subject: [PATCH 18/89] * lisp/progmodes/python.el (python-mode-map): Added keybinding for run-python. (python-shell-make-comint): Fix pop-to-buffer call. (run-python): Autoload. New arg SHOW. (python-shell-get-or-create-process): Do not pop python process buffer. --- lisp/ChangeLog | 9 +++++++++ lisp/progmodes/python.el | 35 +++++++++++++++++++---------------- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b4ae3b2b877..7401546c6d4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2012-07-27 Fabián Ezequiel Gallina + + * progmodes/python.el (python-mode-map): Added keybinding for + run-python. + (python-shell-make-comint): Fix pop-to-buffer call. + (run-python): Autoload. New arg SHOW. + (python-shell-get-or-create-process): Do not pop python process + buffer. + 2012-07-27 Michael Albinus * notifications.el (notifications-on-action-signal) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 132951aedc8..ab364a5318a 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -250,6 +250,7 @@ (define-key map "\C-c\C-tt" 'python-skeleton-try) (define-key map "\C-c\C-tw" 'python-skeleton-while) ;; Shell interaction + (define-key map "\C-c\C-p" 'run-python) (define-key map "\C-c\C-s" 'python-shell-send-string) (define-key map "\C-c\C-r" 'python-shell-send-region) (define-key map "\C-\M-x" 'python-shell-send-defun) @@ -1571,30 +1572,33 @@ non-nil the buffer is shown." (with-current-buffer buffer (inferior-python-mode) (python-util-clone-local-variables current-buffer)))) - (when pop - (pop-to-buffer proc-buffer-name)) + (and pop (pop-to-buffer proc-buffer-name t)) proc-buffer-name))) -(defun run-python (dedicated cmd) +;;;###autoload +(defun run-python (cmd &optional dedicated show) "Run an inferior Python process. Input and output via buffer named after `python-shell-buffer-name'. If there is a process already running in that buffer, just switch to it. -With argument, allows you to define DEDICATED, so a dedicated -process for the current buffer is open, and define CMD so you can -edit the command used to call the interpreter (default is value -of `python-shell-interpreter' and arguments defined in -`python-shell-interpreter-args'). Runs the hook -`inferior-python-mode-hook' (after the `comint-mode-hook' is -run). -\(Type \\[describe-mode] in the process buffer for a list of commands.)" + +With argument, allows you to define CMD so you can edit the +command used to call the interpreter and define DEDICATED, so a +dedicated process for the current buffer is open. When numeric +prefix arg is other than 0 or 4 do not SHOW. + +Runs the hook `inferior-python-mode-hook' (after the +`comint-mode-hook' is run). \(Type \\[describe-mode] in the +process buffer for a list of commands.)" (interactive (if current-prefix-arg (list + (read-string "Run Python: " (python-shell-parse-command)) (y-or-n-p "Make dedicated process? ") - (read-string "Run Python: " (python-shell-parse-command))) - (list nil (python-shell-parse-command)))) - (python-shell-make-comint cmd (python-shell-get-process-name dedicated)) + (= (prefix-numeric-value current-prefix-arg) 4)) + (list (python-shell-parse-command) nil t))) + (python-shell-make-comint + cmd (python-shell-get-process-name dedicated) show) dedicated) (defun run-python-internal () @@ -1611,7 +1615,6 @@ with user shells. Runs the hook `inferior-python-mode-hook' (after the `comint-mode-hook' is run). \(Type \\[describe-mode] in the process buffer for a list of commands.)" - (interactive) (set-process-query-on-exit-flag (get-buffer-process (python-shell-make-comint @@ -1638,7 +1641,7 @@ of commands.)" (global-proc-buffer-name (format "*%s*" global-proc-name)) (dedicated-running (comint-check-proc dedicated-proc-buffer-name)) (global-running (comint-check-proc global-proc-buffer-name)) - (current-prefix-arg 4)) + (current-prefix-arg 16)) (when (and (not dedicated-running) (not global-running)) (if (call-interactively 'run-python) (setq dedicated-running t) From e827b1eb40c21fc9b3f1398cd413c8d0c3daa903 Mon Sep 17 00:00:00 2001 From: Jay Belanger Date: Fri, 27 Jul 2012 10:05:13 -0500 Subject: [PATCH 19/89] calccomp.el (math-compose-expr): Undo previous change. --- lisp/ChangeLog | 4 ++++ lisp/calc/calccomp.el | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7401546c6d4..5bd1056f560 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2012-07-27 Jay Belanger + + * calc/calccomp.el (math-compose-expr): Undo previous change. + 2012-07-27 Fabián Ezequiel Gallina * progmodes/python.el (python-mode-map): Added keybinding for diff --git a/lisp/calc/calccomp.el b/lisp/calc/calccomp.el index 73e745bcf75..d8ad7e2cede 100644 --- a/lisp/calc/calccomp.el +++ b/lisp/calc/calccomp.el @@ -87,8 +87,7 @@ sn))) (defun math-compose-expr (a prec) - (let ((calc-multiplication-has-precedence nil) - (math-compose-level (1+ math-compose-level)) + (let ((math-compose-level (1+ math-compose-level)) (math-expr-opers (math-expr-ops)) spfn) (cond From aa81af715cbca7c85ffe38dd7eebef179be369d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabi=C3=A1n=20Ezequiel=20Gallina?= Date: Fri, 27 Jul 2012 13:42:19 -0300 Subject: [PATCH 20/89] Consistent completion in inferior python with emacs -nw. * progmodes/python.el (inferior-python-mode): replace "" binding in inferior-python-mode-map with "\t". (python-shell-completion-complete-at-point) (python-completion-complete-at-point): Remove interactive spec. --- lisp/ChangeLog | 8 ++++++++ lisp/progmodes/python.el | 4 +--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5bd1056f560..33d59c200c1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2012-07-27 Fabián Ezequiel Gallina + + Consistent completion in inferior python with emacs -nw. + * progmodes/python.el (inferior-python-mode): replace "" + binding in inferior-python-mode-map with "\t". + (python-shell-completion-complete-at-point) + (python-completion-complete-at-point): Remove interactive spec. + 2012-07-27 Jay Belanger * calc/calccomp.el (math-compose-expr): Undo previous change. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index ab364a5318a..4617ecc420d 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1545,7 +1545,7 @@ variable. 'python-shell-completion-complete-at-point nil 'local) (add-to-list (make-local-variable 'comint-dynamic-complete-functions) 'python-shell-completion-complete-at-point) - (define-key inferior-python-mode-map (kbd "") + (define-key inferior-python-mode-map "\t" 'python-shell-completion-complete-or-indent) (when python-shell-enable-font-lock (set (make-local-variable 'font-lock-defaults) @@ -1948,7 +1948,6 @@ completions on the current context." (defun python-shell-completion-complete-at-point () "Perform completion at point in inferior Python process." - (interactive) (and comint-last-prompt-overlay (> (point-marker) (overlay-end comint-last-prompt-overlay)) (python-shell-completion--do-completion-at-point @@ -2063,7 +2062,6 @@ Argument OUTPUT is a string with the output from the comint process." For this to work the best as possible you should call `python-shell-send-buffer' from time to time so context in inferior python process is updated properly." - (interactive) (let ((process (python-shell-get-process))) (if (not process) (error "Completion needs an inferior Python process running") From cc436baac4522c48cd083a20f9e6a653f58e331f Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Fri, 27 Jul 2012 19:58:58 +0200 Subject: [PATCH 21/89] Minor fix to my previous changes. --- lisp/textmodes/reftex.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el index c2270323843..ae2f8fb8ea2 100644 --- a/lisp/textmodes/reftex.el +++ b/lisp/textmodes/reftex.el @@ -1320,7 +1320,7 @@ This enforces rescanning the buffer on next use." "\\)\\([[{][^]}]*[]}]\\)*[[{]\\(%s\\)[]}]")) (find-label-re-format (concat "\\(" - "\\[[^]]*label[[:space:]]*=[[:space:]]*{?\\(?1:[^],}]+\\)}?[^[]*\\]" + "label[[:space:]]*=[[:space:]]*" "\\|" (mapconcat 'regexp-quote (append '("\\label") macros-with-labels) "\\|") From c20fdd9eb75e484e12382494e4fb8931c753361b Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 27 Jul 2012 13:50:02 -0700 Subject: [PATCH 22/89] Adjust GDB to reflect pvec_type changes. * .gdbinit (xvectype, xpr, xbacktrace): Adjust to reflect the 2012-07-04 changes to pseudovector representation. Problem reported by Eli Zaretskii in . --- src/.gdbinit | 14 +++++++++++--- src/ChangeLog | 7 +++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/.gdbinit b/src/.gdbinit index 25b555b8540..620ca63a0d6 100644 --- a/src/.gdbinit +++ b/src/.gdbinit @@ -653,7 +653,11 @@ end define xvectype xgetptr $ set $size = ((struct Lisp_Vector *) $ptr)->header.size - output ($size & PSEUDOVECTOR_FLAG) ? (enum pvec_type) ($size & PVEC_TYPE_MASK) : $size & ~ARRAY_MARK_FLAG + if ($size & PSEUDOVECTOR_FLAG) + output (enum pvec_type) (($size & PVEC_TYPE_MASK) >> PSEUDOVECTOR_SIZE_BITS) + else + output $size & ~ARRAY_MARK_FLAG + end echo \n end document xvectype @@ -992,7 +996,7 @@ define xpr if $type == Lisp_Vectorlike set $size = ((struct Lisp_Vector *) $ptr)->header.size if ($size & PSEUDOVECTOR_FLAG) - set $vec = (enum pvec_type) ($size & PVEC_TYPE_MASK) + set $vec = (enum pvec_type) (($size & PVEC_TYPE_MASK) >> PSEUDOVECTOR_SIZE_BITS) if $vec == PVEC_NORMAL_VECTOR xvector end @@ -1127,7 +1131,11 @@ define xbacktrace if $type == Lisp_Vectorlike xgetptr (*$bt->function) set $size = ((struct Lisp_Vector *) $ptr)->header.size - output ($size & PSEUDOVECTOR_FLAG) ? (enum pvec_type) ($size & PVEC_TYPE_MASK) : $size & ~ARRAY_MARK_FLAG + if ($size & PSEUDOVECTOR_FLAG) + output (enum pvec_type) (($size & PVEC_TYPE_MASK) >> PSEUDOVECTOR_SIZE_BITS) + else + output $size & ~ARRAY_MARK_FLAG + end else printf "Lisp type %d", $type end diff --git a/src/ChangeLog b/src/ChangeLog index 392e25398db..42b92de5c26 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2012-07-27 Paul Eggert + + Adjust GDB to reflect pvec_type changes (Bug#12036). + * .gdbinit (xvectype, xpr, xbacktrace): Adjust to reflect the + 2012-07-04 changes to pseudovector representation. Problem + reported by Eli Zaretskii in . + 2012-07-27 Michael Albinus * dbusbind.c (XD_DBUS_VALIDATE_BUS_ADDRESS): Canonicalize session From 7747226193850b48d81443fd38ab89a9daa5658e Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 28 Jul 2012 10:38:32 +0300 Subject: [PATCH 23/89] Fix bug #12073 with outdated FAQ entry. doc/misc/faq.texi (Right-to-left alphabets): Update for Emacs 24. --- doc/misc/ChangeLog | 5 +++++ doc/misc/faq.texi | 12 ++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 389e937932b..a4ecfab92fc 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,8 @@ +2012-07-28 Eli Zaretskii + + * faq.texi (Right-to-left alphabets): Update for Emacs 24. + (Bug#12073) + 2012-06-19 Glenn Morris * Makefile.in: Rename infodir to buildinfodir throughout. (Bug#11737) diff --git a/doc/misc/faq.texi b/doc/misc/faq.texi index 9bb3feb52e1..2983667c5cd 100644 --- a/doc/misc/faq.texi +++ b/doc/misc/faq.texi @@ -4044,13 +4044,13 @@ Emacs Manual}. For more sophisticated methods, @cindex Right-to-left alphabets @cindex Hebrew, handling with Emacs @cindex Semitic alphabets -@cindex Arabic alphabets -@cindex Bidirectional text +@cindex Arabic +@cindex Farsi +@cindex bidirectional scripts -Emacs supports Hebrew characters (ISO 8859-8) since version 20, but does -not yet support right-to-left character entry and display. The -@uref{http://lists.gnu.org/mailman/listinfo/emacs-bidi, emacs-bidi -mailing list} discusses development of support for this feature. +Emacs supports display and editing of bidirectional scripts, such as +Arabic, Farsi, and Hebrew, since version 24.1. +@xref{New in Emacs 24, bidirectional display}. @node How to add fonts From 73e0cbc0f5d1f5a70b18f8357979142bb265669f Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 28 Jul 2012 10:47:58 +0300 Subject: [PATCH 24/89] Fix bug #12062 with a typo in Elisp manual. doc/lispref/nonascii.texi (Character Sets): Fix a typo. --- doc/lispref/ChangeLog | 4 ++++ doc/lispref/nonascii.texi | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 1ab3aa6ee1c..6b0486af738 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,7 @@ +2012-07-28 Eli Zaretskii + + * nonascii.texi (Character Sets): Fix a typo. (Bug#12062) + 2012-07-25 Paul Eggert Prefer typical American spelling for "acknowledgment". diff --git a/doc/lispref/nonascii.texi b/doc/lispref/nonascii.texi index 7895d1616f5..2f6f516c587 100644 --- a/doc/lispref/nonascii.texi +++ b/doc/lispref/nonascii.texi @@ -606,7 +606,7 @@ The value is a list of all defined character set names. @end defvar @defun charset-priority-list &optional highestp -This functions returns a list of all defined character sets ordered by +This function returns a list of all defined character sets ordered by their priority. If @var{highestp} is non-@code{nil}, the function returns a single character set of the highest priority. @end defun From df81cd291bc12c494fdeaeb7849ad7ef754dbbc1 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 28 Jul 2012 10:59:34 +0300 Subject: [PATCH 25/89] Fix --without-x build. src/xdisp.c (init_iterator): Don't reference tip_frame in a build --without-x. (Bug#11742) --- src/ChangeLog | 5 +++++ src/xdisp.c | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 42b92de5c26..8d0e7caf4ea 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2012-07-28 Eli Zaretskii + + * xdisp.c (init_iterator): Don't reference tip_frame in a build + --without-x. (Bug#11742) + 2012-07-27 Paul Eggert Adjust GDB to reflect pvec_type changes (Bug#12036). diff --git a/src/xdisp.c b/src/xdisp.c index ecb9f0d50c9..a11b117f067 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -2736,7 +2736,11 @@ init_iterator (struct it *it, struct window *w, frames when the fringes are turned off. But leave the dimensions zero for tooltip frames, as these glyphs look ugly there and also sabotage calculations of tooltip dimensions in x-show-tip. */ - if (!(FRAMEP (tip_frame) && it->f == XFRAME (tip_frame))) +#ifdef HAVE_WINDOW_SYSTEM + if (!(FRAME_WINDOW_P (it->f) + && FRAMEP (tip_frame) + && it->f == XFRAME (tip_frame))) +#endif { if (it->line_wrap == TRUNCATE) { From 049a0936caca462a2f12107813a24b70eeb97c3e Mon Sep 17 00:00:00 2001 From: David Engster Date: Sat, 28 Jul 2012 11:19:53 +0200 Subject: [PATCH 26/89] Maybe return expanded XML qnames as plain symbols (Bug#11916). * xml.el (xml-node-name, xml-parse-file, xml-parse-region): Explanation of new 'symbol-qnames feature in doc-strings. (xml-maybe-do-ns): Return expanded names as plain symbols if 'symbol-qnames was provided in XML-NS argument (Bug#11916). (xml-parse-tag-1): Deal with new definition of PARSE-NS argument. --- lisp/ChangeLog | 8 ++++++ lisp/xml.el | 77 +++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 72 insertions(+), 13 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 33d59c200c1..a158e4f347a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2012-07-28 David Engster + + * xml.el (xml-node-name, xml-parse-file, xml-parse-region): + Explanation of new 'symbol-qnames feature in doc-strings. + (xml-maybe-do-ns): Return expanded names as plain symbols if + 'symbol-qnames was provided in XML-NS argument (Bug#11916). + (xml-parse-tag-1): Deal with new definition of PARSE-NS argument. + 2012-07-27 Fabián Ezequiel Gallina Consistent completion in inferior python with emacs -nw. diff --git a/lisp/xml.el b/lisp/xml.el index e2788e5e756..179fdd6b5cc 100644 --- a/lisp/xml.el +++ b/lisp/xml.el @@ -126,7 +126,10 @@ tag. For example, would be represented by - '(\"\" . \"foo\")." + '(\"\" . \"foo\"). + +If you'd just like a plain symbol instead, use 'symbol-qnames in +the PARSE-NS argument." (car node)) @@ -313,7 +316,22 @@ only those characters, have whitespace syntax.") "Parse the well-formed XML file FILE. Return the top node with all its children. If PARSE-DTD is non-nil, the DTD is parsed rather than skipped. -If PARSE-NS is non-nil, then QNAMES are expanded." + +If PARSE-NS is non-nil, then QNAMES are expanded. By default, +the variable `xml-default-ns' is the mapping from namespaces to +URIs, and expanded names will be returned as a cons + + (\"namespace:\" . \"foo\"). + +If PARSE-NS is an alist, it will be used as the mapping from +namespace to URIs instead. + +If it is the symbol 'symbol-qnames, expanded names will be +returned as a plain symbol 'namespace:foo instead of a cons. + +Both features can be combined by providing a cons cell + + (symbol-qnames . ALIST)." (with-temp-buffer (insert-file-contents file) (xml--parse-buffer parse-dtd parse-ns))) @@ -329,7 +347,21 @@ If END is nil, it defaults to `point-max'. If BUFFER is nil, it defaults to the current buffer. If PARSE-DTD is non-nil, parse the DTD and return it as the first element of the list. -If PARSE-NS is non-nil, expand QNAMES." +If PARSE-NS is non-nil, then QNAMES are expanded. By default, +the variable `xml-default-ns' is the mapping from namespaces to +URIs, and expanded names will be returned as a cons + + (\"namespace:\" . \"foo\"). + +If PARSE-NS is an alist, it will be used as the mapping from +namespace to URIs instead. + +If it is the symbol 'symbol-qnames, expanded names will be +returned as a plain symbol 'namespace:foo instead of a cons. + +Both features can be combined by providing a cons cell + + (symbol-qnames . ALIST)." ;; Use fixed syntax table to ensure regexp char classes and syntax ;; specs DTRT. (unless buffer @@ -386,26 +418,36 @@ is nil. During namespace-aware parsing, any name without a namespace is put into the namespace identified by DEFAULT. nil is used to -specify that the name shouldn't be given a namespace." +specify that the name shouldn't be given a namespace. +Expanded names will by default be returned as a cons. If you +would like to get plain symbols instead, provide a cons cell + + (symbol-qnames . ALIST) + +in the XML-NS argument." (if (consp xml-ns) - (let* ((nsp (string-match ":" name)) + (let* ((symbol-qnames (eq (car-safe xml-ns) 'symbol-qnames)) + (nsp (string-match ":" name)) (lname (if nsp (substring name (match-end 0)) name)) (prefix (if nsp (substring name 0 (match-beginning 0)) default)) (special (and (string-equal lname "xmlns") (not prefix))) ;; Setting default to nil will insure that there is not ;; matching cons in xml-ns. In which case we (ns (or (cdr (assoc (if special "xmlns" prefix) - xml-ns)) + (if symbol-qnames (cdr xml-ns) xml-ns))) ""))) - (cons ns (if special "" lname))) + (if (and symbol-qnames + (not (string= prefix "xmlns"))) + (intern (concat ns lname)) + (cons ns (if special "" lname)))) (intern name))) (defun xml-parse-tag (&optional parse-dtd parse-ns) "Parse the tag at point. If PARSE-DTD is non-nil, the DTD of the document, if any, is parsed and returned as the first element in the list. -If PARSE-NS is non-nil, expand QNAMES; if the value of PARSE-NS -is a list, use it as an alist mapping namespaces to URIs. +If PARSE-NS is non-nil, expand QNAMES; for further details, see +`xml-parse-region'. Return one of: - a list : the matching node @@ -425,9 +467,16 @@ Return one of: (defun xml-parse-tag-1 (&optional parse-dtd parse-ns) "Like `xml-parse-tag', but possibly modify the buffer while working." - (let ((xml-validating-parser (or parse-dtd xml-validating-parser)) - (xml-ns (cond ((consp parse-ns) parse-ns) - (parse-ns xml-default-ns)))) + (let* ((xml-validating-parser (or parse-dtd xml-validating-parser)) + (xml-ns + (cond ((eq parse-ns 'symbol-qnames) + (cons 'symbol-qnames xml-default-ns)) + ((or (consp (car-safe parse-ns)) + (and (eq (car-safe parse-ns) 'symbol-qnames) + (listp (cdr parse-ns)))) + parse-ns) + (parse-ns + xml-default-ns)))) (cond ;; Processing instructions, like . ((looking-at "<\\?") @@ -475,7 +524,9 @@ Return one of: (equal "http://www.w3.org/2000/xmlns/" (caar attr))) (push (cons (cdar attr) (cdr attr)) - xml-ns)))) + (if (symbolp (car xml-ns)) + (cdr xml-ns) + xml-ns))))) (setq children (list attrs (xml-maybe-do-ns node-name "" xml-ns))) (cond ;; is this an empty element ? From 345a2258671ec587a32129daf37fb53b3eea903e Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sat, 28 Jul 2012 18:38:55 +0800 Subject: [PATCH 27/89] * simple.el (delete-trailing-lines): New option. (delete-trailing-whitespace): Obey it. Fixes: debbugs:11879 --- etc/NEWS | 4 ++++ lisp/ChangeLog | 5 +++++ lisp/simple.el | 28 ++++++++++++++++++++++------ 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index ce44a530e26..0a4157a4557 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -147,6 +147,10 @@ for it. * Editing Changes in Emacs 24.2 +** New option `delete-trailing-lines' specifies whether the +M-x delete-trailing-lines command should delete trailing lines at the +end of the buffer. It defaults to t. + ** Search changes *** Global `M-s _' starts a symbol (identifier) incremental search, diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a158e4f347a..410a23592df 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-07-28 Chong Yidong + + * simple.el (delete-trailing-lines): New option. + (delete-trailing-whitespace): Obey it (Bug#11879). + 2012-07-28 David Engster * xml.el (xml-node-name, xml-parse-file, xml-parse-region): diff --git a/lisp/simple.el b/lisp/simple.el index 3240ede0299..2011ff2b1bb 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -564,13 +564,28 @@ On nonblank line, delete any immediately following blank lines." (if (looking-at "^[ \t]*\n\\'") (delete-region (point) (point-max))))) +(defcustom delete-trailing-lines t + "If non-nil, \\[delete-trailing-whitespace] deletes trailing lines. +Trailing lines are deleted only if `delete-trailing-whitespace' +is called on the entire buffer (rather than an active region)." + :type 'boolean + :group 'editing + :version "24.2") + (defun delete-trailing-whitespace (&optional start end) - "Delete all the trailing whitespace across the current buffer. -All whitespace after the last non-whitespace character in a line is deleted. -This respects narrowing, created by \\[narrow-to-region] and friends. -A formfeed is not considered whitespace by this function. -If END is nil, also delete all trailing lines at the end of the buffer. -If the region is active, only delete whitespace within the region." + "Delete trailing whitespace between START and END. +If called interactively, START and END are the start/end of the +region if the mark is active, or of the buffer's accessible +portion if the mark is inactive. + +This command deletes whitespace characters after the last +non-whitespace character in each line between START and END. It +does not consider formfeed characters to be whitespace. + +If this command acts on the entire buffer (i.e. if called +interactively with the mark inactive, or called from Lisp with +END nil), it also deletes all trailing lines at the end of the +buffer if the variable `delete-trailing-lines' is non-nil." (interactive (progn (barf-if-buffer-read-only) (if (use-region-p) @@ -590,6 +605,7 @@ If the region is active, only delete whitespace within the region." ;; Delete trailing empty lines. (goto-char end-marker) (when (and (not end) + delete-trailing-lines ;; Really the end of buffer. (save-restriction (widen) (eobp)) (<= (skip-chars-backward "\n") -2)) From 7fa20d96f1c9e351b783cfa3347de3ca7f26a7d6 Mon Sep 17 00:00:00 2001 From: David Engster Date: Sat, 28 Jul 2012 13:07:17 +0200 Subject: [PATCH 28/89] Fix various issues with url-dav package (Bug#11916). * url-dav.el (url-dav-supported-p): Added doc-string and remove check for feature `xml' and function `xml-expand-namespace' which never existed in Emacs proper. (url-dav-process-response): Remove all indentation and newlines from XML before parsing. Change call to `xml-parse-region' to do namespace expansion with simple qualified names (Bug#11916). (url-dav-request): Add autoload. (url-dav-directory-files): Properly deal with empty directories. Unhex URL before generating relative URLs. (url-dav-file-directory-p): Fix check for 'DAV:collection. --- lisp/url/ChangeLog | 13 +++++++++++++ lisp/url/url-dav.el | 32 +++++++++++++++++++++----------- 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index 0fc48907f40..ae224f4102f 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog @@ -1,3 +1,16 @@ +2012-07-28 David Engster + + * url-dav.el (url-dav-supported-p): Added doc-string and remove + check for feature `xml' and function `xml-expand-namespace' which + never existed in Emacs proper. + (url-dav-process-response): Remove all indentation and newlines + from XML before parsing. Change call to `xml-parse-region' to do + namespace expansion with simple qualified names (Bug#11916). + (url-dav-request): Add autoload. + (url-dav-directory-files): Properly deal with empty directories. + Unhex URL before generating relative URLs. + (url-dav-file-directory-p): Fix check for 'DAV:collection. + 2012-07-11 Stefan Monnier * url.el, url-queue.el, url-parse.el, url-http.el, url-future.el: diff --git a/lisp/url/url-dav.el b/lisp/url/url-dav.el index 77e48b0e47d..4bb03369b9b 100644 --- a/lisp/url/url-dav.el +++ b/lisp/url/url-dav.el @@ -53,10 +53,10 @@ ;;;###autoload (defun url-dav-supported-p (url) - (and (featurep 'xml) - (fboundp 'xml-expand-namespace) - (url-intersection url-dav-supported-protocols - (plist-get (url-http-options url) 'dav)))) + "Return WebDAV protocol version supported by URL. +Returns nil if WebDAV is not supported." + (url-intersection url-dav-supported-protocols + (plist-get (url-http-options url) 'dav))) (defun url-dav-node-text (node) "Return the text data from the XML node NODE." @@ -385,7 +385,12 @@ XML document." (when buffer (unwind-protect (with-current-buffer buffer + ;; First remove all indentation and line endings (goto-char url-http-end-of-headers) + (indent-rigidly (point) (point-max) -1000) + (save-excursion + (while (re-search-forward "\r?\n" nil t) + (replace-match ""))) (setq overall-status url-http-response-status) ;; XML documents can be transferred as either text/xml or @@ -395,7 +400,7 @@ XML document." url-http-content-type (string-match "\\`\\(text\\|application\\)/xml" url-http-content-type)) - (setq tree (xml-parse-region (point) (point-max))))) + (setq tree (xml-parse-region (point) (point-max) nil nil 'symbol-qnames)))) ;; Clean up after ourselves. (kill-buffer buffer))) @@ -411,6 +416,7 @@ XML document." ;; nobody but us needs to know the difference. (list (cons url properties)))))) +;;;###autoload (defun url-dav-request (url method tag body &optional depth headers namespaces) "Perform WebDAV operation METHOD on URL. Return the parsed responses. @@ -768,8 +774,8 @@ files in the collection as well." (defun url-dav-directory-files (url &optional full match nosort files-only) "Return a list of names of files in URL. There are three optional arguments: -If FULL is non-nil, return absolute file names. Otherwise return names - that are relative to the specified directory. +If FULL is non-nil, return absolute URLs. Otherwise return names + that are relative to the specified URL. If MATCH is non-nil, mention only file names that match the regexp MATCH. If NOSORT is non-nil, the list is not sorted--its order is unpredictable. NOSORT is useful if you plan to sort the result yourself." @@ -779,8 +785,9 @@ If NOSORT is non-nil, the list is not sorted--its order is unpredictable. (files nil) (parsed-url (url-generic-parse-url url))) - (if (= (length properties) 1) - (signal 'file-error (list "Opening directory" "not a directory" url))) + (when (and (= (length properties) 1) + (not (url-dav-file-directory-p url))) + (signal 'file-error (list "Opening directory" "not a directory" url))) (while properties (setq child-props (pop properties) @@ -794,7 +801,9 @@ If NOSORT is non-nil, the list is not sorted--its order is unpredictable. ;; are not supposed to return fully-qualified names. (setq child-url (url-expand-file-name child-url parsed-url)) (if (not full) - (setq child-url (substring child-url (length url)))) + ;; Parts of the URL might be hex'ed. + (setq child-url (substring (url-unhex-string child-url) + (length url)))) ;; We don't want '/' as the last character in filenames... (if (string-match "/$" child-url) @@ -814,7 +823,8 @@ If NOSORT is non-nil, the list is not sorted--its order is unpredictable. (defun url-dav-file-directory-p (url) "Return t if URL names an existing DAV collection." (let ((properties (cdar (url-dav-get-properties url '(DAV:resourcetype))))) - (eq (plist-get properties 'DAV:resourcetype) 'DAV:collection))) + (when (member 'DAV:collection (plist-get properties 'DAV:resourcetype)) + t))) (defun url-dav-make-directory (url &optional parents) "Create the directory DIR and any nonexistent parent dirs." From 20329d736fea9768c118f09cf580ad82c40b62bd Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 28 Jul 2012 14:21:43 +0300 Subject: [PATCH 29/89] More fixes in lisp/ for parallel builds on MS-Windows. lisp/makefile.w32-in (custom-deps, finder-data, updates, compile) (compile-always, compile-first) ($(lisp)/calendar/cal-loaddefs.el) ($(lisp)/calendar/diary-loaddefs.el) ($(lisp)/calendar/hol-loaddefs.el, $(lisp)/mh-e/mh-loaddefs.el) ($(lisp)/net/tramp-loaddefs.el, bootstrap) ($(lisp)/progmodes/cc-mode.elc): Depend on $(lisp)subdirs.el, instead of on update-subdirs. (bootstrap-clean): Delete $(lisp)/subdirs.el. --- lisp/ChangeLog | 12 ++++++++++++ lisp/makefile.w32-in | 28 +++++++++++++++------------- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 410a23592df..d8e8575db89 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,15 @@ +2012-07-28 Eli Zaretskii + + * makefile.w32-in (custom-deps, finder-data, updates, compile) + (compile-always, compile-first) + ($(lisp)/calendar/cal-loaddefs.el) + ($(lisp)/calendar/diary-loaddefs.el) + ($(lisp)/calendar/hol-loaddefs.el, $(lisp)/mh-e/mh-loaddefs.el) + ($(lisp)/net/tramp-loaddefs.el, bootstrap) + ($(lisp)/progmodes/cc-mode.elc): Depend on $(lisp)subdirs.el, + instead of on update-subdirs. + (bootstrap-clean): Delete $(lisp)/subdirs.el. + 2012-07-28 Chong Yidong * simple.el (delete-trailing-lines): New option. diff --git a/lisp/makefile.w32-in b/lisp/makefile.w32-in index 92d939af018..c7d883e4295 100644 --- a/lisp/makefile.w32-in +++ b/lisp/makefile.w32-in @@ -168,12 +168,12 @@ $(lisp)/cus-load.el: # WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as # this can break with GNU Make 3.81 and later if sh.exe is used. -custom-deps: $(lisp)/cus-load.el $(lisp)/loaddefs.el doit +custom-deps: $(lisp)/cus-load.el $(lisp)/loaddefs.el $(lisp)/subdirs.el doit @echo Directories: $(WINS_UPDATES) -$(emacs) -l cus-dep --eval $(ARGQUOTE)(setq find-file-hook nil)$(ARGQUOTE) \ -f custom-make-dependencies $(lisp) $(WINS_UPDATES) -finder-data: $(lisp)/loaddefs.el doit +finder-data: $(lisp)/loaddefs.el $(lisp)/subdirs.el doit @echo Directories: $(WINS_UPDATES) $(emacs) -l finder -f finder-compile-keywords-make-dist $(lisp) $(WINS_UPDATES) @@ -243,7 +243,7 @@ update-subdirs-SH: doit $(srcdir)/build-aux/update-subdirs $$file; \ done; -updates: update-subdirs autoloads mh-autoloads finder-data custom-deps +updates: $(lisp)/subdirs.el autoloads mh-autoloads finder-data custom-deps # This is useful after "bzr up". bzr-update: recompile autoloads finder-data custom-deps @@ -311,7 +311,7 @@ TAGS-LISP-CMD: $(lisptagsfiles1) $(lisptagsfiles2) $(lisptagsfiles3) $(lisptagsf # compiled find the right files. # Need separate version for sh and native cmd.exe -compile: update-subdirs compile-$(SHELLTYPE) doit +compile: $(lisp)/subdirs.el compile-$(SHELLTYPE) doit compile-CMD: autoloads # -for %%f in ($(lisp) $(WINS)) do for %%g in (%%f\*.elc) do @attrib -r %%g @@ -340,7 +340,7 @@ compile-SH: autoloads # unconditionally. Some files don't actually get compiled because they # set the local variable no-byte-compile. -compile-always: update-subdirs compile-always-$(SHELLTYPE) doit +compile-always: $(lisp)/subdirs.el compile-always-$(SHELLTYPE) doit compile-always-CMD: # -for %%f in ($(lisp) $(WINS)) do for %%g in (%%f\*.elc) do @attrib -r %%g @@ -383,7 +383,7 @@ backup-compiled-files: compile-after-backup: backup-compiled-files compile-always compile-first: $(lisp)/emacs-lisp/bytecomp.elc $(lisp)/emacs-lisp/byte-opt.elc \ - $(lisp)/emacs-lisp/autoload.elc + $(lisp)/emacs-lisp/autoload.elc $(lisp)/subdirs.el # Recompile all Lisp files which are newer than their .elc files. # Note that this doesn't create .elc files. It only recompiles if an @@ -393,7 +393,7 @@ compile-first: $(lisp)/emacs-lisp/bytecomp.elc $(lisp)/emacs-lisp/byte-opt.elc recompile: compile-first autoloads doit $(lisp)/progmodes/cc-mode.elc $(emacs) --eval $(ARGQUOTE)(batch-byte-recompile-directory 0)$(ARGQUOTE) $(lisp) -$(lisp)/calendar/cal-loaddefs.el: update-subdirs +$(lisp)/calendar/cal-loaddefs.el: $(lisp)/subdirs.el "$(EMACS)" $(EMACSOPT) -l autoload \ --eval "(setq generate-autoload-cookie \";;;###cal-autoload\")" \ --eval "(setq find-file-suppress-same-file-warnings t)" \ @@ -401,7 +401,7 @@ $(lisp)/calendar/cal-loaddefs.el: update-subdirs -f w32-batch-update-autoloads "$(lisp)/calendar/cal-loaddefs.el" \ $(MAKE) ./calendar -$(lisp)/calendar/diary-loaddefs.el: update-subdirs +$(lisp)/calendar/diary-loaddefs.el: $(lisp)/subdirs.el "$(EMACS)" $(EMACSOPT) -l autoload \ --eval "(setq generate-autoload-cookie \";;;###diary-autoload\")" \ --eval "(setq find-file-suppress-same-file-warnings t)" \ @@ -409,7 +409,7 @@ $(lisp)/calendar/diary-loaddefs.el: update-subdirs -f w32-batch-update-autoloads $(lisp)/calendar/diary-loaddefs.el \ $(MAKE) ./calendar -$(lisp)/calendar/hol-loaddefs.el: update-subdirs +$(lisp)/calendar/hol-loaddefs.el: $(lisp)/subdirs.el "$(EMACS)" $(EMACSOPT) -l autoload \ --eval "(setq generate-autoload-cookie \";;;###holiday-autoload\")" \ --eval "(setq find-file-suppress-same-file-warnings t)" \ @@ -437,7 +437,7 @@ MH_E_SRC = $(lisp)/mh-e/mh-acros.el $(lisp)/mh-e/mh-alias.el \ # See the commentary for autoloads above for why we use ./mh-e below # instead of $(lisp)/mh-e. mh-autoloads: $(lisp)/mh-e/mh-loaddefs.el -$(lisp)/mh-e/mh-loaddefs.el: $(MH_E_SRC) update-subdirs +$(lisp)/mh-e/mh-loaddefs.el: $(MH_E_SRC) $(lisp)/subdirs.el "$(EMACS)" $(EMACSOPT) \ -l autoload \ --eval $(ARGQUOTE)(setq generate-autoload-cookie $(DQUOTE);;;###mh-autoload$(DQUOTE))$(ARGQUOTE) \ @@ -456,7 +456,7 @@ TRAMP_SRC = $(lisp)/net/tramp.el $(lisp)/net/tramp-cache.el \ $(lisp)/net/tramp-smb.el $(lisp)/net/tramp-uu.el \ $(lisp)/net/trampver.el -$(lisp)/net/tramp-loaddefs.el: $(TRAMP_SRC) update-subdirs +$(lisp)/net/tramp-loaddefs.el: $(TRAMP_SRC) $(lisp)/subdirs.el "$(EMACS)" $(EMACSOPT) \ -l autoload \ --eval $(ARGQUOTE)(setq generate-autoload-cookie $(DQUOTE);;;###tramp-autoload$(DQUOTE))$(ARGQUOTE) \ @@ -481,6 +481,7 @@ $(lisp)/net/tramp-loaddefs.el: $(TRAMP_SRC) update-subdirs # Need separate version for sh and native cmd.exe bootstrap-clean: - $(DEL) $(lisp)/loaddefs.el + - $(DEL) $(lisp)/subdirs.el $(MAKE) $(MFLAGS) bootstrap-clean-$(SHELLTYPE) bootstrap-clean-CMD: @@ -496,7 +497,7 @@ bootstrap-clean-SH: # When done, remove bootstrap-emacs from ../bin, so that # it will not be mistaken for an installed binary. -bootstrap: update-subdirs compile finder-data custom-deps +bootstrap: $(lisp)/subdirs.el compile finder-data custom-deps - $(DEL) "$(EMACS)" # @@ -600,7 +601,8 @@ $(lisp)/progmodes/cc-langs.elc: $(lisp)/progmodes/cc-vars.elc \ $(lisp)/progmodes/cc-mode.elc: $(lisp)/progmodes/cc-langs.elc \ $(lisp)/progmodes/cc-vars.elc $(lisp)/progmodes/cc-engine.elc \ $(lisp)/progmodes/cc-styles.elc $(lisp)/progmodes/cc-cmds.elc \ - $(lisp)/progmodes/cc-align.elc $(lisp)/progmodes/cc-menus.elc + $(lisp)/progmodes/cc-align.elc $(lisp)/progmodes/cc-menus.elc \ + $(lisp)/subdirs.el $(lisp)/progmodes/cc-styles.elc: $(lisp)/progmodes/cc-vars.elc \ $(lisp)/progmodes/cc-align.elc From 69c3b839f881e2cd3d9b8c8cc78a4a25a4f7399c Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Sat, 28 Jul 2012 11:38:47 +0000 Subject: [PATCH 30/89] message.el: defalias mail-dont-reply-to if needed --- lisp/gnus/ChangeLog | 5 +++++ lisp/gnus/message.el | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 80ede10c8c4..0476fc043c2 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,8 @@ +2012-07-27 Julien Danjou + + * message.el (fboundp): Add a defalias on `mail-dont-reply-to' for + Emacs < 24.1 + 2012-07-27 Katsumi Yamaoka * message.el (message-kill-address): Don't kill last newline. diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index e56a6c6d078..939d56bbfd8 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -1933,10 +1933,13 @@ You must have the \"hashcash\" binary installed, see `hashcash-path'." (autoload 'nndraft-request-associate-buffer "nndraft") (autoload 'nndraft-request-expire-articles "nndraft") (autoload 'nnvirtual-find-group-art "nnvirtual") -(autoload 'mail-dont-reply-to "mail-utils") (autoload 'rmail-msg-is-pruned "rmail") (autoload 'rmail-output "rmailout") +;; Emacs < 24.1 do not have mail-dont-reply-to +(unless (fboundp 'mail-dont-reply-to) + (defalias 'mail-dont-reply-to 'rmail-dont-reply-to)) + ;;; From 1eee634131dea9cf32d6ab83a06c0776b680fe8e Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sat, 28 Jul 2012 22:18:51 +0800 Subject: [PATCH 31/89] In C-x v L and C-x v D, prompt for directory if there is no default backend. * lisp/vc/vc.el (vc-root-diff, vc-print-root-log): Prompt for a directory if vc-deduce-backend returns nil. Fixes: debbugs:7350 --- lisp/ChangeLog | 3 +++ lisp/vc/vc.el | 22 ++++++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d8e8575db89..f31218506ba 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -12,6 +12,9 @@ 2012-07-28 Chong Yidong + * vc/vc.el (vc-root-diff, vc-print-root-log): Prompt for a + directory if vc-deduce-backend returns nil (Bug#7350). + * simple.el (delete-trailing-lines): New option. (delete-trailing-whitespace): Obey it (Bug#11879). diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 0f3298d2686..2d95b14244f 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -1757,10 +1757,15 @@ saving the buffer." (call-interactively 'vc-version-diff) (when buffer-file-name (vc-buffer-sync not-urgent)) (let ((backend (vc-deduce-backend)) + (default-directory default-directory) rootdir working-revision) - (unless backend - (error "Buffer is not version controlled")) - (setq rootdir (vc-call-backend backend 'root default-directory)) + (if backend + (setq rootdir (vc-call-backend backend 'root default-directory)) + (setq rootdir (read-directory-name "Directory for VC root-diff: ")) + (setq backend (vc-responsible-backend rootdir)) + (if backend + (setq default-directory rootdir) + (error "Directory is not version controlled"))) (setq working-revision (vc-working-revision rootdir)) ;; VC diff for the root directory produces output that is ;; relative to it. Bind default-directory to the root directory @@ -2213,10 +2218,15 @@ When called interactively with a prefix argument, prompt for LIMIT." (t (list (when (> vc-log-show-limit 0) vc-log-show-limit))))) (let ((backend (vc-deduce-backend)) + (default-directory default-directory) rootdir working-revision) - (unless backend - (error "Buffer is not version controlled")) - (setq rootdir (vc-call-backend backend 'root default-directory)) + (if backend + (setq rootdir (vc-call-backend backend 'root default-directory)) + (setq rootdir (read-directory-name "Directory for VC root-log: ")) + (setq backend (vc-responsible-backend rootdir)) + (if backend + (setq default-directory rootdir) + (error "Directory is not version controlled"))) (setq working-revision (vc-working-revision rootdir)) (vc-print-log-internal backend (list rootdir) working-revision nil limit))) From a55739d3d02606d60f511b1ce558dd503b69acba Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sat, 28 Jul 2012 23:09:36 +0800 Subject: [PATCH 32/89] Fix bogus code in gdb-place-breakpoints. * progmodes/gdb-mi.el (gdb-place-breakpoints): Fix the call to gdb-get-location. --- lisp/ChangeLog | 5 +++++ lisp/progmodes/gdb-mi.el | 29 ++++++++++++++++------------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ac1482df4e1..635ecc054dd 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-07-28 Chong Yidong + + * progmodes/gdb-mi.el (gdb-place-breakpoints): Fix the call to + gdb-get-location. + 2012-07-25 Leo Liu * progmodes/cc-menus.el (cc-imenu-objc-function): Avoid leaving nil in diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index b19c828d171..f35951e0dda 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el @@ -2503,20 +2503,23 @@ HANDLER-NAME handler uses customization of CUSTOM-DEFUN. See (let ((file (bindat-get-field breakpoint 'fullname)) (flag (bindat-get-field breakpoint 'enabled)) (bptno (bindat-get-field breakpoint 'number))) - (unless (file-exists-p file) + (unless (and file (file-exists-p file)) (setq file (cdr (assoc bptno gdb-location-alist)))) - (if (and file - (not (string-equal file "File not found"))) - (with-current-buffer - (find-file-noselect file 'nowarn) - (gdb-init-buffer) - ;; Only want one breakpoint icon at each location. - (gdb-put-breakpoint-icon (string-equal flag "y") bptno - (string-to-number line))) - (gdb-input (concat "list " file ":1") 'ignore) - (gdb-input "-file-list-exec-source-file" - `(lambda () (gdb-get-location - ,bptno ,line ,flag))))))))) + (if (or (null file) + (string-equal file "File not found")) + ;; If the full filename is not recorded in the + ;; breakpoint structure or in `gdb-location-alist', use + ;; -file-list-exec-source-file to extract it. + (when (setq file (bindat-get-field breakpoint 'file)) + (gdb-input (concat "list " file ":1") 'ignore) + (gdb-input "-file-list-exec-source-file" + `(lambda () (gdb-get-location + ,bptno ,line ,flag)))) + (with-current-buffer (find-file-noselect file 'nowarn) + (gdb-init-buffer) + ;; Only want one breakpoint icon at each location. + (gdb-put-breakpoint-icon (string-equal flag "y") bptno + (string-to-number line))))))))) (defvar gdb-source-file-regexp "fullname=\"\\(.*?\\)\"") From a5c66610be0d94045c417dde54f8ffadd26977b5 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Sat, 28 Jul 2012 18:35:52 +0200 Subject: [PATCH 33/89] etc/NEWS: Fix typo. --- etc/ChangeLog | 4 ++++ etc/NEWS | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/etc/ChangeLog b/etc/ChangeLog index 1d7438b6506..5fea1e1ea46 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,7 @@ +2012-07-28 Juanma Barranquero + + * NEWS: Fix typo. + 2012-07-26 Paul Eggert Simplify export of symbols to GDB. diff --git a/etc/NEWS b/etc/NEWS index 0a4157a4557..555d9d42e4b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -147,8 +147,8 @@ for it. * Editing Changes in Emacs 24.2 -** New option `delete-trailing-lines' specifies whether the -M-x delete-trailing-lines command should delete trailing lines at the +** New option `delete-trailing-lines' specifies whether the M-x +delete-trailing-whitespace command should delete trailing lines at the end of the buffer. It defaults to t. ** Search changes From 01bd1b0df605d644ae31e8f1f81d926a5d8c7099 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 28 Jul 2012 19:57:57 +0300 Subject: [PATCH 34/89] Fix non-ASCII input in non-GUI frames on MS-Windows. (Bug#12055) src/w32inevt.c: Include w32inevt.h. (w32_read_console_input): New inline function, calls either ReadConsoleInputA or ReadConsoleInputW, depending on the value of w32_console_unicode_input. (fill_queue): Call w32_read_console_input instead of ReadConsoleInput. (w32_kbd_patch_key, key_event): Use the codepage returned by GetConsoleCP, rather than the ANSI codepage returned by GetLocaleInfo. (key_event): use uChar.UnicodeChar only if w32_console_unicode_input is non-zero. src/w32console.c: Include w32heap.h. : New global variable. (initialize_w32_display): Set w32_console_unicode_input to 1 on NT family of Windows, zero otherwise. src/w32inevt.h: Declare w32_console_unicode_input. lisp/international/mule-cmds.el (set-locale-environment): In a console session on MS-Windows, set up keyboard and terminal encoding from the OEM codepage, not the ANSI codepage. --- lisp/ChangeLog | 7 +++++ lisp/international/mule-cmds.el | 41 +++++++++++++++++------------ src/ChangeLog | 18 +++++++++++++ src/w32console.c | 7 +++++ src/w32inevt.c | 46 +++++++++++++++++++++------------ src/w32inevt.h | 2 ++ 6 files changed, 89 insertions(+), 32 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 24477cf87ea..7d69eefc86b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2012-07-28 Eli Zaretskii + + * international/mule-cmds.el (set-locale-environment): In a + console session on MS-Windows, set up keyboard and terminal + encoding from the OEM codepage, not the ANSI codepage. + (Bug#12055) + 2012-07-28 Chong Yidong * progmodes/gdb-mi.el (gdb-place-breakpoints): Fix the call to diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index 93c0cbf47f1..b122721c96e 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -2655,23 +2655,32 @@ See also `locale-charset-language-names', `locale-language-names', ;; On Windows, override locale-coding-system, ;; default-file-name-coding-system, keyboard-coding-system, - ;; terminal-coding-system with system codepage. + ;; terminal-coding-system with the appropriate codepages. (when (boundp 'w32-ansi-code-page) - (let ((code-page-coding (intern (format "cp%d" w32-ansi-code-page)))) - (when (coding-system-p code-page-coding) - (unless frame (setq locale-coding-system code-page-coding)) - (set-keyboard-coding-system code-page-coding frame) - (set-terminal-coding-system code-page-coding frame) - ;; Set default-file-name-coding-system last, so that Emacs - ;; doesn't try to use cpNNNN when it defines keyboard and - ;; terminal encoding. That's because the above two lines - ;; will want to load code-pages.el, where cpNNNN are - ;; defined; if default-file-name-coding-system were set to - ;; cpNNNN while these two lines run, Emacs will want to use - ;; it for encoding the file name it wants to load. And that - ;; will fail, since cpNNNN is not yet usable until - ;; code-pages.el finishes loading. - (setq default-file-name-coding-system code-page-coding)))) + (let ((ansi-code-page-coding (intern (format "cp%d" w32-ansi-code-page))) + (oem-code-page-coding + (intern (format "cp%d" (w32-get-console-codepage)))) + (oem-code-page-output-coding + (intern (format "cp%d" (w32-get-console-output-codepage)))) + ansi-cs-p oem-cs-p oem-o-cs-p) + (setq ansi-cs-p (coding-system-p ansi-code-page-coding)) + (setq oem-cs-p (coding-system-p oem-code-page-coding)) + (setq oem-o-cs-p (coding-system-p oem-code-page-output-coding)) + ;; Set the keyboard and display encoding to either the current + ;; ANSI codepage of the OEM codepage, depending on whether + ;; this is a GUI or a TTY frame. + (when ansi-cs-p + (unless frame (setq locale-coding-system ansi-code-page-coding)) + (when (display-graphic-p frame) + (set-keyboard-coding-system ansi-code-page-coding frame) + (set-terminal-coding-system ansi-code-page-coding frame)) + (setq default-file-name-coding-system ansi-code-page-coding)) + (when oem-cs-p + (unless (display-graphic-p frame) + (set-keyboard-coding-system oem-code-page-coding frame) + (set-terminal-coding-system + (if oem-o-cs-p oem-code-page-output-coding oem-code-page-coding) + frame))))) (when (eq system-type 'darwin) ;; On Darwin, file names are always encoded in utf-8, no matter diff --git a/src/ChangeLog b/src/ChangeLog index 8d0e7caf4ea..6457fc2209b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,23 @@ 2012-07-28 Eli Zaretskii + Fix non-ASCII input in non-GUI frames on MS-Windows. (Bug#12055) + * w32inevt.c: Include w32inevt.h. + (w32_read_console_input): New inline function, calls either + ReadConsoleInputA or ReadConsoleInputW, depending on the value of + w32_console_unicode_input. + (fill_queue): Call w32_read_console_input instead of ReadConsoleInput. + (w32_kbd_patch_key, key_event): Use the codepage returned by + GetConsoleCP, rather than the ANSI codepage returned by GetLocaleInfo. + (key_event): use uChar.UnicodeChar only if + w32_console_unicode_input is non-zero. + + * w32console.c: Include w32heap.h. + : New global variable. + (initialize_w32_display): Set w32_console_unicode_input to 1 on NT + family of Windows, zero otherwise. + + * w32inevt.h: Declare w32_console_unicode_input. + * xdisp.c (init_iterator): Don't reference tip_frame in a build --without-x. (Bug#11742) diff --git a/src/w32console.c b/src/w32console.c index 42d89cca6d7..c3a1c5d86b3 100644 --- a/src/w32console.c +++ b/src/w32console.c @@ -37,6 +37,7 @@ along with GNU Emacs. If not, see . */ #include "termhooks.h" #include "termchar.h" #include "dispextern.h" +#include "w32heap.h" /* for os_subtype */ #include "w32inevt.h" /* from window.c */ @@ -67,6 +68,7 @@ static CONSOLE_CURSOR_INFO prev_console_cursor; #endif HANDLE keyboard_handle; +int w32_console_unicode_input; /* Setting this as the ctrl handler prevents emacs from being killed when @@ -786,6 +788,11 @@ initialize_w32_display (struct terminal *term) info.srWindow.Left); } + if (os_subtype == OS_NT) + w32_console_unicode_input = 1; + else + w32_console_unicode_input = 0; + /* Setup w32_display_info structure for this frame. */ w32_initialize_display_info (build_string ("Console")); diff --git a/src/w32inevt.c b/src/w32inevt.c index a85fdbbe435..8d041194ca1 100644 --- a/src/w32inevt.c +++ b/src/w32inevt.c @@ -41,6 +41,7 @@ along with GNU Emacs. If not, see . */ #include "termchar.h" #include "w32heap.h" #include "w32term.h" +#include "w32inevt.h" /* stdin, from w32console.c */ extern HANDLE keyboard_handle; @@ -61,6 +62,15 @@ static INPUT_RECORD *queue_ptr = event_queue, *queue_end = event_queue; /* Temporarily store lead byte of DBCS input sequences. */ static char dbcs_lead = 0; +static inline BOOL +w32_read_console_input (HANDLE h, INPUT_RECORD *rec, DWORD recsize, + DWORD *waiting) +{ + return (w32_console_unicode_input + ? ReadConsoleInputW (h, rec, recsize, waiting) + : ReadConsoleInputA (h, rec, recsize, waiting)); +} + static int fill_queue (BOOL block) { @@ -80,8 +90,8 @@ fill_queue (BOOL block) return 0; } - rc = ReadConsoleInput (keyboard_handle, event_queue, EVENT_QUEUE_SIZE, - &events_waiting); + rc = w32_read_console_input (keyboard_handle, event_queue, EVENT_QUEUE_SIZE, + &events_waiting); if (!rc) return -1; queue_ptr = event_queue; @@ -224,7 +234,7 @@ w32_kbd_patch_key (KEY_EVENT_RECORD *event) #endif /* On NT, call ToUnicode instead and then convert to the current - locale's default codepage. */ + console input codepage. */ if (os_subtype == OS_NT) { WCHAR buf[128]; @@ -233,14 +243,9 @@ w32_kbd_patch_key (KEY_EVENT_RECORD *event) keystate, buf, 128, 0); if (isdead > 0) { - char cp[20]; - int cpId; + int cpId = GetConsoleCP (); event->uChar.UnicodeChar = buf[isdead - 1]; - - GetLocaleInfo (GetThreadLocale (), - LOCALE_IDEFAULTANSICODEPAGE, cp, 20); - cpId = atoi (cp); isdead = WideCharToMultiByte (cpId, 0, buf, isdead, ansi_code, 4, NULL, NULL); } @@ -447,26 +452,34 @@ key_event (KEY_EVENT_RECORD *event, struct input_event *emacs_ev, int *isdead) } else if (event->uChar.AsciiChar > 0) { + /* Pure ASCII characters < 128. */ emacs_ev->kind = ASCII_KEYSTROKE_EVENT; emacs_ev->code = event->uChar.AsciiChar; } - else if (event->uChar.UnicodeChar > 0) + else if (event->uChar.UnicodeChar > 0 + && w32_console_unicode_input) { + /* Unicode codepoint; only valid if we are using Unicode + console input mode. */ emacs_ev->kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT; emacs_ev->code = event->uChar.UnicodeChar; } else { - /* Fallback for non-Unicode versions of Windows. */ + /* Fallback handling of non-ASCII characters for non-Unicode + versions of Windows, and for non-Unicode input on NT + family of Windows. Only characters in the current + console codepage are supported by this fallback. */ wchar_t code; char dbcs[2]; - char cp[20]; int cpId; - /* Get the codepage to interpret this key with. */ - GetLocaleInfo (GetThreadLocale (), - LOCALE_IDEFAULTANSICODEPAGE, cp, 20); - cpId = atoi (cp); + /* Get the current console input codepage to interpret this + key with. Note that the system defaults for the OEM + codepage could have been changed by calling SetConsoleCP + or w32-set-console-codepage, so using GetLocaleInfo to + get LOCALE_IDEFAULTCODEPAGE is not TRT here. */ + cpId = GetConsoleCP (); dbcs[0] = dbcs_lead; dbcs[1] = event->uChar.AsciiChar; @@ -501,6 +514,7 @@ key_event (KEY_EVENT_RECORD *event, struct input_event *emacs_ev, int *isdead) } else { + /* Function keys and other non-character keys. */ emacs_ev->kind = NON_ASCII_KEYSTROKE_EVENT; emacs_ev->code = event->wVirtualKeyCode; } diff --git a/src/w32inevt.h b/src/w32inevt.h index d228637abfb..5386f2aa96c 100644 --- a/src/w32inevt.h +++ b/src/w32inevt.h @@ -19,6 +19,8 @@ along with GNU Emacs. If not, see . */ #ifndef EMACS_W32INEVT_H #define EMACS_W32INEVT_H +extern int w32_console_unicode_input; + extern int w32_console_read_socket (struct terminal *term, int numchars, struct input_event *hold_quit); extern void w32_console_mouse_position (FRAME_PTR *f, int insist, From e32a579975bc219bc24d403deeb1fa89187fc51e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 28 Jul 2012 16:05:32 -0700 Subject: [PATCH 35/89] Use Gnulib stdalign and environ modules (Bug#9772, Bug#9960). * .bzrignore: Add lib/stdalign.h. * config.bat: Do not set NO_DECL_ALIGN; no longer needed. Copy lib/stdalign.in.h to lib/stdalign.in-h as needed. * configure.ac (HAVE_ATTRIBUTE_ALIGNED): Remove the code that fiddles with this, as gnulib now does this for us. * admin/merge-gnulib: Add environ, stdalign. * m4/environ.m4: New file, from gnulib. * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. * lib/stdalign.in.h, m4/stdalign.m4: New files, from gnulib. * sed2v2.inp (HAVE_ATTRIBUTE_ALIGNED): Remove edit. * sedlibmk.inp (STDALIGN_H, @GL_GENERATE_STDALIGN_H_TRUE@) (GL_GENERATE_STDALIGN_H_FALSE): New edits. * nt/config.nt (HAVE_ATTRIBUTE_ALIGNED): Remove. * src/alloc.c (XMALLOC_BASE_ALIGNMENT, GC_POINTER_ALIGNMENT, pure_alloc): Simplify by using alignof. (pure_alloc) [! USE_LSB_TAG]: Don't over-align EMACS_INT values. * src/lisp.h: Include . (GCALIGNMENT): New macro and constant. (DECL_ALIGN): Remove. All uses replaced by alignas (GCALIGNMENT). (USE_LSB_TAG): ifdef on alignas, not on DECL_ALIGN. (stdalign): New macro, if not already defined. --- ChangeLog | 15 +++++++++++++++ admin/ChangeLog | 5 +++++ admin/merge-gnulib | 5 +++-- config.bat | 18 +----------------- configure.ac | 13 ------------- lib/gnulib.mk | 2 +- m4/environ.m4 | 47 ++++++++++++++++++++++++++++++++++++++++++++++ m4/gnulib-comp.m4 | 4 ++++ msdos/ChangeLog | 7 +++++++ msdos/sed2v2.inp | 1 - msdos/sedlibmk.inp | 2 ++ nt/ChangeLog | 5 +++++ nt/config.nt | 3 --- src/ChangeLog | 12 ++++++++++++ src/alloc.c | 21 +++++---------------- src/buffer.c | 4 ++-- src/lisp.h | 46 +++++++++++++++++---------------------------- 17 files changed, 126 insertions(+), 84 deletions(-) create mode 100644 m4/environ.m4 diff --git a/ChangeLog b/ChangeLog index 03f4291a634..f9546f9e056 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2012-07-28 Paul Eggert + + Use Gnulib environ module (Bug#9772). + * m4/environ.m4: New file, from gnulib. + * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. + + Use Gnulib stdalign module (Bug#9772, Bug#9960). + This should improve portability of macros like alignof and DECL_ALIGN. + * lib/stdalign.in.h, m4/stdalign.m4: New files, from gnulib. + * .bzrignore: Add lib/stdalign.h. + * config.bat: Do not set NO_DECL_ALIGN; no longer needed. + Copy lib/stdalign.in.h to lib/stdalign.in-h as needed. + * configure.ac (HAVE_ATTRIBUTE_ALIGNED): Remove the code that + fiddles with this, as gnulib now does this for us. + 2012-07-17 Dmitry Antipov Fix toolkit configuration report. diff --git a/admin/ChangeLog b/admin/ChangeLog index b4c88c20ed1..d97e7dde32d 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog @@ -1,3 +1,8 @@ +2012-07-28 Paul Eggert + + Use Gnulib environ and stdalign modules (Bug#9772, Bug#9960). + * merge-gnulib: Add environ, stdalign. + 2012-07-20 Dmitry Antipov * coccinelle/unibyte_string.cocci: Semantic patch to convert from diff --git a/admin/merge-gnulib b/admin/merge-gnulib index 727b701cfe0..49d194c8033 100755 --- a/admin/merge-gnulib +++ b/admin/merge-gnulib @@ -28,11 +28,12 @@ GNULIB_URL=git://git.savannah.gnu.org/gnulib.git GNULIB_MODULES=' alloca-opt c-strcase careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 - dtoastr dtotimespec dup2 + dtoastr dtotimespec dup2 environ filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink - socklen stat-time stdarg stdio strftime strtoimax strtoumax symlink sys_stat + socklen stat-time stdalign stdarg stdio + strftime strtoimax strtoumax symlink sys_stat sys_time time timespec-add timespec-sub utimens warnings ' diff --git a/config.bat b/config.bat index 4803ad899c1..d3443d450d6 100644 --- a/config.bat +++ b/config.bat @@ -161,22 +161,6 @@ if exist config.in sed -f ../msdos/sed2x.inp < config.in > config.tmp if exist ..\autogen\config.in sed -f ../msdos/sed2x.inp < ..\autogen\config.in > config.tmp :src4 sed -f ../msdos/sed2v2.inp config.h2 -Rem See if DECL_ALIGN can be supported with this GCC -rm -f junk.c junk.o junk junk.exe -echo struct { int i; char *p; } __attribute__((__aligned__(8))) foo; >junk.c -rem Two percent signs because it is a special character for COMMAND.COM/CMD -rem Filter thru Sed because "&" is special for CMD.EXE -echo int main(void) { return (unsigned long)"&"foo %% 8; } | sed "s/.&./\&/" >>junk.c -gcc -o junk junk.c -if not exist junk.exe coff2exe junk -junk -If Not ErrorLevel 1 Goto alignOk -Echo WARNING: Your GCC does not support 8-byte aligned variables. -Echo WARNING: Therefore Emacs cannot support buffers larger than 128MB. -rem The following line disables DECL_ALIGN which in turn disables USE_LSB_TAG -rem For details see lisp.h where it defines USE_LSB_TAG -echo #define NO_DECL_ALIGN >>config.h2 -:alignOk Rem See if they have libxml2 later than v2.2.0 installed Echo Checking whether libxml2 v2.2.1 or later is installed ... rm -f junk.c junk.o junk junk.exe @@ -281,6 +265,7 @@ Rem Rename files like djtar on plain DOS filesystem would. If Exist build-aux\snippet\c++defs.h update build-aux/snippet/c++defs.h build-aux/snippet/cxxdefs.h If Exist alloca.in.h update alloca.in.h alloca.in-h If Exist getopt.in.h update getopt.in.h getopt.in-h +If Exist stdalign.in.h update stdalign.in.h stdalign.in-h If Exist stdbool.in.h update stdbool.in.h stdbool.in-h If Exist signal.in.h update signal.in.h signal.in-h If Exist stdalign.in.h update stdalign.in.h stdalign.in-h @@ -346,4 +331,3 @@ set nodebug= set djgpp_ver= set sys_malloc= set libxml= - diff --git a/configure.ac b/configure.ac index fba98513825..b43087a0aa3 100644 --- a/configure.ac +++ b/configure.ac @@ -1298,19 +1298,6 @@ AC_CHECK_MEMBERS([struct ifreq.ifr_flags, struct ifreq.ifr_hwaddr, dnl Check for endianness. dnl AC_C_BIGENDIAN is done by gnulib. -AC_CACHE_CHECK([for __attribute__ ((__aligned__ (expr)))], - [emacs_cv_attribute_aligned], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[char __attribute__ ((__aligned__ (1 << 3))) c;]], - [[]])], - [emacs_cv_attribute_aligned=yes], - [emacs_cv_attribute_aligned=no])]) -if test $emacs_cv_attribute_aligned = yes; then - AC_DEFINE([HAVE_ATTRIBUTE_ALIGNED], 1, - [Define to 1 if GCC-style __attribute__ ((__aligned__ (expr))) works.]) -fi - dnl check for Make feature dnl AC_PROG_MAKE_SET is done by Automake. diff --git a/lib/gnulib.mk b/lib/gnulib.mk index 6e2bf89786c..c85b923029e 100644 --- a/lib/gnulib.mk +++ b/lib/gnulib.mk @@ -21,7 +21,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=errno --avoid=fcntl --avoid=fcntl-h --avoid=fstat --avoid=msvc-inval --avoid=msvc-nothrow --avoid=raise --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-strcase careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdarg stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timespec-add timespec-sub utimens warnings +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=errno --avoid=fcntl --avoid=fcntl-h --avoid=fstat --avoid=msvc-inval --avoid=msvc-nothrow --avoid=raise --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-strcase careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdalign stdarg stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timespec-add timespec-sub utimens warnings MOSTLYCLEANFILES += core *.stackdump diff --git a/m4/environ.m4 b/m4/environ.m4 new file mode 100644 index 00000000000..8eb57c9d999 --- /dev/null +++ b/m4/environ.m4 @@ -0,0 +1,47 @@ +# environ.m4 serial 6 +dnl Copyright (C) 2001-2004, 2006-2012 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN_ONCE([gl_ENVIRON], +[ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + dnl Persuade glibc to declare environ. + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + + AC_CHECK_HEADERS_ONCE([unistd.h]) + gt_CHECK_VAR_DECL( + [#if HAVE_UNISTD_H + #include + #endif + /* mingw, BeOS, Haiku declare environ in , not in . */ + #include + ], + [environ]) + if test $gt_cv_var_environ_declaration != yes; then + HAVE_DECL_ENVIRON=0 + fi +]) + +# Check if a variable is properly declared. +# gt_CHECK_VAR_DECL(includes,variable) +AC_DEFUN([gt_CHECK_VAR_DECL], +[ + define([gt_cv_var], [gt_cv_var_]$2[_declaration]) + AC_MSG_CHECKING([if $2 is properly declared]) + AC_CACHE_VAL([gt_cv_var], [ + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[$1 + extern struct { int foo; } $2;]], + [[$2.foo = 1;]])], + [gt_cv_var=no], + [gt_cv_var=yes])]) + AC_MSG_RESULT([$gt_cv_var]) + if test $gt_cv_var = yes; then + AC_DEFINE([HAVE_]m4_translit($2, [a-z], [A-Z])[_DECL], 1, + [Define if you have the declaration of $2.]) + fi + undefine([gt_cv_var]) +]) diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index 754086ec2e7..b0cd185a2b5 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 @@ -52,6 +52,7 @@ AC_DEFUN([gl_EARLY], # Code from module dtoastr: # Code from module dtotimespec: # Code from module dup2: + # Code from module environ: # Code from module extensions: AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) # Code from module filemode: @@ -148,6 +149,8 @@ if test $HAVE_DUP2 = 0 || test $REPLACE_DUP2 = 1; then gl_PREREQ_DUP2 fi gl_UNISTD_MODULE_INDICATOR([dup2]) +gl_ENVIRON +gl_UNISTD_MODULE_INDICATOR([environ]) gl_FILEMODE gl_GETLOADAVG if test $HAVE_GETLOADAVG = 0; then @@ -598,6 +601,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/c-strtod.m4 m4/clock_time.m4 m4/dup2.m4 + m4/environ.m4 m4/extensions.m4 m4/filemode.m4 m4/getloadavg.m4 diff --git a/msdos/ChangeLog b/msdos/ChangeLog index 85251afef05..c5b509c72af 100644 --- a/msdos/ChangeLog +++ b/msdos/ChangeLog @@ -1,3 +1,10 @@ +2012-07-28 Paul Eggert + + Use Gnulib stdalign module (Bug#9772, Bug#9960). + * sed2v2.inp (HAVE_ATTRIBUTE_ALIGNED): Remove edit. + * sedlibmk.inp (STDALIGN_H, @GL_GENERATE_STDALIGN_H_TRUE@) + (GL_GENERATE_STDALIGN_H_FALSE): New edits. + 2012-07-14 Eli Zaretskii * sed1v2.inp: In the recipe for $(leimdir)/leim-list.el, edit the diff --git a/msdos/sed2v2.inp b/msdos/sed2v2.inp index 759418f0f15..214480a27ab 100644 --- a/msdos/sed2v2.inp +++ b/msdos/sed2v2.inp @@ -35,7 +35,6 @@ /^#undef HAVE_FREXP *$/s/^.*$/#define HAVE_FREXP 1/ /^#undef HAVE_FMOD *$/s/^.*$/#define HAVE_FMOD 1/ /^#undef HAVE_RINT *$/s/^.*$/#define HAVE_RINT 1/ -/^#undef HAVE_ATTRIBUTE_ALIGNED *$/s/^.*$/#define HAVE_ATTRIBUTE_ALIGNED 1/ /^#undef HAVE_C99_STRTOLD *$/s/^.*$/#define HAVE_C99_STRTOLD 1/ /^#undef HAVE_CBRT *$/s/^.*$/#define HAVE_CBRT 1/ /^#undef HAVE_DIFFTIME *$/s/^.*$/#define HAVE_DIFFTIME 1/ diff --git a/msdos/sedlibmk.inp b/msdos/sedlibmk.inp index 432749af92a..b5b66753bb3 100644 --- a/msdos/sedlibmk.inp +++ b/msdos/sedlibmk.inp @@ -647,6 +647,8 @@ s/^@GL_GENERATE_ALLOCA_H_TRUE@// s/^@GL_GENERATE_ALLOCA_H_FALSE@/\#/ s/^@GL_GENERATE_STDBOOL_H_TRUE@/\#/ s/^@GL_GENERATE_STDBOOL_H_FALSE@// +s/^@GL_GENERATE_STDALIGN_H_TRUE@// +s/^@GL_GENERATE_STDALIGN_H_FALSE@/\#/ s/^@GL_GENERATE_STDARG_H_TRUE@/\#/ s/^@GL_GENERATE_STDARG_H_FALSE@/\#/ s/^@GL_GENERATE_STDDEF_H_TRUE@/\#/ diff --git a/nt/ChangeLog b/nt/ChangeLog index 16a6577cb6c..f0e9f247d14 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog @@ -1,3 +1,8 @@ +2012-07-28 Paul Eggert + + Use Gnulib stdalign module (Bug#9772, Bug#9960). + * config.nt (HAVE_ATTRIBUTE_ALIGNED): Remove. + 2012-07-14 Juanma Barranquero * config.nt: Sync with autogen/config.in. diff --git a/nt/config.nt b/nt/config.nt index d727cd3fafd..d32ead3d9c0 100644 --- a/nt/config.nt +++ b/nt/config.nt @@ -227,9 +227,6 @@ along with GNU Emacs. If not, see . */ /* Define to 1 if ALSA is available. */ #undef HAVE_ALSA -/* Define to 1 if GCC-style __attribute__ ((__aligned__ (expr))) works. */ -#undef HAVE_ATTRIBUTE_ALIGNED - /* Define to 1 if strtold conforms to C99. */ #undef HAVE_C99_STRTOLD diff --git a/src/ChangeLog b/src/ChangeLog index 6457fc2209b..cc112f4b5da 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,15 @@ +2012-07-28 Paul Eggert + + Use Gnulib stdalign module (Bug#9772, Bug#9960). + * alloc.c (XMALLOC_BASE_ALIGNMENT, GC_POINTER_ALIGNMENT, pure_alloc): + Simplify by using alignof. + (pure_alloc) [! USE_LSB_TAG]: Don't over-align EMACS_INT values. + * lisp.h: Include . + (GCALIGNMENT): New macro and constant. + (DECL_ALIGN): Remove. All uses replaced by alignas (GCALIGNMENT). + (USE_LSB_TAG): ifdef on alignas, not on DECL_ALIGN. + (stdalign): New macro, if not already defined. + 2012-07-28 Eli Zaretskii Fix non-ASCII input in non-GUI frames on MS-Windows. (Bug#12055) diff --git a/src/alloc.c b/src/alloc.c index a551dd821b8..e5f412bb4c3 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -533,12 +533,7 @@ buffer_memory_full (ptrdiff_t nbytes) hold a size_t value and (2) the header size is a multiple of the alignment that Emacs needs for C types and for USE_LSB_TAG. */ #define XMALLOC_BASE_ALIGNMENT \ - offsetof ( \ - struct { \ - union { long double d; intmax_t i; void *p; } u; \ - char c; \ - }, \ - c) + alignof (union { long double d; intmax_t i; void *p; }) #if USE_LSB_TAG # define XMALLOC_HEADER_ALIGNMENT \ @@ -4652,10 +4647,10 @@ mark_maybe_pointer (void *p) } -/* Alignment of pointer values. Use offsetof, as it sometimes returns +/* Alignment of pointer values. Use alignof, as it sometimes returns a smaller alignment than GCC's __alignof__ and mark_memory might miss objects if __alignof__ were used. */ -#define GC_POINTER_ALIGNMENT offsetof (struct {char a; void *b;}, b) +#define GC_POINTER_ALIGNMENT alignof (void *) /* Define POINTERS_MIGHT_HIDE_IN_OBJECTS to 1 if marking via C pointers does not suffice, which is the typical case. A host where a Lisp_Object is @@ -5103,17 +5098,11 @@ pure_alloc (size_t size, int type) #if USE_LSB_TAG size_t alignment = (1 << GCTYPEBITS); #else - size_t alignment = sizeof (EMACS_INT); + size_t alignment = alignof (EMACS_INT); /* Give Lisp_Floats an extra alignment. */ if (type == Lisp_Float) - { -#if defined __GNUC__ && __GNUC__ >= 2 - alignment = __alignof (struct Lisp_Float); -#else - alignment = sizeof (struct Lisp_Float); -#endif - } + alignment = alignof (struct Lisp_Float); #endif again: diff --git a/src/buffer.c b/src/buffer.c index 5e45882b892..70630de53cb 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -56,7 +56,7 @@ struct buffer *all_buffers; Setting the default value also goes through the alist of buffers and stores into each buffer that does not say it has a local value. */ -DECL_ALIGN (struct buffer, buffer_defaults); +struct buffer alignas (GCALIGNMENT) buffer_defaults; /* A Lisp_Object pointer to the above, used for staticpro */ @@ -83,7 +83,7 @@ struct buffer buffer_local_flags; /* This structure holds the names of symbols whose values may be buffer-local. It is indexed and accessed in the same way as the above. */ -DECL_ALIGN (struct buffer, buffer_local_symbols); +struct buffer alignas (GCALIGNMENT) buffer_local_symbols; /* A Lisp_Object pointer to the above, used for staticpro */ static Lisp_Object Vbuffer_local_symbols; diff --git a/src/lisp.h b/src/lisp.h index 80a9ab343c3..a45e9c2c892 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -20,6 +20,7 @@ along with GNU Emacs. If not, see . */ #ifndef EMACS_LISP_H #define EMACS_LISP_H +#include #include #include #include @@ -151,10 +152,6 @@ extern int suppress_checking EXTERNALLY_VISIBLE; on the few static Lisp_Objects used: all the defsubr as well as the two special buffers buffer_defaults and buffer_local_symbols. */ -/* First, try and define DECL_ALIGN(type,var) which declares a static - variable VAR of type TYPE with the added requirement that it be - TYPEBITS-aligned. */ - enum Lisp_Bits { /* Number of bits in a Lisp_Object tag. This can be used in #if, @@ -163,6 +160,12 @@ enum Lisp_Bits #define GCTYPEBITS 3 GCTYPEBITS, + /* 2**GCTYPEBITS. This must also be a macro that expands to a + literal integer constant, for MSVC. */ + GCALIGNMENT = +#define GCALIGNMENT 8 + GCALIGNMENT, + /* Number of bits in a Lisp_Object value, not counting the tag. */ VALBITS = BITS_PER_EMACS_INT - GCTYPEBITS, @@ -173,36 +176,22 @@ enum Lisp_Bits FIXNUM_BITS = VALBITS + 1 }; +#if GCALIGNMENT != 1 << GCTYPEBITS +# error "GCALIGNMENT and GCTYPEBITS are inconsistent" +#endif + /* The maximum value that can be stored in a EMACS_INT, assuming all bits other than the type bits contribute to a nonnegative signed value. This can be used in #if, e.g., '#if VAL_MAX < UINTPTR_MAX' below. */ #define VAL_MAX (EMACS_INT_MAX >> (GCTYPEBITS - 1)) -#ifndef NO_DECL_ALIGN -# ifndef DECL_ALIGN -# if HAVE_ATTRIBUTE_ALIGNED -# define DECL_ALIGN(type, var) \ - type __attribute__ ((__aligned__ (1 << GCTYPEBITS))) var -# elif defined(_MSC_VER) -# define ALIGN_GCTYPEBITS 8 -# if (1 << GCTYPEBITS) != ALIGN_GCTYPEBITS -# error ALIGN_GCTYPEBITS is wrong! -# endif -# define DECL_ALIGN(type, var) \ - type __declspec(align(ALIGN_GCTYPEBITS)) var -# else - /* What directives do other compilers use? */ -# endif -# endif -#endif - /* Unless otherwise specified, use USE_LSB_TAG on systems where: */ #ifndef USE_LSB_TAG /* 1. We know malloc returns a multiple of 8. */ # if (defined GNU_MALLOC || defined DOUG_LEA_MALLOC || defined __GLIBC__ \ || defined DARWIN_OS || defined __sun) /* 2. We can specify multiple-of-8 alignment on static variables. */ -# ifdef DECL_ALIGN +# ifdef alignas /* 3. Pointers-as-ints exceed VAL_MAX. On hosts where pointers-as-ints do not exceed VAL_MAX, USE_LSB_TAG is: a. unnecessary, because the top bits of an EMACS_INT are unused, and @@ -223,12 +212,11 @@ enum enum_USE_LSB_TAG { USE_LSB_TAG = 0 }; # define USE_LSB_TAG 0 #endif -/* If we cannot use 8-byte alignment, make DECL_ALIGN a no-op. */ -#ifndef DECL_ALIGN +#ifndef alignas +# define alignas(alignment) /* empty */ # if USE_LSB_TAG -# error "USE_LSB_TAG used without defining DECL_ALIGN" +# error "USE_LSB_TAG requires alignas" # endif -# define DECL_ALIGN(type, var) type var #endif @@ -1882,7 +1870,7 @@ typedef struct { #ifdef _MSC_VER #define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \ Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \ - static DECL_ALIGN (struct Lisp_Subr, sname) = \ + static struct Lisp_Subr alignas (GCALIGNMENT) sname = \ { (PVEC_SUBR << PSEUDOVECTOR_SIZE_BITS) \ | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)), \ { (Lisp_Object (__cdecl *)(void))fnname }, \ @@ -1891,7 +1879,7 @@ typedef struct { #else /* not _MSC_VER */ #define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \ Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \ - static DECL_ALIGN (struct Lisp_Subr, sname) = \ + static struct Lisp_Subr alignas (GCALIGNMENT) sname = \ { PVEC_SUBR << PSEUDOVECTOR_SIZE_BITS, \ { .a ## maxargs = fnname }, \ minargs, maxargs, lname, intspec, 0}; \ From 17711ed9be4253d8e1371f6e771505578725c711 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Sun, 29 Jul 2012 03:03:26 +0300 Subject: [PATCH 36/89] * lisp/simple.el (async-shell-command-buffer): New defcustom. (shell-command): Use it. Fixes: debbugs:4719 --- etc/NEWS | 6 +++++ lisp/ChangeLog | 5 +++++ lisp/simple.el | 61 +++++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 69 insertions(+), 3 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 555d9d42e4b..5f082cb0bc9 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -360,6 +360,12 @@ channel keys found, if any. if the command ends in `;' (when operating on multiple files). Otherwise, it executes the command on each file in parallel. +** Shell + +*** New option `async-shell-command-buffer' specifies what buffer to use +for a new asynchronous shell command when the default output buffer +`*Async Shell Command*' is already taken by another running command. + ** FFAP *** The option `ffap-url-unwrap-remote' can now be a list of strings, diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7d69eefc86b..e0d6cb825f0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-07-29 Juri Linkov + + * simple.el (async-shell-command-buffer): New defcustom. + (shell-command): Use it. (Bug#4719) + 2012-07-28 Eli Zaretskii * international/mule-cmds.el (set-locale-environment): In a diff --git a/lisp/simple.el b/lisp/simple.el index 2011ff2b1bb..cfcc63e9285 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2264,6 +2264,33 @@ to `shell-command-history'." (or hist 'shell-command-history) args))) +(defcustom async-shell-command-buffer 'confirm-new-buffer + "What to do when the output buffer is used by another shell command. +This option specifies how to resolve the conflict where a new command +wants to direct its output to the buffer `*Async Shell Command*', +but this buffer is already taken by another running shell command. + +The value `confirm-kill-process' is used to ask for confirmation before +killing the already running process and running a new process +in the same buffer, `confirm-new-buffer' for confirmation before running +the command in a new buffer with a name other than the default buffer name, +`new-buffer' for doing the same without confirmation, +`confirm-rename-buffer' for confirmation before renaming the existing +output buffer and running a new command in the default buffer, +`rename-buffer' for doing the same without confirmation." + :type '(choice (const :tag "Confirm killing of running command" + confirm-kill-process) + (const :tag "Confirm creation of a new buffer" + confirm-new-buffer) + (const :tag "Create a new buffer" + new-buffer) + (const :tag "Confirm renaming of existing buffer" + confirm-rename-buffer) + (const :tag "Rename the existing buffer" + rename-buffer)) + :group 'shell + :version "24.2") + (defun async-shell-command (command &optional output-buffer error-buffer) "Execute string COMMAND asynchronously in background. @@ -2418,12 +2445,40 @@ the use of a shell (with its need to quote arguments)." proc) ;; Remove the ampersand. (setq command (substring command 0 (match-beginning 0))) - ;; If will kill a process, query first. + ;; Ask the user what to do with already running process. (setq proc (get-buffer-process buffer)) - (if proc - (if (yes-or-no-p "A command is running. Kill it? ") + (when proc + (cond + ((eq async-shell-command-buffer 'confirm-kill-process) + ;; If will kill a process, query first. + (if (yes-or-no-p "A command is running in the default buffer. Kill it? ") (kill-process proc) (error "Shell command in progress"))) + ((eq async-shell-command-buffer 'confirm-new-buffer) + ;; If will create a new buffer, query first. + (if (yes-or-no-p "A command is running in the default buffer. Use a new buffer? ") + (setq buffer (generate-new-buffer + (or output-buffer "*Async Shell Command*"))) + (error "Shell command in progress"))) + ((eq async-shell-command-buffer 'new-buffer) + ;; It will create a new buffer. + (setq buffer (generate-new-buffer + (or output-buffer "*Async Shell Command*")))) + ((eq async-shell-command-buffer 'confirm-rename-buffer) + ;; If will rename the buffer, query first. + (if (yes-or-no-p "A command is running in the default buffer. Rename it? ") + (progn + (with-current-buffer buffer + (rename-uniquely)) + (setq buffer (get-buffer-create + (or output-buffer "*Async Shell Command*")))) + (error "Shell command in progress"))) + ((eq async-shell-command-buffer 'rename-buffer) + ;; It will rename the buffer. + (with-current-buffer buffer + (rename-uniquely)) + (setq buffer (get-buffer-create + (or output-buffer "*Async Shell Command*")))))) (with-current-buffer buffer (setq buffer-read-only nil) ;; Setting buffer-read-only to nil doesn't suffice From d8efda90aa36b6bea5cca9bd6765cbb76571d933 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Sun, 29 Jul 2012 03:12:13 +0300 Subject: [PATCH 37/89] * test/automated/occur-tests.el (occur-test-case): Use predefined buffer name " *test-occur*" instead of a random buffer name. --- test/ChangeLog | 5 ++++ test/automated/occur-tests.el | 49 +++++++++++++++++++---------------- 2 files changed, 32 insertions(+), 22 deletions(-) diff --git a/test/ChangeLog b/test/ChangeLog index db8380cfb27..54030e210ed 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2012-07-29 Juri Linkov + + * automated/occur-tests.el (occur-test-case): Use predefined + buffer name " *test-occur*" instead of a random buffer name. + 2012-07-20 Dmitry Gutov * automated/ruby-mode-tests.el: New file with one test. diff --git a/test/automated/occur-tests.el b/test/automated/occur-tests.el index eb62688d788..5fe9722d4e7 100644 --- a/test/automated/occur-tests.el +++ b/test/automated/occur-tests.el @@ -35,7 +35,7 @@ xd xex fx " "\ -5 matches for \"x\" in buffer: *temp*<2> +5 matches for \"x\" in buffer: *test-occur* 1:xa 3:cx 4:xd @@ -52,7 +52,7 @@ a a a " "\ -2 matches for \"a^Ja\" in buffer: *temp*<2> +2 matches for \"a^Ja\" in buffer: *test-occur* 1:a :a 3:a @@ -68,7 +68,7 @@ c a b " "\ -2 matches for \"a^Jb\" in buffer: *temp*<2> +2 matches for \"a^Jb\" in buffer: *test-occur* 1:a :b 4:a @@ -82,7 +82,7 @@ c a " "\ -2 matches for \"a^J\" in buffer: *temp*<2> +2 matches for \"a^J\" in buffer: *test-occur* 1:a : 4:a @@ -97,7 +97,7 @@ d ex fx " "\ -2 matches for \"x^J.x^J\" in buffer: *temp*<2> +2 matches for \"x^J.x^J\" in buffer: *test-occur* 1:ax :bx :c @@ -116,7 +116,7 @@ f g hx " "\ -3 matches for \"x\" in buffer: *temp*<2> +3 matches for \"x\" in buffer: *test-occur* 1:ax :b ------- @@ -136,7 +136,7 @@ d ex f " "\ -2 matches for \"x\" in buffer: *temp*<2> +2 matches for \"x\" in buffer: *test-occur* :a 2:bx :c @@ -159,7 +159,7 @@ i j kx " "\ -5 matches for \"x\" in buffer: *temp*<2> +5 matches for \"x\" in buffer: *test-occur* 1:ax 2:bx :c @@ -184,7 +184,7 @@ gx h i " "\ -2 matches for \"x\" in buffer: *temp*<2> +2 matches for \"x\" in buffer: *test-occur* :a :b 3:cx @@ -207,7 +207,7 @@ gx h " "\ -2 matches for \"x\" in buffer: *temp*<2> +2 matches for \"x\" in buffer: *test-occur* : :b 3:cx @@ -232,7 +232,7 @@ i jx kx " "\ -3 matches for \"x^J.x\" in buffer: *temp*<2> +3 matches for \"x^J.x\" in buffer: *test-occur* 1:ax :bx :c @@ -256,7 +256,7 @@ f gx hx " "\ -2 matches for \"x^J.x\" in buffer: *temp*<2> +2 matches for \"x^J.x\" in buffer: *test-occur* 1:ax :bx :c @@ -279,7 +279,7 @@ g h ix " "\ -3 matches for \"x\" in buffer: *temp*<2> +3 matches for \"x\" in buffer: *test-occur* :a 2:bx ------- @@ -302,7 +302,7 @@ f gx h " "\ -3 matches for \"x\" in buffer: *temp*<2> +3 matches for \"x\" in buffer: *test-occur* :a 2:bx :c @@ -321,14 +321,19 @@ Each element has the format: (let ((regexp (nth 0 test)) (nlines (nth 1 test)) (input-buffer-string (nth 2 test)) - (output-buffer-string (nth 3 test))) - (save-window-excursion - (with-temp-buffer - (insert input-buffer-string) - (occur regexp nlines) - (equal output-buffer-string - (with-current-buffer "*Occur*" - (buffer-string))))))) + (output-buffer-string (nth 3 test)) + (temp-buffer (get-buffer-create " *test-occur*"))) + (unwind-protect + (save-window-excursion + (with-current-buffer temp-buffer + (erase-buffer) + (insert input-buffer-string) + (occur regexp nlines) + (equal output-buffer-string + (with-current-buffer "*Occur*" + (buffer-string))))) + (and (buffer-name temp-buffer) + (kill-buffer temp-buffer))))) (ert-deftest occur-tests () "Test the functionality of `occur'. From 2549c068e14ab1ddfb1f1ea38ca7736c16db7296 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 29 Jul 2012 12:45:48 +0800 Subject: [PATCH 38/89] Deactivate the mark on more copy operations, and indicate the copied region. * lisp/simple.el (indicate-copied-region): New function. (kill-ring-save): Split off from here. * lisp/rect.el (copy-rectangle-as-kill): Call indicate-copied-region. (kill-rectangle): Set deactivate-mark to t on read-only error. * lisp/register.el (copy-to-register, copy-rectangle-to-register): Deactivate the mark, and use indicate-copied-region. (append-to-register, prepend-to-register): Call Fixes: debbugs:10056 --- lisp/ChangeLog | 12 ++++++++ lisp/rect.el | 5 +++- lisp/register.el | 29 ++++++++++++++----- lisp/simple.el | 74 ++++++++++++++++++++++++++++-------------------- 4 files changed, 81 insertions(+), 39 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e0d6cb825f0..2d737a38f69 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,15 @@ +2012-07-29 Chong Yidong + + * simple.el (indicate-copied-region): New function. + (kill-ring-save): Split off from here. + + * rect.el (copy-rectangle-as-kill): Call indicate-copied-region. + (kill-rectangle): Set deactivate-mark to t on read-only error. + + * register.el (copy-to-register, copy-rectangle-to-register): + Deactivate the mark, and use indicate-copied-region (Bug#10056). + (append-to-register, prepend-to-register): Call + 2012-07-29 Juri Linkov * simple.el (async-shell-command-buffer): New defcustom. diff --git a/lisp/rect.el b/lisp/rect.el index 1bf7364e20d..c5e9a790ca2 100644 --- a/lisp/rect.el +++ b/lisp/rect.el @@ -219,6 +219,7 @@ even beep.)" (condition-case nil (setq killed-rectangle (delete-extract-rectangle start end fill)) ((buffer-read-only text-read-only) + (setq deactivate-mark t) (setq killed-rectangle (extract-rectangle start end)) (if kill-read-only-ok (progn (message "Read only text copied to kill ring") nil) @@ -230,7 +231,9 @@ even beep.)" "Copy the region-rectangle and save it as the last killed one." (interactive "r") (setq killed-rectangle (extract-rectangle start end)) - (setq deactivate-mark t)) + (setq deactivate-mark t) + (if (called-interactively-p 'interactive) + (indicate-copied-region (length (car killed-rectangle))))) ;;;###autoload (defun yank-rectangle () diff --git a/lisp/register.el b/lisp/register.el index 52c236e49be..2816c9831de 100644 --- a/lisp/register.el +++ b/lisp/register.el @@ -336,7 +336,11 @@ Called from program, takes four args: REGISTER, START, END and DELETE-FLAG. START and END are buffer positions indicating what to copy." (interactive "cCopy to register: \nr\nP") (set-register register (filter-buffer-substring start end)) - (if delete-flag (delete-region start end))) + (setq deactivate-mark t) + (cond (delete-flag + (delete-region start end)) + ((called-interactively-p 'interactive) + (indicate-copied-region)))) (defun append-to-register (register start end &optional delete-flag) "Append region to text in register REGISTER. @@ -350,7 +354,10 @@ START and END are buffer positions indicating what to append." register (cond ((not reg) text) ((stringp reg) (concat reg text)) (t (error "Register does not contain text"))))) - (if delete-flag (delete-region start end))) + (cond (delete-flag + (delete-region start end)) + ((called-interactively-p 'interactive) + (indicate-copied-region)))) (defun prepend-to-register (register start end &optional delete-flag) "Prepend region to text in register REGISTER. @@ -364,7 +371,10 @@ START and END are buffer positions indicating what to prepend." register (cond ((not reg) text) ((stringp reg) (concat text reg)) (t (error "Register does not contain text"))))) - (if delete-flag (delete-region start end))) + (cond (delete-flag + (delete-region start end)) + ((called-interactively-p 'interactive) + (indicate-copied-region)))) (defun copy-rectangle-to-register (register start end &optional delete-flag) "Copy rectangular region into register REGISTER. @@ -374,10 +384,15 @@ To insert this register in the buffer, use \\[insert-register]. Called from a program, takes four args: REGISTER, START, END and DELETE-FLAG. START and END are buffer positions giving two corners of rectangle." (interactive "cCopy rectangle to register: \nr\nP") - (set-register register - (if delete-flag - (delete-extract-rectangle start end) - (extract-rectangle start end)))) + (let ((rectangle (if delete-flag + (delete-extract-rectangle start end) + (extract-rectangle start end)))) + (set-register register rectangle) + (when (and (null delete-flag) + (called-interactively-p 'interactive)) + (setq deactivate-mark t) + (indicate-copied-region (length (car rectangle)))))) + (provide 'register) ;;; register.el ends here diff --git a/lisp/simple.el b/lisp/simple.el index cfcc63e9285..4b6d6c7a73b 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3408,38 +3408,50 @@ This command is similar to `copy-region-as-kill', except that it gives visual feedback indicating the extent of the region being copied." (interactive "r") (copy-region-as-kill beg end) - ;; This use of called-interactively-p is correct - ;; because the code it controls just gives the user visual feedback. + ;; This use of called-interactively-p is correct because the code it + ;; controls just gives the user visual feedback. (if (called-interactively-p 'interactive) - (let ((other-end (if (= (point) beg) end beg)) - (opoint (point)) - ;; Inhibit quitting so we can make a quit here - ;; look like a C-g typed as a command. - (inhibit-quit t)) - (if (pos-visible-in-window-p other-end (selected-window)) - ;; Swap point-and-mark quickly so as to show the region that - ;; was selected. Don't do it if the region is highlighted. - (unless (and (region-active-p) - (face-background 'region)) - ;; Swap point and mark. - (set-marker (mark-marker) (point) (current-buffer)) - (goto-char other-end) - (sit-for blink-matching-delay) - ;; Swap back. - (set-marker (mark-marker) other-end (current-buffer)) - (goto-char opoint) - ;; If user quit, deactivate the mark - ;; as C-g would as a command. - (and quit-flag mark-active - (deactivate-mark))) - (let* ((killed-text (current-kill 0)) - (message-len (min (length killed-text) 40))) - (if (= (point) beg) - ;; Don't say "killed"; that is misleading. - (message "Saved text until \"%s\"" - (substring killed-text (- message-len))) - (message "Saved text from \"%s\"" - (substring killed-text 0 message-len)))))))) + (indicate-copied-region))) + +(defun indicate-copied-region (&optional message-len) + "Indicate that the region text has been copied interactively. +If the mark is visible in the selected window, blink the cursor +between point and mark if there is currently no active region +highlighting. + +If the mark lies outside the selected window, display an +informative message containing a sample of the copied text. The +optional argument MESSAGE-LEN, if non-nil, specifies the length +of this sample text; it defaults to 40." + (let ((mark (mark t)) + (point (point)) + ;; Inhibit quitting so we can make a quit here + ;; look like a C-g typed as a command. + (inhibit-quit t)) + (if (pos-visible-in-window-p mark (selected-window)) + ;; Swap point-and-mark quickly so as to show the region that + ;; was selected. Don't do it if the region is highlighted. + (unless (and (region-active-p) + (face-background 'region)) + ;; Swap point and mark. + (set-marker (mark-marker) (point) (current-buffer)) + (goto-char mark) + (sit-for blink-matching-delay) + ;; Swap back. + (set-marker (mark-marker) mark (current-buffer)) + (goto-char point) + ;; If user quit, deactivate the mark + ;; as C-g would as a command. + (and quit-flag mark-active + (deactivate-mark))) + (let ((len (min (abs (- mark point)) + (or message-len 40)))) + (if (< point mark) + ;; Don't say "killed"; that is misleading. + (message "Saved text until \"%s\"" + (buffer-substring-no-properties (- mark len) mark)) + (message "Saved text from \"%s\"" + (buffer-substring-no-properties mark (+ mark len)))))))) (defun append-next-kill (&optional interactive) "Cause following command, if it kills, to append to previous kill. From 72b255c7e7856eb0abefb1149211a8be519f6fef Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 29 Jul 2012 00:16:45 -0700 Subject: [PATCH 39/89] deactive->inactive, inactivate->deactivate spelling fixes (Bug#10150) * NEWS: Document these changes. * leim/quail/uni-input.el (ucs-input-deactivate): Rename from ucs-input-inactivate. * leim/quail/hangul.el (hangul-input-method-deactivate): Rename from hangul-input-method-inactivate. * emulation/viper-init.el (viper-deactivate-input-method-action): Rename from viper-inactivate-input-method-action. (viper-deactivate-input-method): Rename from viper-inactivate-input-method. * lisp/follow.el (follow-inactive-menu): Rename from follow-deactive-menu. * lisp/international/mule-cmds.el (deactivate-input-method): Rename from inactivate-input-method. Also run input-method-deactivate-hook. (deactivate-current-input-method-function): Rename from inactivate-current-input-method-function. (input-method-deactivate-hook): New hook. (input-method-inactivate-hook): Mark obsolete. * lisp/international/quail.el (quail-activate): Also run quail-deactivate-hook. (quail-deactivate): Rename from quail-inactivate. * lisp/international/robin.el (robin-activate): Also run robin-deactivate-hook. (robin-deactivate): Rename from robin-inactivate. --- doc/lispref/hooks.texi | 2 +- etc/ChangeLog | 5 ++++ etc/NEWS | 29 +++++++++++++++++++++++ leim/ChangeLog | 8 +++++++ leim/quail/hangul.el | 10 +++++--- leim/quail/uni-input.el | 10 +++++--- lisp/ChangeLog | 22 ++++++++++++++++++ lisp/emulation/viper-init.el | 14 ++++++----- lisp/emulation/viper.el | 10 ++++---- lisp/follow.el | 4 ++-- lisp/international/mule-cmds.el | 41 +++++++++++++++++++-------------- lisp/international/quail.el | 24 ++++++++++++------- lisp/international/robin.el | 20 +++++++++++----- lisp/language/korea-util.el | 2 +- lisp/mail/sendmail.el | 2 +- 15 files changed, 150 insertions(+), 53 deletions(-) diff --git a/doc/lispref/hooks.texi b/doc/lispref/hooks.texi index 28888e37165..7c91b51b290 100644 --- a/doc/lispref/hooks.texi +++ b/doc/lispref/hooks.texi @@ -243,10 +243,10 @@ completion-annotate-function completion-at-point-functions completion-in-region-functions completion-list-insert-choice-function +deactivate-current-input-method-function describe-current-input-method-function filter-buffer-substring-functions font-lock-function -inactivate-current-input-method-function menu-bar-select-buffer-function read-file-name-function replace-re-search-function diff --git a/etc/ChangeLog b/etc/ChangeLog index 5fea1e1ea46..410332037d0 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,8 @@ +2012-07-29 Paul Eggert + + deactive->inactive, inactivate->deactivate spelling fixes (Bug#10150) + * NEWS: Document these changes. + 2012-07-28 Juanma Barranquero * NEWS: Fix typo. diff --git a/etc/NEWS b/etc/NEWS index 5f082cb0bc9..93da6f7dccf 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -499,6 +499,35 @@ third argument is a frame (that usage was obsolete since Emacs 22.2). but keywords or keyword-string pairs. The old argument list will still be supported for Emacs 24.x. +** Spelling changes. +Some Lisp symbols have been renamed to avoid problems with spelling +that is incorrect or inconsistent with how Emacs normally spells a word. + +*** Renamed functions + +**** hangul-input-method-inactivate -> hangul-input-method-deactivate +**** inactivate-input-method -> deactivate-input-method +**** quail-inactivate -> quail-deactivate +**** robin-inactivate -> robin-deactivate +**** viper-inactivate-input-method -> viper-deactivate-input-method +**** viper-inactivate-input-method-action -> + viper-deactivate-input-method-action +**** ucs-input-inactivate -> ucs-input-deactivate + +*** Renamed hooks +The old hooks are still supported for backward compatibility, but they +are deprecated and will be removed eventually. + +**** input-method-inactivate-hook -> input-method-deactivate-hook +**** robin-inactivate-hook -> robin-deactivate-hook +**** quail-inactivate-hook -> quail-deactivate-hook + +*** Renamed Lisp variables + +**** follow-deactive-menu -> follow-inactive-menu +**** inactivate-current-input-method-function -> + deactivate-current-input-method-function + ** The following obsolete variables and varaliases have been removed: *** `facemenu-unlisted-faces' diff --git a/leim/ChangeLog b/leim/ChangeLog index f3acaebec94..fbe656c037c 100644 --- a/leim/ChangeLog +++ b/leim/ChangeLog @@ -1,3 +1,11 @@ +2012-07-29 Paul Eggert + + deactive->inactive, inactivate->deactivate spelling fixes (Bug#10150) + * quail/uni-input.el (ucs-input-deactivate): + Rename from ucs-input-inactivate. + * quail/hangul.el (hangul-input-method-deactivate): + Rename from hangul-input-method-inactivate. + 2012-07-10 Stefan Monnier * quail/ipa.el: Use cl-lib. diff --git a/leim/quail/hangul.el b/leim/quail/hangul.el index d30957ae7e6..c66c47b47fc 100644 --- a/leim/quail/hangul.el +++ b/leim/quail/hangul.el @@ -512,7 +512,7 @@ When a Korean input method is off, convert the following hangul character." "Activate Hangul input method INPUT-METHOD. FUNC is a function to handle input key. HELP-TEXT is a text set in `hangul-input-method-help-text'." - (setq inactivate-current-input-method-function 'hangul-input-method-inactivate + (setq deactivate-current-input-method-function 'hangul-input-method-deactivate describe-current-input-method-function 'hangul-input-method-help hangul-input-method-help-text help-text) (quail-delete-overlays) @@ -520,8 +520,8 @@ HELP-TEXT is a text set in `hangul-input-method-help-text'." (add-hook 'minibuffer-exit-hook 'quail-exit-from-minibuffer)) (set (make-local-variable 'input-method-function) func)) -(defun hangul-input-method-inactivate () - "Inactivate the current Hangul input method." +(defun hangul-input-method-deactivate () + "Deactivate the current Hangul input method." (interactive) (unwind-protect (progn @@ -530,6 +530,10 @@ HELP-TEXT is a text set in `hangul-input-method-help-text'." (setq describe-current-input-method-function nil)) (kill-local-variable 'input-method-function))) +(define-obsolete-function-alias + 'hangul-input-method-inactivate + 'hangul-input-method-deactivate "24.2") + (defun hangul-input-method-help () "Describe the current Hangul input method." (interactive) diff --git a/leim/quail/uni-input.el b/leim/quail/uni-input.el index 8d0e28d15a4..1cab31f83bb 100644 --- a/leim/quail/uni-input.el +++ b/leim/quail/uni-input.el @@ -99,7 +99,7 @@ While this input method is active, the variable (quail-delete-overlays) (setq describe-current-input-method-function nil)) (kill-local-variable 'input-method-function)) - (setq inactivate-current-input-method-function 'ucs-input-inactivate) + (setq deactivate-current-input-method-function 'ucs-input-deactivate) (setq describe-current-input-method-function 'ucs-input-help) (quail-delete-overlays) (if (eq (selected-window) (minibuffer-window)) @@ -107,11 +107,15 @@ While this input method is active, the variable (set (make-local-variable 'input-method-function) 'ucs-input-method))) -(defun ucs-input-inactivate () - "Inactivate UCS input method." +(defun ucs-input-deactivate () + "Deactivate UCS input method." (interactive) (ucs-input-activate -1)) +(define-obsolete-function-alias + 'ucs-input-inactivate + 'ucs-input-deactivate "24.2") + (defun ucs-input-help () (interactive) (with-output-to-temp-buffer "*Help*" diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2d737a38f69..fc96da8a0e3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,25 @@ +2012-07-29 Paul Eggert + + deactive->inactive, inactivate->deactivate spelling fixes (Bug#10150) + * emulation/viper-init.el (viper-deactivate-input-method-action): + Rename from viper-inactivate-input-method-action. + (viper-deactivate-input-method): + Rename from viper-inactivate-input-method. + * follow.el (follow-inactive-menu): Rename from follow-deactive-menu. + * international/mule-cmds.el (deactivate-input-method): + Rename from inactivate-input-method. + Also run input-method-deactivate-hook. + (deactivate-current-input-method-function): + Rename from inactivate-current-input-method-function. + (input-method-deactivate-hook): New hook. + (input-method-inactivate-hook): Mark obsolete. + * international/quail.el (quail-activate): + Also run quail-deactivate-hook. + (quail-deactivate): Rename from quail-inactivate. + * international/robin.el (robin-activate): + Also run robin-deactivate-hook. + (robin-deactivate): Rename from robin-inactivate. + 2012-07-29 Chong Yidong * simple.el (indicate-copied-region): New function. diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el index 76a8c410676..9f0826bf515 100644 --- a/lisp/emulation/viper-init.el +++ b/lisp/emulation/viper-init.el @@ -316,7 +316,7 @@ Use `M-x viper-set-expert-level' to change this.") )) ;; viper hook to run on input-method deactivation -(defun viper-inactivate-input-method-action () +(defun viper-deactivate-input-method-action () (if (null viper-mule-hook-flag) () (setq viper-special-input-method nil) @@ -328,9 +328,9 @@ Use `M-x viper-set-expert-level' to change this.") (or current-input-method default-input-method)) ""))))) -(defun viper-inactivate-input-method () - (cond ((and (featurep 'emacs) (fboundp 'inactivate-input-method)) - (inactivate-input-method)) +(defun viper-deactivate-input-method () + (cond ((and (featurep 'emacs) (fboundp 'deactivate-input-method)) + (deactivate-input-method)) ((and (featurep 'xemacs) (boundp 'current-input-method)) ;; XEmacs had broken quail-mode for some time, so we are working around ;; it here @@ -339,7 +339,9 @@ Use `M-x viper-set-expert-level' to change this.") (quail-delete-overlays)) (setq describe-current-input-method-function nil) (setq current-input-method nil) - (run-hooks 'input-method-inactivate-hook) + (run-hooks + 'input-method-inactivate-hook ; for backward compatibility + 'input-method-deactivate-hook) (force-mode-line-update)) )) (defun viper-activate-input-method () @@ -356,7 +358,7 @@ Use `M-x viper-set-expert-level' to change this.") ;; activate input method (viper-activate-input-method)) (t ; deactivate input method - (viper-inactivate-input-method))) + (viper-deactivate-input-method))) )) diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el index 4219688a4ba..81fbfb0394c 100644 --- a/lisp/emulation/viper.el +++ b/lisp/emulation/viper.el @@ -971,9 +971,9 @@ It also can't undo some Viper settings." (if (featurep 'emacs) (eval-after-load "mule-cmds" '(progn - (defadvice inactivate-input-method (after viper-mule-advice activate) + (defadvice deactivate-input-method (after viper-mule-advice activate) "Set viper-special-input-method to disable intl. input methods." - (viper-inactivate-input-method-action)) + (viper-deactivate-input-method-action)) (defadvice activate-input-method (after viper-mule-advice activate) "Set viper-special-input-method to enable intl. input methods." (viper-activate-input-method-action)) @@ -985,14 +985,14 @@ It also can't undo some Viper settings." '(progn (add-hook 'input-method-activate-hook 'viper-activate-input-method-action t) - (add-hook 'input-method-inactivate-hook - 'viper-inactivate-input-method-action t))) + (add-hook 'input-method-deactivate-hook + 'viper-deactivate-input-method-action t))) ) (eval-after-load "mule-cmds" '(defadvice toggle-input-method (around viper-mule-advice activate) "Adjust input-method toggling in vi-state." (if (and viper-special-input-method (eq viper-current-state 'vi-state)) - (viper-inactivate-input-method) + (viper-deactivate-input-method) ad-do-it))) ) ; viper-set-hooks diff --git a/lisp/follow.el b/lisp/follow.el index 0dea1917f85..a74862cb5d0 100644 --- a/lisp/follow.el +++ b/lisp/follow.el @@ -334,8 +334,8 @@ property `follow-mode-use-cache' to non-nil.") (defvar follow-active-menu nil "The menu visible when Follow mode is active.") -(defvar follow-deactive-menu nil - "The menu visible when Follow mode is deactivated.") +(defvar follow-inactive-menu nil + "The menu visible when Follow mode is inactive.") (defvar follow-inside-post-command-hook nil "Non-nil when inside Follow modes `post-command-hook'. diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index b122721c96e..5a3f7246f9c 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -92,7 +92,7 @@ (bindings--define-key map [set-keyboard-coding-system] '(menu-item "For Keyboard" set-keyboard-coding-system :help "How to decode keyboard input")) - + (bindings--define-key map [separator-2] menu-bar-separator) (bindings--define-key map [set-file-name-coding-system] '(menu-item "For File Name" set-file-name-coding-system @@ -128,7 +128,7 @@ `(menu-item "Describe Language Environment" ,describe-language-environment-map :help "Show multilingual settings for a specific language")) - + (bindings--define-key map [separator-coding-system] menu-bar-separator) (bindings--define-key map [view-hello-file] '(menu-item "Show Multilingual Sample Text" view-hello-file @@ -1331,15 +1331,15 @@ of `history-length', which see.") (make-variable-buffer-local 'input-method-history) (put 'input-method-history 'permanent-local t) -(defvar inactivate-current-input-method-function nil - "Function to call for inactivating the current input method. +(defvar deactivate-current-input-method-function nil + "Function to call for deactivating the current input method. Every input method should set this to an appropriate value when activated. This function is called with no argument. This function should never change the value of `current-input-method'. -It is set to nil by the function `inactivate-input-method'.") -(make-variable-buffer-local 'inactivate-current-input-method-function) -(put 'inactivate-current-input-method-function 'permanent-local t) +It is set to nil by the function `deactivate-input-method'.") +(make-variable-buffer-local 'deactivate-current-input-method-function) +(put 'deactivate-current-input-method-function 'permanent-local t) (defvar describe-current-input-method-function nil "Function to call for describing the current input method. @@ -1426,7 +1426,7 @@ If INPUT-METHOD is nil, deactivate any current input method." (setq input-method (symbol-name input-method))) (if (and current-input-method (not (string= current-input-method input-method))) - (inactivate-input-method)) + (deactivate-input-method)) (unless (or current-input-method (null input-method)) (let ((slot (assoc input-method input-method-alist))) (if (null slot) @@ -1447,7 +1447,7 @@ If INPUT-METHOD is nil, deactivate any current input method." (run-hooks 'input-method-activate-hook) (force-mode-line-update))))) -(defun inactivate-input-method () +(defun deactivate-input-method () "Turn off the current input method." (when current-input-method (if input-method-history @@ -1460,9 +1460,11 @@ If INPUT-METHOD is nil, deactivate any current input method." (progn (setq input-method-function nil current-input-method-title nil) - (funcall inactivate-current-input-method-function)) + (funcall deactivate-current-input-method-function)) (unwind-protect - (run-hooks 'input-method-inactivate-hook) + (run-hooks + 'input-method-inactivate-hook ; for backward compatibility + 'input-method-deactivate-hook) (setq current-input-method nil) (force-mode-line-update))))) @@ -1476,7 +1478,7 @@ When called interactively, the optional arg INTERACTIVE is non-nil, which marks the variable `default-input-method' as set for Custom buffers. To deactivate the input method interactively, use \\[toggle-input-method]. -To deactivate it programmatically, use `inactivate-input-method'." +To deactivate it programmatically, use `deactivate-input-method'." (interactive (let* ((default (or (car input-method-history) default-input-method))) (list (read-input-method-name @@ -1513,7 +1515,7 @@ which marks the variable `default-input-method' as set for Custom buffers." (if toggle-input-method-active (error "Recursive use of `toggle-input-method'")) (if (and current-input-method (not arg)) - (inactivate-input-method) + (deactivate-input-method) (let ((toggle-input-method-active t) (default (or (car input-method-history) default-input-method))) (if (and arg default (equal current-input-method default) @@ -1640,13 +1642,18 @@ just activated." :type 'hook :group 'mule) -(defcustom input-method-inactivate-hook nil - "Normal hook run just after an input method is inactivated. +(define-obsolete-variable-alias + 'input-method-inactivate-hook + 'input-method-deactivate-hook "24.2") + +(defcustom input-method-deactivate-hook nil + "Normal hook run just after an input method is deactivated. The variable `current-input-method' still keeps the input method name -just inactivated." +just deactivated." :type 'hook - :group 'mule) + :group 'mule + :version "24.2") (defcustom input-method-after-insert-chunk-hook nil "Normal hook run just after an input method insert some chunk of text." diff --git a/lisp/international/quail.el b/lisp/international/quail.el index fecc9427731..65ef807c238 100644 --- a/lisp/international/quail.el +++ b/lisp/international/quail.el @@ -540,32 +540,36 @@ non-Quail commands." (if (and (overlayp quail-conv-overlay) (overlay-start quail-conv-overlay)) (delete-overlay quail-conv-overlay))) -(defun quail-inactivate () - "Inactivate Quail input method. +(defun quail-deactivate () + "Deactivate Quail input method. -This function runs the normal hook `quail-inactivate-hook'." +This function runs the normal hook `quail-deactivate-hook'." (interactive) (quail-activate -1)) +(define-obsolete-function-alias 'quail-inactivate 'quail-deactivate "24.2") + (defun quail-activate (&optional arg) "Activate Quail input method. With ARG, activate Quail input method if and only if arg is positive. This function runs `quail-activate-hook' if it activates the input -method, `quail-inactivate-hook' if it deactivates it. +method, `quail-deactivate-hook' if it deactivates it. While this input method is active, the variable `input-method-function' is bound to the function `quail-input-method'." (if (and arg (< (prefix-numeric-value arg) 0)) - ;; Let's inactivate Quail input method. + ;; Let's deactivate Quail input method. (unwind-protect (progn (quail-delete-overlays) (setq describe-current-input-method-function nil) (quail-hide-guidance) (remove-hook 'post-command-hook 'quail-show-guidance t) - (run-hooks 'quail-inactivate-hook)) + (run-hooks + 'quail-inactivate-hook ; for backward compatibility + 'quail-deactivate-hook)) (kill-local-variable 'input-method-function)) ;; Let's activate Quail input method. (if (null quail-current-package) @@ -575,7 +579,7 @@ While this input method is active, the variable (setq name (car (car quail-package-alist))) (error "No Quail package loaded")) (quail-select-package name))) - (setq inactivate-current-input-method-function 'quail-inactivate) + (setq deactivate-current-input-method-function 'quail-deactivate) (setq describe-current-input-method-function 'quail-help) (quail-delete-overlays) (setq quail-guidance-str "") @@ -589,8 +593,12 @@ While this input method is active, the variable (make-local-variable 'input-method-function) (setq input-method-function 'quail-input-method))) +(define-obsolete-variable-alias + 'quail-inactivate-hook + 'quail-deactivate-hook "24.2") + (defun quail-exit-from-minibuffer () - (inactivate-input-method) + (deactivate-input-method) (if (<= (minibuffer-depth) 1) (remove-hook 'minibuffer-exit-hook 'quail-exit-from-minibuffer))) diff --git a/lisp/international/robin.el b/lisp/international/robin.el index 73a06bb2ccd..fee4c330e6e 100644 --- a/lisp/international/robin.el +++ b/lisp/international/robin.el @@ -390,12 +390,14 @@ A nil value means no package is selected.") (setq robin-current-package-name name) (robin-activate))) -(defun robin-inactivate () - "Inactivate robin input method." +(defun robin-deactivate () + "Deactivate robin input method." (interactive) (robin-activate -1)) +(define-obsolete-function-alias 'robin-inactivate 'robin-deactivate "24.2") + (defun robin-activate (&optional arg) "Activate robin input method. @@ -406,18 +408,20 @@ While this input method is active, the variable (if (and arg (< (prefix-numeric-value arg) 0)) - ;; inactivate robin input method. + ;; deactivate robin input method. (unwind-protect (progn (setq robin-mode nil) (setq describe-current-input-method-function nil) - (run-hooks 'robin-inactivate-hook)) + (run-hooks + 'robin-inactivate-hook ; for backward compatibility + 'robin-deactivate-hook)) (kill-local-variable 'input-method-function)) ;; activate robin input method. (setq robin-mode t describe-current-input-method-function 'robin-help - inactivate-current-input-method-function 'robin-inactivate) + deactivate-current-input-method-function 'robin-deactivate) (if (eq (selected-window) (minibuffer-window)) (add-hook 'minibuffer-exit-hook 'robin-exit-from-minibuffer)) (run-hooks 'input-method-activate-hook @@ -425,8 +429,12 @@ While this input method is active, the variable (set (make-local-variable 'input-method-function) 'robin-input-method))) +(define-obsolete-variable-alias + 'robin-inactivate-hook + 'robin-deactivate-hook "24.2") + (defun robin-exit-from-minibuffer () - (inactivate-input-method) + (deactivate-input-method) (if (<= (minibuffer-depth) 1) (remove-hook 'minibuffer-exit-hook 'robin-exit-from-minibuffer))) diff --git a/lisp/language/korea-util.el b/lisp/language/korea-util.el index ee8ebb7b2e7..abd5b29ba6e 100644 --- a/lisp/language/korea-util.el +++ b/lisp/language/korea-util.el @@ -41,7 +41,7 @@ "Turn on or off a Korean text input method for the current buffer." (interactive) (if current-input-method - (inactivate-input-method) + (deactivate-input-method) (activate-input-method (concat "korean-hangul" default-korean-keyboard)))) diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el index 3b262e3fb53..b75841489c9 100644 --- a/lisp/mail/sendmail.el +++ b/lisp/mail/sendmail.el @@ -616,7 +616,7 @@ This also saves the value of `send-mail-function' via Customize." ;; (kill-local-variable 'enable-multibyte-characters) (set-buffer-multibyte (default-value 'enable-multibyte-characters)) (if current-input-method - (inactivate-input-method)) + (deactivate-input-method)) ;; Local variables for Mail mode. (setq mail-send-actions actions) From b46a6a83b3c30d34aa6b80633394c74e6145291c Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 29 Jul 2012 01:18:29 -0700 Subject: [PATCH 40/89] Don't use the abbreviation "win" to refer to Windows (Bug#10421). * lisp/org/ob-lilypond.el (ly-w32-ly-path): Rename from ly-win32-ly-path. (ly-w32-pdf-path): Rename from ly-win32-pdf-path. (ly-w32-midi-path): Rename from ly-win32-midi-path. (ly-determine-ly-path, ly-determine-pdf-path, ly-determine-midi-path): Check for "windows-nt", not "win32", in system-type. * src/regex.c (MAX_BUF_SIZE): Remove some incorrect and long-ago-commented-out code that talks about "WIN32". * src/w32heap.h (OS_WINDOWS_95): Rename from OS_WIN95. All uses changed. --- doc/misc/ChangeLog | 2 +- doc/misc/gnus-faq.texi | 2 +- doc/misc/gnus.texi | 2 +- doc/misc/idlwave.texi | 2 +- doc/misc/mh-e.texi | 4 +--- leim/makefile.w32-in | 2 +- lib-src/makefile.w32-in | 2 +- lib/makefile.w32-in | 2 +- lisp/ChangeLog | 2 +- lisp/ChangeLog.8 | 2 +- lisp/dos-w32.el | 2 +- lisp/mail/feedmail.el | 2 +- lisp/makefile.w32-in | 2 +- lisp/mh-e/ChangeLog.1 | 4 ++-- lisp/net/ange-ftp.el | 2 +- lisp/org/ChangeLog | 9 +++++++++ lisp/org/ob-lilypond.el | 18 +++++++++--------- lisp/printing.el | 2 +- nt/ChangeLog | 6 +++--- nt/INSTALL | 6 +++--- nt/configure.bat | 6 +++--- nt/makefile.w32-in | 2 +- src/ChangeLog | 8 ++++++++ src/ChangeLog.10 | 6 +++--- src/ChangeLog.11 | 3 ++- src/ChangeLog.6 | 18 +++++++++--------- src/ChangeLog.7 | 8 ++++---- src/ChangeLog.8 | 2 +- src/dbusbind.c | 2 +- src/makefile.w32-in | 2 +- src/regex.c | 14 -------------- src/sound.c | 2 +- src/w32.c | 6 +++--- src/w32console.c | 4 ++-- src/w32fns.c | 4 ++-- src/w32font.c | 6 +++--- src/w32font.h | 2 +- src/w32gui.h | 2 +- src/w32heap.c | 6 +++--- src/w32heap.h | 3 +-- src/w32inevt.c | 2 +- src/w32inevt.h | 3 +-- src/w32menu.c | 2 +- src/w32proc.c | 12 ++++++------ src/w32select.c | 2 +- src/w32term.c | 2 +- src/w32term.h | 2 +- src/w32xfns.c | 2 +- 48 files changed, 104 insertions(+), 104 deletions(-) diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index d2312db1801..fe7687424ca 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -4719,7 +4719,7 @@ 2007-11-07 Michael Albinus * tramp.texi (Overview): Mention also the PuTTY integration under - Win32. Remove paragraphs about Tramp's experimental status. + w32. Remove paragraphs about Tramp's experimental status. (Frequently Asked Questions): Add code example for highlighting the mode line. diff --git a/doc/misc/gnus-faq.texi b/doc/misc/gnus-faq.texi index 0c8c8505e27..6c2946549e8 100644 --- a/doc/misc/gnus-faq.texi +++ b/doc/misc/gnus-faq.texi @@ -407,7 +407,7 @@ you want, so let's do it the correct way. The first thing you've got to do is to create a suitable directory (no blanks in directory name please) e.g. c:\myhome. Then you must set the environment -variable HOME to this directory. To do this under Win9x +variable HOME to this directory. To do this under Windows 9x or Me include the line @example diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index df4493789b6..afc324e3fb4 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -29959,7 +29959,7 @@ Here's a typical score file: @lisp (("summary" - ("win95" -10000 nil s) + ("Windows 95" -10000 nil s) ("Gnus")) ("from" ("Lars" -1000)) diff --git a/doc/misc/idlwave.texi b/doc/misc/idlwave.texi index 030653bbe6d..feef325ad30 100644 --- a/doc/misc/idlwave.texi +++ b/doc/misc/idlwave.texi @@ -4020,7 +4020,7 @@ user is King! @end example @html - + @end html @node Windows and MacOS, Troubleshooting, Configuration Examples, Top @appendix Windows and MacOS diff --git a/doc/misc/mh-e.texi b/doc/misc/mh-e.texi index 538c3f1ba82..f6adc435789 100644 --- a/doc/misc/mh-e.texi +++ b/doc/misc/mh-e.texi @@ -7901,7 +7901,7 @@ PATH=$PATH:/usr/bin/mh MAILDIR=$HOME/`mhparam Path` # -# Filter messages with win32 executables/virii. +# Filter messages with w32 executables/virii. # # These attachments are base64 and have a TVqQAAMAAAAEAAAA//8AALg # pattern. The string "this program cannot be run in MS-DOS mode" @@ -9060,5 +9060,3 @@ Bill Wohler, August 2008 @c Local Variables: @c sentence-end-double-space: nil @c End: - - diff --git a/leim/makefile.w32-in b/leim/makefile.w32-in index e9a56e79f73..fa4afe81064 100644 --- a/leim/makefile.w32-in +++ b/leim/makefile.w32-in @@ -1,4 +1,4 @@ -# -*- Makefile -*- for leim subdirectory in GNU Emacs on the Microsoft W32 API. +# -*- Makefile -*- for leim subdirectory in GNU Emacs on the Microsoft Windows API. # Copyright (C) 2000-2012 Free Software Foundation, Inc. # Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, diff --git a/lib-src/makefile.w32-in b/lib-src/makefile.w32-in index 4b2b523ea34..ba76c6df93f 100644 --- a/lib-src/makefile.w32-in +++ b/lib-src/makefile.w32-in @@ -1,4 +1,4 @@ -# -*- Makefile -*- for GNU Emacs on the Microsoft W32 API. +# -*- Makefile -*- for GNU Emacs on the Microsoft Windows API. # Copyright (C) 2000-2012 Free Software Foundation, Inc. # This file is part of GNU Emacs. diff --git a/lib/makefile.w32-in b/lib/makefile.w32-in index b49195bcb84..345520798eb 100644 --- a/lib/makefile.w32-in +++ b/lib/makefile.w32-in @@ -1,4 +1,4 @@ -# -*- Makefile -*- for GNU Emacs on the Microsoft W32 API. +# -*- Makefile -*- for GNU Emacs on the Microsoft Windows API. # Copyright (C) 2011 Free Software Foundation, Inc. # This file is part of GNU Emacs. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index fc96da8a0e3..d55ecc7fd52 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -10434,7 +10434,7 @@ (tramp-completion-file-name-regexp-unified) (tramp-completion-file-name-regexp-separate) (tramp-completion-file-name-regexp-url): Don't use leading volume - letter on win32 systems. (Bug#5303, Bug#9311) + letter on w32 systems. (Bug#5303, Bug#9311) (tramp-drop-volume-letter): Simplify definition. Suggested by Stefan Monnier . diff --git a/lisp/ChangeLog.8 b/lisp/ChangeLog.8 index ccc9b473de3..0380fb117db 100644 --- a/lisp/ChangeLog.8 +++ b/lisp/ChangeLog.8 @@ -6906,7 +6906,7 @@ standard `print' and `nprint' programs, as well as `lpr' and similar programs. Only write directly to the printer port if no print program is specified. Work around a bug in Windows 9x - affecting Win32 version of Emacs by invoking command.com to write + affecting the w32 version of Emacs by invoking command.com to write to the printer port instead of writing directly. (direct-print-region-function): Use direct-print-region-helper to do most of the work. diff --git a/lisp/dos-w32.el b/lisp/dos-w32.el index f68af7a73be..4839d6b9239 100644 --- a/lisp/dos-w32.el +++ b/lisp/dos-w32.el @@ -361,7 +361,7 @@ filesystem mounted on drive Z:, FILESYSTEM could be \"Z:\"." (apply 'call-process lpr-prog nil errbuf nil rest)) ;; Run command.com to access printer port on Windows 9x, unless ;; we are supposed to append to an existing (non-empty) file, - ;; to work around a bug in Windows 9x that prevents Win32 + ;; to work around a bug in Windows 9x that prevents Windows ;; programs from accessing LPT ports reliably. ((and (eq system-type 'windows-nt) (getenv "winbootdir") diff --git a/lisp/mail/feedmail.el b/lisp/mail/feedmail.el index c6d1d228780..520271940f2 100644 --- a/lisp/mail/feedmail.el +++ b/lisp/mail/feedmail.el @@ -2334,7 +2334,7 @@ mapped to mostly alphanumerics for safety." (if (and is-fqm is-in-this-dir) (setq filename buffer-file-name) (setq filename (feedmail-create-queue-filename queue-directory))) - ;; make binary file on DOS/Win95/WinNT, etc + ;; make binary file on DOS/Windows 95/Windows NT, etc (let ((buffer-file-type feedmail-force-binary-write)) (write-file filename)) ;; convenient for moving from draft to q, for example diff --git a/lisp/makefile.w32-in b/lisp/makefile.w32-in index c7d883e4295..756d2b949fa 100644 --- a/lisp/makefile.w32-in +++ b/lisp/makefile.w32-in @@ -1,4 +1,4 @@ -# -*- Makefile -*- for GNU Emacs on the Microsoft W32 API. +# -*- Makefile -*- for GNU Emacs on the Microsoft Windows API. # Copyright (C) 2000-2012 Free Software Foundation, Inc. # This file is part of GNU Emacs. diff --git a/lisp/mh-e/ChangeLog.1 b/lisp/mh-e/ChangeLog.1 index 94ac7a2f3b7..15b7380b737 100644 --- a/lisp/mh-e/ChangeLog.1 +++ b/lisp/mh-e/ChangeLog.1 @@ -9493,9 +9493,9 @@ * mh-utils.el (mh-find-progs): Run PATH search only when mh-progs, mh-lib and mh-lib-progs are not all already set. This allows the user to set them using a simple setq prior to loading mh-e. This - is useful for implementation of mh-e on win32. Note that many + is useful for implementation of mh-e on w32. Note that many commands still call mh-find-path which also parses the mh_profile - file (that may still fail on win32), so this is still done often. + file (that may still fail on w32), so this is still done often. But it lets us change the mh_profile file and have mh-e see the changed file without exiting emacs and starting over so I left that in. diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el index dd695c29c78..1501fa41baa 100644 --- a/lisp/net/ange-ftp.el +++ b/lisp/net/ange-ftp.el @@ -2618,7 +2618,7 @@ away in the internal cache." (format "list data file %s not readable" temp)))) - ;; remove ^M inserted by the win32 ftp client + ;; remove ^M inserted by the w32 ftp client (while (re-search-forward "\r$" nil t) (replace-match "")) (goto-char 1) diff --git a/lisp/org/ChangeLog b/lisp/org/ChangeLog index eae83f044a0..cf9c32006ac 100644 --- a/lisp/org/ChangeLog +++ b/lisp/org/ChangeLog @@ -1,3 +1,12 @@ +2012-07-29 Paul Eggert + + Don't use the abbreviation "win" to refer to Windows (Bug#10421). + * ob-lilypond.el (ly-w32-ly-path): Rename from ly-win32-ly-path. + (ly-w32-pdf-path): Rename from ly-win32-pdf-path. + (ly-w32-midi-path): Rename from ly-win32-midi-path. + (ly-determine-ly-path, ly-determine-pdf-path, ly-determine-midi-path): + Check for "windows-nt", not "win32", in system-type. + 2012-06-02 Chong Yidong * org-clock.el (org-clock-string-limit) diff --git a/lisp/org/ob-lilypond.el b/lisp/org/ob-lilypond.el index a1e4c9f83e4..b3e77f32e55 100644 --- a/lisp/org/ob-lilypond.el +++ b/lisp/org/ob-lilypond.el @@ -66,9 +66,9 @@ the midi file is not automatically played. Default value is t") (defvar ly-nix-pdf-path "evince") (defvar ly-nix-midi-path "timidity") -(defvar ly-win32-ly-path "lilypond") -(defvar ly-win32-pdf-path "") -(defvar ly-win32-midi-path "") +(defvar ly-w32-ly-path "lilypond") +(defvar ly-w32-pdf-path "") +(defvar ly-w32-midi-path "") (defvar ly-gen-png nil "Image generation (png) can be turned on by default by setting @@ -329,8 +329,8 @@ If TEST is non-nil, it contains a simulation of the OS for test purposes" (or test system-type))) (cond ((string= sys-type "darwin") ly-OSX-ly-path) - ((string= sys-type "win32") - ly-win32-ly-path) + ((string= sys-type "windows-nt") + ly-w32-ly-path) (t ly-nix-ly-path)))) (defun ly-determine-pdf-path (&optional test) @@ -341,8 +341,8 @@ If TEST is non-nil, it contains a simulation of the OS for test purposes" (or test system-type))) (cond ((string= sys-type "darwin") ly-OSX-pdf-path) - ((string= sys-type "win32") - ly-win32-pdf-path) + ((string= sys-type "windows-nt") + ly-w32-pdf-path) (t ly-nix-pdf-path)))) (defun ly-determine-midi-path (&optional test) @@ -353,8 +353,8 @@ If TEST is non-nil, it contains a simulation of the OS for test purposes" (or test test system-type))) (cond ((string= sys-type "darwin") ly-OSX-midi-path) - ((string= sys-type "win32") - ly-win32-midi-path) + ((string= sys-type "windows-nt") + ly-w32-midi-path) (t ly-nix-midi-path)))) (defun ly-toggle-midi-play () diff --git a/lisp/printing.el b/lisp/printing.el index bf5b8a91f01..0152ed63dbb 100644 --- a/lisp/printing.el +++ b/lisp/printing.el @@ -2141,7 +2141,7 @@ Useful links: `http://bama.ua.edu/cgi-bin/man-cgi?lp' `http://www.mediacollege.com/cgi-bin/man/page.cgi?section=all&topic=lp' -* GNU utilities for Win32 (cp.exe) +* GNU utilities for w32 (cp.exe) `http://unxutils.sourceforge.net/' " :type '(repeat diff --git a/nt/ChangeLog b/nt/ChangeLog index f0e9f247d14..4db23d045a8 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog @@ -905,7 +905,7 @@ 2008-04-04 Jason Rumney - * INSTALL: Update W32 API requirements. + * INSTALL: Update Windows API requirements. 2008-04-03 Jason Rumney @@ -2322,7 +2322,7 @@ * makefile.def (CP_DIR): Use platform independent switches for xcopy. * makefile.nt (install, fast_install, real_install, clean): - Don't use switches to del not supported by Win95. + Don't use switches to del not supported by Windows 95. 1995-11-07 Kevin Gallo @@ -2376,7 +2376,7 @@ 1995-05-27 Geoff Voelker * ebuild.bat, emacs.bat, fast-install.bat, install.bat: - Add carriage returns; necessary for batch files on Win95. + Add carriage returns; necessary for batch files on Windows 95. 1995-05-25 Geoff Voelker diff --git a/nt/INSTALL b/nt/INSTALL index 96ef52faf5e..2293610adf3 100644 --- a/nt/INSTALL +++ b/nt/INSTALL @@ -121,7 +121,7 @@ To compile Emacs, you will need either Microsoft Visual C++ 2.0, or later and nmake, or a Windows port of GCC 2.95 or later with MinGW - and W32 API support and a port of GNU Make. You can use the Cygwin + and Windows API support and a port of GNU Make. You can use the Cygwin ports of GCC, but Emacs requires the MinGW headers and libraries to build (latest versions of the Cygwin toolkit, at least since v1.3.3, include the MinGW headers and libraries as an integral part). @@ -591,7 +591,7 @@ * Trouble-shooting The main problems that are likely to be encountered when building - Emacs stem from using an old version of GCC, or old MinGW or W32 API + Emacs stem from using an old version of GCC, or old MinGW or Windows API headers. Additionally, Cygwin ports of GNU make may require the Emacs source tree to be mounted with text!=binary, because the makefiles generated by configure.bat necessarily use DOS line endings. Also, @@ -603,7 +603,7 @@ 2.95 or later is needed, because that is when the Windows port gained sufficient support for anonymous structs and unions to cope with some definitions from winnt.h that are used by addsection.c. - Older versions of the W32 API headers that come with Cygwin and MinGW + Older versions of the Windows API headers that come with Cygwin and MinGW may be missing some definitions required by Emacs, or broken in other ways. In particular, uniscribe APIs were added to MinGW CVS only on 2006-03-26, so releases from before then cannot be used. diff --git a/nt/configure.bat b/nt/configure.bat index e91165de473..56793a0d1c3 100755 --- a/nt/configure.bat +++ b/nt/configure.bat @@ -23,7 +23,7 @@ rem YOU'LL NEED THE FOLLOWING UTILITIES TO MAKE EMACS: rem rem + MS Windows 95, NT or later rem + either MSVC 2.x or later, or gcc-2.95 or later (with GNU make 3.75 -rem or later) and the Mingw32 and W32 API headers and libraries. +rem or later) and the Mingw32 and Windows API headers and libraries. rem + Visual Studio 2005 is not supported at this time. rem rem For reference, here is a list of which builds of GNU make are known to @@ -426,7 +426,7 @@ rem problem). The gcc/mingw32 2.95.2 headers are okay, as are distros rem of w32api-xxx.zip from Anders Norlander since 1999-11-18 at least. rem Beginning with Emacs 23, we need usp10.h. rem -echo Checking whether W32 API headers are too old... +echo Checking whether Windows API headers are too old... echo #include "windows.h" >junk.c echo #include "usp10.h" >>junk.c echo test(PIMAGE_NT_HEADERS pHeader) >>junk.c @@ -469,7 +469,7 @@ goto end echo. echo Configure failed. echo To configure Emacs for Windows, you need to have either -echo gcc-2.95 or later with Mingw32 and the W32 API headers, +echo gcc-2.95 or later with Mingw32 and the Windows API headers, echo or MSVC 2.x or later. del junk.c goto end diff --git a/nt/makefile.w32-in b/nt/makefile.w32-in index 274ce7e5271..fc5ecefd173 100644 --- a/nt/makefile.w32-in +++ b/nt/makefile.w32-in @@ -1,4 +1,4 @@ -# -*- Makefile -*- for GNU Emacs on the Microsoft W32 API. +# -*- Makefile -*- for GNU Emacs on the Microsoft Windows API. # Copyright (C) 2000-2012 Free Software Foundation, Inc. # # Top level makefile for building GNU Emacs on Windows NT diff --git a/src/ChangeLog b/src/ChangeLog index cc112f4b5da..21ba05adf6d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2012-07-29 Paul Eggert + + Don't use the abbreviation "win" to refer to Windows (Bug#10421). + * regex.c (MAX_BUF_SIZE): Remove some incorrect and + long-ago-commented-out code that talks about "WIN32". + * w32heap.h (OS_WINDOWS_95): Rename from OS_WIN95. + All uses changed. + 2012-07-28 Paul Eggert Use Gnulib stdalign module (Bug#9772, Bug#9960). diff --git a/src/ChangeLog.10 b/src/ChangeLog.10 index cf62ec29bbc..6eda101c815 100644 --- a/src/ChangeLog.10 +++ b/src/ChangeLog.10 @@ -15825,7 +15825,7 @@ * w32term.c (w32_draw_fringe_bitmap): Copy unadapted code from xterm.c to handle overlaid fringe bitmaps and to use cursor color for displaying cursor in fringe. - (w32_define_fringe_bitmap, w32_destroy_fringe_bitmap): New W32 + (w32_define_fringe_bitmap, w32_destroy_fringe_bitmap): New Windows specific functions to define and destroy fringe bitmaps in fringe_bmp. (w32_redisplay_interface): Add them to redisplay_interface. (w32_term_init): Call w32_init_fringe instead of explicitly @@ -21476,7 +21476,7 @@ "Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs builtpart of on XP crashes at startup on Windows 9x/ME." - * w32.c: Added wrapper functions around the win32 API functions + * w32.c: Added wrapper functions around the Windows API functions OpenProcessToken, GetTokenInformation, LookupAccountSid, and GetSidIdentifierAuthority. These wrapper functions serve two purposes: @@ -21490,7 +21490,7 @@ the version of advapi32.dll that is found in the 9x branch of Microsoft Windows. - * w32.c (init_user_info): Replace the calls to the win32 API + * w32.c (init_user_info): Replace the calls to the Windows API functions OpenProcessToken, GetTokenInformation, LookupAccountSid, and GetSidIdentifierAuthority with calls to the newly added wrapper functions. diff --git a/src/ChangeLog.11 b/src/ChangeLog.11 index 781027ee8ae..d3b0a8284b5 100644 --- a/src/ChangeLog.11 +++ b/src/ChangeLog.11 @@ -3994,7 +3994,8 @@ 2010-09-24 Juanma Barranquero - Remove W32 API function pointer unused since 2005-02-15 (revno 2005-02-15T23:19:26Z!jasonr@gnu.org). + Remove Windows API function pointer unused since 2005-02-15 (revno + 2005-02-15T23:19:26Z!jasonr@gnu.org). * w32fns.c (clipboard_sequence_fn): Don't declare. (globals_of_w32fns): Don't initialize it. diff --git a/src/ChangeLog.6 b/src/ChangeLog.6 index 3aa1a23818e..64f8b3a8314 100644 --- a/src/ChangeLog.6 +++ b/src/ChangeLog.6 @@ -1269,7 +1269,7 @@ "light", "extralight", and "thin" fonts. (x_to_win32_charset, win32_to_x_charset): New functions. (win32_to_x_font): Use new height units. Use win32_to_x_charset. - (x_to_win32_font): Use x_to_win32_charset. Support Win32 font names + (x_to_win32_font): Use x_to_win32_charset. Support w32 font names in addition to X font names. (win32_load_font, Fx_list_fonts, Fx_display_color_cells) @@ -3625,11 +3625,11 @@ * xdisp.c [HAVE_NTGUI] (set_menu_framebar): Declare external. [HAVE_NTGUI] (frame_title_buf, frame_title_ptr): Include variables - for Win32 window system. + for w32 window system. [HAVE_NTGUI] (store_frame_title, x_consider_frame_title): Include - procedures for Win32 window system. - [HAVE_NTGUI] (x_consider_frame_title): Test for Win32 frame. - [HAVE_NTGUI] (display_text_line): Test for Win32 frame on face change. + procedures for w32 window system. + [HAVE_NTGUI] (x_consider_frame_title): Test for w32 frame. + [HAVE_NTGUI] (display_text_line): Test for w32 frame on face change. [HAVE_NTGUI] (display_menu_bar): Perform no-op for NT window system. * window.c [HAVE_NTGUI] (Fset_window_configuration): Set menu @@ -3659,7 +3659,7 @@ (make_lispy_event): Use FUNCTION_KEY_OFFSET to modify event codes before applying modifiers. - * frame.c [HAVE_NTGUI]: Test for a Win32 frame in procedures + * frame.c [HAVE_NTGUI]: Test for a w32 frame in procedures that test for an X frame. * frame.h (output_method): New method: output_win32. @@ -3673,13 +3673,13 @@ * emacs.c [HAVE_NTGUI]: Declare Vwindow_system. [HAVE_NTGUI] (main): Enable inhibit_window_system. Initialize environment from registry. - Declare syms of Win32 windowing modules. + Declare syms of w32 windowing modules. * dispnew.c [HAVE_NTGUI]: Include w32term.h. Include dispextern.h before cm.h since dispextern.h includes windows.h. [HAVE_NTGUI] (make_frame_glyphs, free_frame_glyphs, scroll_frame_lines) - (update_frame, update_line): Test for WIN32 frame. - [HAVE_NTGUI] (init_display): Initialize WIN32 window system. + (update_frame, update_line): Test for w32 frame. + [HAVE_NTGUI] (init_display): Initialize w32 window system. * dispextern.h [HAVE_NTGUI]: Include win32.h. [HAVE_NTGUI] (struct frame_glyphs): Include pixel fields. diff --git a/src/ChangeLog.7 b/src/ChangeLog.7 index 0952826e8c6..ce240ab2928 100644 --- a/src/ChangeLog.7 +++ b/src/ChangeLog.7 @@ -2070,7 +2070,7 @@ (sys_select): Ignore children dead children with pending input. Delay sending SIGCHLD until all output has been read. (sys_kill): Sleep to allow focus change events to propagate. - Use TerminateProcess on Win95. + Use TerminateProcess on Windows 95. (int_from_hex, enum_locale_fn, Fw32_get_valid_locale_ids): New functions. (Vw32_valid_locale_ids): New variable. @@ -5719,13 +5719,13 @@ Loop over handles round robin to ensure fairness. (sys_kill): Send ctrl-break and ctrl-c keystrokes to subprocesses on SIGINT if not sharing consoles, otherwise generate ctrl-break event. - On other termination signals, send WM_QUIT message to Win95 apps + On other termination signals, send WM_QUIT message to Windows 95 apps and WM_CLOSE to NT apps. (syms_of_ntproc): Intern new symbols. defsubr new functions. DEFVAR new variables. - * w32term.c (SIF_*): Win95 macros defined for NT. - (struct tagSCROLLINFO): Win95 struct defined for NT. + * w32term.c (SIF_*): Windows 95 macros defined for NT. + (struct tagSCROLLINFO): Windows 95 struct defined for NT. (vertical_scroll_bar_min_handle, vertical_scroll_bar_top_border) (vertical_scroll_bar_bottom_border, last_scroll_bar_drag_pos) (Vw32_gab_focus_on_raise, Vw32_capslock_is_shiftlock): diff --git a/src/ChangeLog.8 b/src/ChangeLog.8 index d3ce1eb2a45..e68966b16a2 100644 --- a/src/ChangeLog.8 +++ b/src/ChangeLog.8 @@ -13203,7 +13203,7 @@ * w32.c (stat): GetFileInformationByHandle can legitimately fail, so don't rely on it succeeding. - * w32fns.c (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 + * w32fns.c (x_to_w32_font): Specify DEFAULT_CHARSET in the Windows LOGFONT struct if x font doesn't specify the charset. (x_to_w32_charset): Change >= to == when testing results of stricmp. diff --git a/src/dbusbind.c b/src/dbusbind.c index 93388d4b24a..c1b1310454c 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c @@ -986,7 +986,7 @@ static int xd_find_watch_fd (DBusWatch *watch) { #if HAVE_DBUS_WATCH_GET_UNIX_FD - /* TODO: Reverse these on Win32, which prefers the opposite. */ + /* TODO: Reverse these on w32, which prefers the opposite. */ int fd = dbus_watch_get_unix_fd (watch); if (fd == -1) fd = dbus_watch_get_socket (watch); diff --git a/src/makefile.w32-in b/src/makefile.w32-in index a2d1c36af64..ada19ccdca3 100644 --- a/src/makefile.w32-in +++ b/src/makefile.w32-in @@ -1,4 +1,4 @@ -# -*- Makefile -*- for GNU Emacs on the Microsoft W32 API. +# -*- Makefile -*- for GNU Emacs on the Microsoft Windows API. # Copyright (C) 2000-2012 Free Software Foundation, Inc. # This file is part of GNU Emacs. diff --git a/src/regex.c b/src/regex.c index 4bf119402ac..43ee2c45212 100644 --- a/src/regex.c +++ b/src/regex.c @@ -1739,20 +1739,6 @@ static int analyse_first (re_char *p, re_char *pend, be too small, many things would have to change. */ # define MAX_BUF_SIZE (1L << 15) -#if 0 /* This is when we thought it could be 2^16 bytes. */ -/* Any other compiler which, like MSC, has allocation limit below 2^16 - bytes will have to use approach similar to what was done below for - MSC and drop MAX_BUF_SIZE a bit. Otherwise you may end up - reallocating to 0 bytes. Such thing is not going to work too well. - You have been warned!! */ -#if defined _MSC_VER && !defined WIN32 -/* Microsoft C 16-bit versions limit malloc to approx 65512 bytes. */ -# define MAX_BUF_SIZE 65500L -#else -# define MAX_BUF_SIZE (1L << 16) -#endif -#endif /* 0 */ - /* Extend the buffer by twice its current size via realloc and reset the pointers that pointed into the old block to point to the correct places in the new one. If extending the buffer results in it diff --git a/src/sound.c b/src/sound.c index 151bc1a08c1..403f08240ce 100644 --- a/src/sound.c +++ b/src/sound.c @@ -31,7 +31,7 @@ along with GNU Emacs. If not, see . */ cause an error to be generated. The Windows implementation of play-sound is implemented via the - Win32 API functions mciSendString, waveOutGetVolume, and + Windows API functions mciSendString, waveOutGetVolume, and waveOutSetVolume which are exported by Winmm.dll. */ diff --git a/src/w32.c b/src/w32.c index 55b076e80f0..cd1d927e6fc 100644 --- a/src/w32.c +++ b/src/w32.c @@ -1,4 +1,4 @@ -/* Utility and Unix shadow routines for GNU Emacs on the Microsoft W32 API. +/* Utility and Unix shadow routines for GNU Emacs on the Microsoft Windows API. Copyright (C) 1994-1995, 2000-2012 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -2011,7 +2011,7 @@ fdutimens (int fd, char const *file, struct timespec const timespec[2]) /* ------------------------------------------------------------------------- */ -/* IO support and wrapper functions for W32 API. */ +/* IO support and wrapper functions for the Windows API. */ /* ------------------------------------------------------------------------- */ /* Place a wrapper around the MSVC version of ctime. It returns NULL @@ -2929,7 +2929,7 @@ sys_rename (const char * oldname, const char * newname) /* volume_info is set indirectly by map_w32_filename. */ oldname_dev = volume_info.serialnum; - if (os_subtype == OS_WIN95) + if (os_subtype == OS_WINDOWS_95) { char * o; char * p; diff --git a/src/w32console.c b/src/w32console.c index c3a1c5d86b3..76585851e7f 100644 --- a/src/w32console.c +++ b/src/w32console.c @@ -1,4 +1,4 @@ -/* Terminal hooks for GNU Emacs on the Microsoft W32 API. +/* Terminal hooks for GNU Emacs on the Microsoft Windows API. Copyright (C) 1992, 1999, 2001-2012 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -515,7 +515,7 @@ w32con_set_terminal_modes (struct terminal *t) { CONSOLE_CURSOR_INFO cci; - /* make cursor big and visible (100 on Win95 makes it disappear) */ + /* make cursor big and visible (100 on Windows 95 makes it disappear) */ cci.dwSize = 99; cci.bVisible = TRUE; (void) SetConsoleCursorInfo (cur_screen, &cci); diff --git a/src/w32fns.c b/src/w32fns.c index 1b1c5001344..97b7001a3fa 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -1,4 +1,4 @@ -/* Graphical user interface functions for the Microsoft W32 API. +/* Graphical user interface functions for the Microsoft Windows API. Copyright (C) 1989, 1992-2012 Free Software Foundation, Inc. @@ -6575,7 +6575,7 @@ If the underlying system call fails, value is nil. */) value = Qnil; /* Determining the required information on Windows turns out, sadly, - to be more involved than one would hope. The original Win32 api + to be more involved than one would hope. The original Windows API call for this will return bogus information on some systems, but we must dynamically probe for the replacement api, since that was added rather late on. */ diff --git a/src/w32font.c b/src/w32font.c index 81378825412..fd24a90d60b 100644 --- a/src/w32font.c +++ b/src/w32font.c @@ -1,4 +1,4 @@ -/* Font backend for the Microsoft W32 API. +/* Font backend for the Microsoft Windows API. Copyright (C) 2007-2012 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -292,7 +292,7 @@ intern_font_name (char * string) Lisp_Object str = DECODE_SYSTEM (build_string (string)); int len = SCHARS (str); Lisp_Object obarray = check_obarray (Vobarray); - Lisp_Object tem = oblookup (obarray, SDATA (str), len, len); + Lisp_Object tem = oblookup (obarray, SDATA (str), len, len); /* This code is similar to intern function from lread.c. */ return SYMBOLP (tem) ? tem : Fintern (str, obarray); } @@ -1394,7 +1394,7 @@ font_matches_spec (DWORD type, NEWTEXTMETRICEX *font, currently appear in fontset.el, so it isn't worth creating a mapping table of codepages/scripts to languages or opening the font to see if there are any language tags - in it that the W32 API does not expose. Fontset + in it that the Windows API does not expose. Fontset spec should have a fallback, as some backends do not recognize language at all. */ return 0; diff --git a/src/w32font.h b/src/w32font.h index 40edafa146d..b08d48a3d36 100644 --- a/src/w32font.h +++ b/src/w32font.h @@ -1,4 +1,4 @@ -/* Shared GDI and Uniscribe Font backend declarations for the W32 API. +/* Shared GDI and Uniscribe Font backend declarations for the Windows API. Copyright (C) 2007-2012 Free Software Foundation, Inc. This file is part of GNU Emacs. diff --git a/src/w32gui.h b/src/w32gui.h index 1e800e3cf3a..1ea185bfaa1 100644 --- a/src/w32gui.h +++ b/src/w32gui.h @@ -1,4 +1,4 @@ -/* Definitions and headers for communication on the Microsoft W32 API. +/* Definitions and headers for communication on the Microsoft Windows API. Copyright (C) 1995, 2001-2012 Free Software Foundation, Inc. This file is part of GNU Emacs. diff --git a/src/w32heap.c b/src/w32heap.c index cc5e5cd2bf5..e34021b1099 100644 --- a/src/w32heap.c +++ b/src/w32heap.c @@ -1,4 +1,4 @@ -/* Heap management routines for GNU Emacs on the Microsoft W32 API. +/* Heap management routines for GNU Emacs on the Microsoft Windows API. Copyright (C) 1994, 2001-2012 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -66,7 +66,7 @@ cache_system_info (void) w32_minor_version = version.info.minor; if (version.info.platform & 0x8000) - os_subtype = OS_WIN95; + os_subtype = OS_WINDOWS_95; else os_subtype = OS_NT; @@ -79,7 +79,7 @@ cache_system_info (void) GetVersionEx (&osinfo_cache); w32_build_number = osinfo_cache.dwBuildNumber; - if (os_subtype == OS_WIN95) + if (os_subtype == OS_WINDOWS_95) w32_build_number &= 0xffff; } diff --git a/src/w32heap.h b/src/w32heap.h index b2d51655098..7a20ba2a8b6 100644 --- a/src/w32heap.h +++ b/src/w32heap.h @@ -51,7 +51,7 @@ extern int w32_minor_version; extern int w32_build_number; enum { - OS_WIN95 = 1, + OS_WINDOWS_95 = 1, OS_NT }; @@ -92,4 +92,3 @@ IMAGE_SECTION_HEADER * find_section (char * name, IMAGE_NT_HEADERS * nt_header); IMAGE_SECTION_HEADER * rva_to_section (DWORD rva, IMAGE_NT_HEADERS * nt_header); #endif /* NTHEAP_H_ */ - diff --git a/src/w32inevt.c b/src/w32inevt.c index 8d041194ca1..6d869727d2f 100644 --- a/src/w32inevt.c +++ b/src/w32inevt.c @@ -1,4 +1,4 @@ -/* Input event support for Emacs on the Microsoft W32 API. +/* Input event support for Emacs on the Microsoft Windows API. Copyright (C) 1992-1993, 1995, 2001-2012 Free Software Foundation, Inc. This file is part of GNU Emacs. diff --git a/src/w32inevt.h b/src/w32inevt.h index 5386f2aa96c..c874e58ef39 100644 --- a/src/w32inevt.h +++ b/src/w32inevt.h @@ -1,4 +1,4 @@ -/* Input routines for GNU Emacs on the Microsoft W32 API. +/* Input routines for GNU Emacs on the Microsoft Windows API. Copyright (C) 1995, 2001-2012 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -30,4 +30,3 @@ extern void w32_console_mouse_position (FRAME_PTR *f, int insist, unsigned long *time); #endif /* EMACS_W32INEVT_H */ - diff --git a/src/w32menu.c b/src/w32menu.c index 871baedd0d3..09484d74b79 100644 --- a/src/w32menu.c +++ b/src/w32menu.c @@ -1,4 +1,4 @@ -/* Menu support for GNU Emacs on the Microsoft W32 API. +/* Menu support for GNU Emacs on the Microsoft Windows API. Copyright (C) 1986, 1988, 1993-1994, 1996, 1998-1999, 2001-2012 Free Software Foundation, Inc. diff --git a/src/w32proc.c b/src/w32proc.c index afc1b21fdde..15b0ea25bc7 100644 --- a/src/w32proc.c +++ b/src/w32proc.c @@ -1,4 +1,4 @@ -/* Process support for GNU Emacs on the Microsoft W32 API. +/* Process support for GNU Emacs on the Microsoft Windows API. Copyright (C) 1992, 1995, 1999-2012 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -799,7 +799,7 @@ sys_spawnve (int mode, char *cmdname, char **argv, char **envp) unixtodos_filename (cmdname); argv[0] = cmdname; - /* Determine whether program is a 16-bit DOS executable, or a w32 + /* Determine whether program is a 16-bit DOS executable, or a 32-bit Windows executable that is implicitly linked to the Cygnus dll (implying it was compiled with the Cygnus GNU toolchain and hence relies on cygwin.dll to parse the command line - we use this to decide how to @@ -1386,7 +1386,7 @@ find_child_console (HWND hwnd, LPARAM arg) GetClassName (hwnd, window_class, sizeof (window_class)); if (strcmp (window_class, - (os_subtype == OS_WIN95) + (os_subtype == OS_WINDOWS_95) ? "tty" : "ConsoleWindowClass") == 0) { @@ -1517,7 +1517,7 @@ sys_kill (int pid, int sig) if (NILP (Vw32_start_process_share_console) && cp && cp->hwnd) { #if 1 - if (os_subtype == OS_WIN95) + if (os_subtype == OS_WINDOWS_95) { /* Another possibility is to try terminating the VDM out-right by @@ -1536,7 +1536,7 @@ sys_kill (int pid, int sig) */ #if 0 - /* On Win95, posting WM_QUIT causes the 16-bit subsystem + /* On Windows 95, posting WM_QUIT causes the 16-bit subsystem to hang when cmdproxy is used in conjunction with command.com for an interactive shell. Posting WM_CLOSE pops up a dialog that, when Yes is selected, @@ -1810,7 +1810,7 @@ If successful, the return value is t, otherwise nil. */) CHECK_NUMBER (process); /* Allow pid to be an internally generated one, or one obtained - externally. This is necessary because real pids on Win95 are + externally. This is necessary because real pids on Windows 95 are negative. */ pid = XINT (process); diff --git a/src/w32select.c b/src/w32select.c index 1d4a6f41bdd..59ff4405368 100644 --- a/src/w32select.c +++ b/src/w32select.c @@ -1,4 +1,4 @@ -/* Selection processing for Emacs on the Microsoft W32 API. +/* Selection processing for Emacs on the Microsoft Windows API. Copyright (C) 1993-1994, 2001-2012 Free Software Foundation, Inc. diff --git a/src/w32term.c b/src/w32term.c index 6f0065de9eb..f02d101cea3 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -1,4 +1,4 @@ -/* Implementation of GUI terminal on the Microsoft W32 API. +/* Implementation of GUI terminal on the Microsoft Windows API. Copyright (C) 1989, 1993-2012 Free Software Foundation, Inc. diff --git a/src/w32term.h b/src/w32term.h index 4fdf560dabc..b49104dde8b 100644 --- a/src/w32term.h +++ b/src/w32term.h @@ -1,4 +1,4 @@ -/* Definitions and headers for communication on the Microsoft W32 API. +/* Definitions and headers for communication on the Microsoft Windows API. Copyright (C) 1995, 2001-2012 Free Software Foundation, Inc. This file is part of GNU Emacs. diff --git a/src/w32xfns.c b/src/w32xfns.c index 0b0fc26fb6a..745a5cfe3e7 100644 --- a/src/w32xfns.c +++ b/src/w32xfns.c @@ -1,4 +1,4 @@ -/* Functions taken directly from X sources for use with the Microsoft W32 API. +/* Functions taken directly from X sources for use with the Microsoft Windows API. Copyright (C) 1989, 1992-1995, 1999, 2001-2012 Free Software Foundation, Inc. This file is part of GNU Emacs. From 1cd646250d11af2eeafc1b696c3e6c7d275296f2 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 29 Jul 2012 02:57:40 -0700 Subject: [PATCH 41/89] inaccessable -> inaccessible spelling fix * semantic/wisent/comp.el (wisent-inaccessible-symbols): Rename from wisent-inaccessable-symbols, fixing a misspelling. Caller changed. Fixes: debbugs:10052 --- lisp/cedet/ChangeLog | 7 +++++++ lisp/cedet/semantic/wisent/comp.el | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lisp/cedet/ChangeLog b/lisp/cedet/ChangeLog index d98ef42438c..b946e756ff8 100644 --- a/lisp/cedet/ChangeLog +++ b/lisp/cedet/ChangeLog @@ -1,3 +1,10 @@ +2012-07-29 Paul Eggert + + inaccessable -> inaccessible spelling fix (Bug#10052) + * semantic/wisent/comp.el (wisent-inaccessible-symbols): + Rename from wisent-inaccessable-symbols, fixing a misspelling. + Caller changed. + 2012-07-09 Andreas Schwab * ede/project-am.el: Fix typo. diff --git a/lisp/cedet/semantic/wisent/comp.el b/lisp/cedet/semantic/wisent/comp.el index b0daabd1063..30dbafaa6cc 100644 --- a/lisp/cedet/semantic/wisent/comp.el +++ b/lisp/cedet/semantic/wisent/comp.el @@ -550,7 +550,7 @@ S must be a vector of integers." N Ns))) (setq N Np))) -(defun wisent-inaccessable-symbols () +(defun wisent-inaccessible-symbols () "Find out which productions are reachable and which symbols are used." ;; Starting with an empty set of productions and a set of symbols ;; which only has the start symbol in it, iterate over all @@ -709,7 +709,7 @@ S must be a vector of integers." nuseless-productions 0) (wisent-useless-nonterminals) - (wisent-inaccessable-symbols) + (wisent-inaccessible-symbols) (when (> (+ nuseless-nonterminals nuseless-productions) 0) (wisent-total-useless) From 93131e119fa0f1fe44ccbccd0b8edcf8707a892d Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sun, 29 Jul 2012 06:19:06 -0400 Subject: [PATCH 42/89] Auto-commit of generated files. --- autogen/Makefile.in | 9 +++-- autogen/aclocal.m4 | 1 + autogen/config.in | 6 +-- autogen/configure | 95 ++++++++++++++++++++++++++++++--------------- 4 files changed, 73 insertions(+), 38 deletions(-) diff --git a/autogen/Makefile.in b/autogen/Makefile.in index 4808d7aa179..8c569049754 100644 --- a/autogen/Makefile.in +++ b/autogen/Makefile.in @@ -36,7 +36,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=errno --avoid=fcntl --avoid=fcntl-h --avoid=fstat --avoid=msvc-inval --avoid=msvc-nothrow --avoid=raise --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-strcase careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdarg stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timespec-add timespec-sub utimens warnings +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=errno --avoid=fcntl --avoid=fcntl-h --avoid=fstat --avoid=msvc-inval --avoid=msvc-nothrow --avoid=raise --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-strcase careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdalign stdarg stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timespec-add timespec-sub utimens warnings VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ @@ -65,9 +65,10 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ $(top_srcdir)/m4/alloca.m4 $(top_srcdir)/m4/c-strtod.m4 \ $(top_srcdir)/m4/clock_time.m4 $(top_srcdir)/m4/dup2.m4 \ - $(top_srcdir)/m4/extensions.m4 $(top_srcdir)/m4/filemode.m4 \ - $(top_srcdir)/m4/getloadavg.m4 $(top_srcdir)/m4/getopt.m4 \ - $(top_srcdir)/m4/gettime.m4 $(top_srcdir)/m4/gettimeofday.m4 \ + $(top_srcdir)/m4/environ.m4 $(top_srcdir)/m4/extensions.m4 \ + $(top_srcdir)/m4/filemode.m4 $(top_srcdir)/m4/getloadavg.m4 \ + $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gettime.m4 \ + $(top_srcdir)/m4/gettimeofday.m4 \ $(top_srcdir)/m4/gnulib-common.m4 \ $(top_srcdir)/m4/gnulib-comp.m4 \ $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/inttypes.m4 \ diff --git a/autogen/aclocal.m4 b/autogen/aclocal.m4 index cc09901d05a..4d397b99b11 100644 --- a/autogen/aclocal.m4 +++ b/autogen/aclocal.m4 @@ -989,6 +989,7 @@ m4_include([m4/alloca.m4]) m4_include([m4/c-strtod.m4]) m4_include([m4/clock_time.m4]) m4_include([m4/dup2.m4]) +m4_include([m4/environ.m4]) m4_include([m4/extensions.m4]) m4_include([m4/filemode.m4]) m4_include([m4/getloadavg.m4]) diff --git a/autogen/config.in b/autogen/config.in index 5f5052c5205..f20c556c940 100644 --- a/autogen/config.in +++ b/autogen/config.in @@ -220,9 +220,6 @@ along with GNU Emacs. If not, see . */ /* Define to 1 if ALSA is available. */ #undef HAVE_ALSA -/* Define to 1 if GCC-style __attribute__ ((__aligned__ (expr))) works. */ -#undef HAVE_ATTRIBUTE_ALIGNED - /* Define to 1 if strtold conforms to C99. */ #undef HAVE_C99_STRTOLD @@ -335,6 +332,9 @@ along with GNU Emacs. If not, see . */ /* Define to 1 if you have the `endpwent' function. */ #undef HAVE_ENDPWENT +/* Define if you have the declaration of environ. */ +#undef HAVE_ENVIRON_DECL + /* Define to 1 if you have the `euidaccess' function. */ #undef HAVE_EUIDACCESS diff --git a/autogen/configure b/autogen/configure index 784b10593aa..13ffa90b2df 100755 --- a/autogen/configure +++ b/autogen/configure @@ -6948,6 +6948,7 @@ esac # Code from module dtoastr: # Code from module dtotimespec: # Code from module dup2: + # Code from module environ: # Code from module extensions: # Code from module filemode: @@ -8947,37 +8948,6 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __attribute__ ((__aligned__ (expr)))" >&5 -$as_echo_n "checking for __attribute__ ((__aligned__ (expr)))... " >&6; } -if test "${emacs_cv_attribute_aligned+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -char __attribute__ ((__aligned__ (1 << 3))) c; -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - emacs_cv_attribute_aligned=yes -else - emacs_cv_attribute_aligned=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_attribute_aligned" >&5 -$as_echo "$emacs_cv_attribute_aligned" >&6; } -if test $emacs_cv_attribute_aligned = yes; then - -$as_echo "#define HAVE_ATTRIBUTE_ALIGNED 1" >>confdefs.h - -fi - DEPFLAGS= MKDEPDIR=":" @@ -16268,6 +16238,57 @@ $as_echo "#define HAVE_C99_STRTOLD 1" >>confdefs.h UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0; + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if environ is properly declared" >&5 +$as_echo_n "checking if environ is properly declared... " >&6; } + if test "${gt_cv_var_environ_declaration+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if HAVE_UNISTD_H + #include + #endif + /* mingw, BeOS, Haiku declare environ in , not in . */ + #include + + extern struct { int foo; } environ; +int +main () +{ +environ.foo = 1; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gt_cv_var_environ_declaration=no +else + gt_cv_var_environ_declaration=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_var_environ_declaration" >&5 +$as_echo "$gt_cv_var_environ_declaration" >&6; } + if test $gt_cv_var_environ_declaration = yes; then + +$as_echo "#define HAVE_ENVIRON_DECL 1" >>confdefs.h + + fi + + + if test $gt_cv_var_environ_declaration != yes; then + HAVE_DECL_ENVIRON=0 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for st_dm_mode in struct stat" >&5 $as_echo_n "checking for st_dm_mode in struct stat... " >&6; } if test "${ac_cv_struct_st_dm_mode+set}" = set; then : @@ -19897,6 +19918,18 @@ fi + GNULIB_ENVIRON=1 + + + + + + + + + + + # Persuade glibc to declare getloadavg(). From e2688e4ac71bd3c1f7d22f28175c4ca81eb87e43 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Sun, 29 Jul 2012 15:20:43 +0400 Subject: [PATCH 43/89] Generalize marker debugging code under MARKER_DEBUG and use eassert. * insdel.c (CHECK_MARKERS, check_markers_debug_flag): Remove. (gap_left, gap_right, adjust_markers_for_delete, insert_1_both) (insert_from_string_1, insert_from_gap, insert_from_buffer_1) (replace_range, replace_range_2, del_range_2): Change to eassert. * marker.c (byte_char_debug_check): Adjust style. --- src/ChangeLog | 9 ++++++ src/insdel.c | 82 +++++++++++++++++++++------------------------------ src/marker.c | 2 +- 3 files changed, 44 insertions(+), 49 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 21ba05adf6d..4b811b79a9b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2012-07-29 Dmitry Antipov + + Generalize marker debugging code under MARKER_DEBUG and use eassert. + * insdel.c (CHECK_MARKERS, check_markers_debug_flag): Remove. + (gap_left, gap_right, adjust_markers_for_delete, insert_1_both) + (insert_from_string_1, insert_from_gap, insert_from_buffer_1) + (replace_range, replace_range_2, del_range_2): Change to eassert. + * marker.c (byte_char_debug_check): Adjust style. + 2012-07-29 Paul Eggert Don't use the abbreviation "win" to refer to Windows (Bug#10421). diff --git a/src/insdel.c b/src/insdel.c index 2074916cfde..9646507bc4b 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -59,14 +59,10 @@ static Lisp_Object combine_after_change_buffer; Lisp_Object Qinhibit_modification_hooks; static void signal_before_change (ptrdiff_t, ptrdiff_t, ptrdiff_t *); - -#define CHECK_MARKERS() \ - do \ - { \ - if (check_markers_debug_flag) \ - check_markers (); \ - } \ - while (0) + +/* Also used in marker.c to enable expensive marker checks. */ + +#ifdef MARKER_DEBUG static void check_markers (void) @@ -86,7 +82,13 @@ check_markers (void) abort (); } } - + +#else /* not MARKER_DEBUG */ + +#define check_markers() do { } while (0) + +#endif /* MARKER_DEBUG */ + /* Move gap to position CHARPOS. Note that this can quit! */ @@ -158,8 +160,7 @@ gap_left (ptrdiff_t charpos, ptrdiff_t bytepos, int newgap) was specified or may be where a quit was detected. */ GPT_BYTE = bytepos; GPT = charpos; - if (bytepos < charpos) - abort (); + eassert (charpos <= bytepos); if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */ QUIT; } @@ -209,8 +210,7 @@ gap_right (ptrdiff_t charpos, ptrdiff_t bytepos) GPT = charpos; GPT_BYTE = bytepos; - if (bytepos < charpos) - abort (); + eassert (charpos <= bytepos); if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */ QUIT; } @@ -233,9 +233,7 @@ adjust_markers_for_delete (ptrdiff_t from, ptrdiff_t from_byte, for (m = BUF_MARKERS (current_buffer); m; m = m->next) { charpos = m->charpos; - - if (charpos > Z) - abort (); + eassert (charpos <= Z); /* If the marker is after the deletion, relocate by number of chars / bytes deleted. */ @@ -375,7 +373,7 @@ adjust_markers_for_replace (ptrdiff_t from, ptrdiff_t from_byte, } } - CHECK_MARKERS (); + check_markers (); } @@ -835,8 +833,7 @@ insert_1_both (const char *string, Z_BYTE += nbytes; if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */ - if (GPT_BYTE < GPT) - abort (); + eassert (GPT <= GPT_BYTE); /* The insert may have been in the unchanged region, so check again. */ if (Z - GPT < END_UNCHANGED) @@ -856,7 +853,7 @@ insert_1_both (const char *string, adjust_point (nchars, nbytes); - CHECK_MARKERS (); + check_markers (); } /* Insert the part of the text of STRING, a Lisp object assumed to be @@ -966,8 +963,7 @@ insert_from_string_1 (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte, Z_BYTE += outgoing_nbytes; if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */ - if (GPT_BYTE < GPT) - abort (); + eassert (GPT <= GPT_BYTE); /* The insert may have been in the unchanged region, so check again. */ if (Z - GPT < END_UNCHANGED) @@ -991,7 +987,7 @@ insert_from_string_1 (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte, adjust_point (nchars, outgoing_nbytes); - CHECK_MARKERS (); + check_markers (); } /* Insert a sequence of NCHARS chars which occupy NBYTES bytes @@ -1015,8 +1011,7 @@ insert_from_gap (ptrdiff_t nchars, ptrdiff_t nbytes) Z_BYTE += nbytes; if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */ - if (GPT_BYTE < GPT) - abort (); + eassert (GPT <= GPT_BYTE); adjust_overlays_for_insert (GPT - nchars, nchars); adjust_markers_for_insert (GPT - nchars, GPT_BYTE - nbytes, @@ -1032,7 +1027,7 @@ insert_from_gap (ptrdiff_t nchars, ptrdiff_t nbytes) if (GPT - nchars < PT) adjust_point (nchars, nbytes); - CHECK_MARKERS (); + check_markers (); } /* Insert text from BUF, NCHARS characters starting at CHARPOS, into the @@ -1151,8 +1146,7 @@ insert_from_buffer_1 (struct buffer *buf, Z_BYTE += outgoing_nbytes; if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */ - if (GPT_BYTE < GPT) - abort (); + eassert (GPT <= GPT_BYTE); /* The insert may have been in the unchanged region, so check again. */ if (Z - GPT < END_UNCHANGED) @@ -1243,7 +1237,7 @@ adjust_after_replace (ptrdiff_t from, ptrdiff_t from_byte, if (Z - GPT < END_UNCHANGED) END_UNCHANGED = Z - GPT; - CHECK_MARKERS (); + check_markers (); if (len == 0) evaporate_overlays (from); @@ -1296,7 +1290,7 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new, ptrdiff_t outgoing_insbytes = insbytes; Lisp_Object deletion; - CHECK_MARKERS (); + check_markers (); GCPRO1 (new); deletion = Qnil; @@ -1357,8 +1351,7 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new, GPT_BYTE = from_byte; if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */ - if (GPT_BYTE < GPT) - abort (); + eassert (GPT <= GPT_BYTE); if (GPT - BEG < BEG_UNCHANGED) BEG_UNCHANGED = GPT - BEG; @@ -1404,8 +1397,7 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new, Z_BYTE += outgoing_insbytes; if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */ - if (GPT_BYTE < GPT) - abort (); + eassert (GPT <= GPT_BYTE); /* Adjust the overlay center as needed. This must be done after adjusting the markers that bound the overlays. */ @@ -1435,7 +1427,7 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new, if (outgoing_insbytes == 0) evaporate_overlays (from); - CHECK_MARKERS (); + check_markers (); MODIFF++; CHARS_MODIFF = MODIFF; @@ -1465,7 +1457,7 @@ replace_range_2 (ptrdiff_t from, ptrdiff_t from_byte, { ptrdiff_t nbytes_del, nchars_del; - CHECK_MARKERS (); + check_markers (); nchars_del = to - from; nbytes_del = to_byte - from_byte; @@ -1488,8 +1480,7 @@ replace_range_2 (ptrdiff_t from, ptrdiff_t from_byte, GPT_BYTE = from_byte; if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */ - if (GPT_BYTE < GPT) - abort (); + eassert (GPT <= GPT_BYTE); if (GPT - BEG < BEG_UNCHANGED) BEG_UNCHANGED = GPT - BEG; @@ -1522,8 +1513,7 @@ replace_range_2 (ptrdiff_t from, ptrdiff_t from_byte, Z_BYTE += insbytes; if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */ - if (GPT_BYTE < GPT) - abort (); + eassert (GPT <= GPT_BYTE); /* Adjust the overlay center as needed. This must be done after adjusting the markers that bound the overlays. */ @@ -1554,7 +1544,7 @@ replace_range_2 (ptrdiff_t from, ptrdiff_t from_byte, if (insbytes == 0) evaporate_overlays (from); - CHECK_MARKERS (); + check_markers (); MODIFF++; CHARS_MODIFF = MODIFF; @@ -1705,7 +1695,7 @@ del_range_2 (ptrdiff_t from, ptrdiff_t from_byte, register ptrdiff_t nbytes_del, nchars_del; Lisp_Object deletion; - CHECK_MARKERS (); + check_markers (); nchars_del = to - from; nbytes_del = to_byte - from_byte; @@ -1761,15 +1751,14 @@ del_range_2 (ptrdiff_t from, ptrdiff_t from_byte, needs to access the previous gap contents. */ *(GPT_ADDR) = 0; - if (GPT_BYTE < GPT) - abort (); + eassert (GPT <= GPT_BYTE); if (GPT - BEG < BEG_UNCHANGED) BEG_UNCHANGED = GPT - BEG; if (Z - GPT < END_UNCHANGED) END_UNCHANGED = Z - GPT; - CHECK_MARKERS (); + check_markers (); evaporate_overlays (from); @@ -2201,9 +2190,6 @@ syms_of_insdel (void) combine_after_change_list = Qnil; combine_after_change_buffer = Qnil; - DEFVAR_BOOL ("check-markers-debug-flag", check_markers_debug_flag, - doc: /* Non-nil means enable debugging checks for invalid marker positions. */); - check_markers_debug_flag = 0; DEFVAR_LISP ("combine-after-change-calls", Vcombine_after_change_calls, doc: /* Used internally by the `combine-after-change-calls' macro. */); Vcombine_after_change_calls = Qnil; diff --git a/src/marker.c b/src/marker.c index 0a93f4c180f..4ea06c7cd57 100644 --- a/src/marker.c +++ b/src/marker.c @@ -64,7 +64,7 @@ byte_char_debug_check (struct buffer *b, ptrdiff_t charpos, ptrdiff_t bytepos) #else /* not MARKER_DEBUG */ -#define byte_char_debug_check(b,charpos,bytepos) do { } while (0) +#define byte_char_debug_check(b, charpos, bytepos) do { } while (0) #endif /* MARKER_DEBUG */ From dbcf001cd7877a7f03a9307afbb82190b24bc356 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Sun, 29 Jul 2012 17:51:45 +0400 Subject: [PATCH 44/89] Cleanup statistics calculation in Fgarbage_collect. * alloc.c (Fgarbage_collect): Rename t1 to meaningful start. Fix zombies percentage calculation. Simplify elapsed time calculation. --- src/ChangeLog | 6 ++++++ src/alloc.c | 23 +++++++++-------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 4b811b79a9b..45e745de9e9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2012-07-29 Dmitry Antipov + + Cleanup statistics calculation in Fgarbage_collect. + * alloc.c (Fgarbage_collect): Rename t1 to meaningful start. Fix + zombies percentage calculation. Simplify elapsed time calculation. + 2012-07-29 Dmitry Antipov Generalize marker debugging code under MARKER_DEBUG and use eassert. diff --git a/src/alloc.c b/src/alloc.c index e5f412bb4c3..625acad991c 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -5437,7 +5437,7 @@ See Info node `(elisp)Garbage Collection'. */) int message_p; Lisp_Object total[11]; ptrdiff_t count = SPECPDL_INDEX (); - EMACS_TIME t1; + EMACS_TIME start; if (abort_on_gc) abort (); @@ -5454,7 +5454,7 @@ See Info node `(elisp)Garbage Collection'. */) FOR_EACH_BUFFER (nextb) compact_buffer (nextb); - t1 = current_emacs_time (); + start = current_emacs_time (); /* In case user calls debug_print during GC, don't let that cause a recursive GC. */ @@ -5706,18 +5706,16 @@ See Info node `(elisp)Garbage Collection'. */) #if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES { /* Compute average percentage of zombies. */ - double nlive = 0; - - for (i = 0; i < 7; ++i) - if (CONSP (total[i])) - nlive += XFASTINT (XCAR (total[i])); + double nlive = + total_conses + total_symbols + total_markers + total_strings + + total_vectors + total_floats + total_intervals + total_buffers; avg_live = (avg_live * ngcs + nlive) / (ngcs + 1); max_live = max (nlive, max_live); avg_zombies = (avg_zombies * ngcs + nzombies) / (ngcs + 1); max_zombies = max (nzombies, max_zombies); ++ngcs; - } + } #endif if (!NILP (Vpost_gc_hook)) @@ -5729,12 +5727,9 @@ See Info node `(elisp)Garbage Collection'. */) /* Accumulate statistics. */ if (FLOATP (Vgc_elapsed)) - { - EMACS_TIME t2 = current_emacs_time (); - EMACS_TIME t3 = sub_emacs_time (t2, t1); - Vgc_elapsed = make_float (XFLOAT_DATA (Vgc_elapsed) - + EMACS_TIME_TO_DOUBLE (t3)); - } + Vgc_elapsed = make_float + (XFLOAT_DATA (Vgc_elapsed) + EMACS_TIME_TO_DOUBLE + (sub_emacs_time (current_emacs_time (), start))); gcs_done++; From 55a6cca64fe00c54a4c880f404dcb362f555034e Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 29 Jul 2012 18:43:09 +0300 Subject: [PATCH 45/89] MS-Windows followup for 2012-07-28T23:05:32Z!eggert@cs.ucla.edu. nt/inc/stdalign.h (_Alignas, alignas): Define. src/makefile.w32-in (LISP_H): Add $(NT_INC)/stdalign.h. Fixes: debbugs:9772 --- nt/ChangeLog | 4 ++++ nt/inc/stdalign.h | 9 +++++++++ src/ChangeLog | 4 ++++ src/makefile.w32-in | 1 + 4 files changed, 18 insertions(+) diff --git a/nt/ChangeLog b/nt/ChangeLog index 4db23d045a8..033a909c752 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog @@ -1,3 +1,7 @@ +2012-07-29 Eli Zaretskii + + * inc/stdalign.h (_Alignas, alignas): Define. + 2012-07-28 Paul Eggert Use Gnulib stdalign module (Bug#9772, Bug#9960). diff --git a/nt/inc/stdalign.h b/nt/inc/stdalign.h index 2ff7a43096f..7e349dc31d0 100644 --- a/nt/inc/stdalign.h +++ b/nt/inc/stdalign.h @@ -13,4 +13,13 @@ #endif #define alignof _Alignof +#if __GNUC__ +# define _Alignas(a) __attribute__ ((__aligned__ (a))) +#elif 1300 <= _MSC_VER +# define _Alignas(a) __declspec (align (a)) +#endif +#ifdef _Alignas +# define alignas _Alignas +#endif + #endif /* _NT_STDALIGN_H_ */ diff --git a/src/ChangeLog b/src/ChangeLog index 45e745de9e9..8f9b7cc8084 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2012-07-29 Eli Zaretskii + + * makefile.w32-in (LISP_H): Add $(NT_INC)/stdalign.h. + 2012-07-29 Dmitry Antipov Cleanup statistics calculation in Fgarbage_collect. diff --git a/src/makefile.w32-in b/src/makefile.w32-in index ada19ccdca3..00b9a21065b 100644 --- a/src/makefile.w32-in +++ b/src/makefile.w32-in @@ -438,6 +438,7 @@ LANGINFO_H = $(NT_INC)/langinfo.h \ LISP_H = $(SRC)/lisp.h \ $(SRC)/globals.h \ $(GNU_LIB)/intprops.h \ + $(NT_INC)/stdalign.h \ $(INTTYPES_H) MD5_H = $(GNU_LIB)/md5.h \ $(NT_INC)/stdint.h From 8519232d51327515d031273376410441fc5d0280 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 29 Jul 2012 18:53:31 +0300 Subject: [PATCH 46/89] Fix parallel builds on Windows in lib-src. lib-src/makefile.w32-in ($(BLD)/profile.$(O)): Depend on stamp_BLD. --- lib-src/ChangeLog | 4 ++++ lib-src/makefile.w32-in | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 4f4d2b50a00..3a5c80db356 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,7 @@ +2012-07-29 Eli Zaretskii + + * makefile.w32-in ($(BLD)/profile.$(O)): Depend on stamp_BLD. + 2012-07-12 Paul Eggert * movemail.c: Add missing 'defined'. diff --git a/lib-src/makefile.w32-in b/lib-src/makefile.w32-in index ba76c6df93f..65e2f7cae25 100644 --- a/lib-src/makefile.w32-in +++ b/lib-src/makefile.w32-in @@ -467,4 +467,4 @@ $(BLD)/test-distrib.$(O) $(MOVEMAILOBJS): stamp_BLD $(BLD)/emacsclient.$(O) $(BLD)/etags.$(O) $(BLD)/regex.$(O): stamp_BLD -$(BLD)/ebrowse.$(O) $(BLD)/ctags.$(O): stamp_BLD +$(BLD)/ebrowse.$(O) $(BLD)/ctags.$(O) $(BLD)/profile.$(O): stamp_BLD From 387d4d92bca5cf7f0eb14c2b917773dde7b06041 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 29 Jul 2012 09:00:35 -0700 Subject: [PATCH 47/89] * alloc.c (Fgarbage_collect): Indent as per usual Emacs style. --- src/ChangeLog | 4 ++++ src/alloc.c | 14 ++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 8f9b7cc8084..fa1877f91c2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2012-07-29 Paul Eggert + + * alloc.c (Fgarbage_collect): Indent as per usual Emacs style. + 2012-07-29 Eli Zaretskii * makefile.w32-in (LISP_H): Add $(NT_INC)/stdalign.h. diff --git a/src/alloc.c b/src/alloc.c index 625acad991c..7680b3a2d84 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -5706,9 +5706,9 @@ See Info node `(elisp)Garbage Collection'. */) #if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES { /* Compute average percentage of zombies. */ - double nlive = - total_conses + total_symbols + total_markers + total_strings - + total_vectors + total_floats + total_intervals + total_buffers; + double nlive = + (total_conses + total_symbols + total_markers + total_strings + + total_vectors + total_floats + total_intervals + total_buffers); avg_live = (avg_live * ngcs + nlive) / (ngcs + 1); max_live = max (nlive, max_live); @@ -5727,9 +5727,11 @@ See Info node `(elisp)Garbage Collection'. */) /* Accumulate statistics. */ if (FLOATP (Vgc_elapsed)) - Vgc_elapsed = make_float - (XFLOAT_DATA (Vgc_elapsed) + EMACS_TIME_TO_DOUBLE - (sub_emacs_time (current_emacs_time (), start))); + { + EMACS_TIME since_start = sub_emacs_time (current_emacs_time (), start); + Vgc_elapsed = make_float (XFLOAT_DATA (Vgc_elapsed) + + EMACS_TIME_TO_DOUBLE (since_start)); + } gcs_done++; From 417a7a0e4da19593aaea8dbe665c031c6789f205 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 29 Jul 2012 19:22:27 +0300 Subject: [PATCH 48/89] Rename OS_WINDOWS_95 to OS_9X. src/w32heap.h (OS_9X): Renamed from OS_WINDOWS_95. src/w32heap.c (cache_system_info): src/w32.c (sys_rename): src/w32proc.c (find_child_console, sys_kill): All users changed. --- src/ChangeLog | 8 ++++++++ src/w32.c | 2 +- src/w32heap.c | 4 ++-- src/w32heap.h | 2 +- src/w32proc.c | 4 ++-- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index fa1877f91c2..aba9846f6a6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2012-07-29 Eli Zaretskii + + * w32heap.h (OS_9X): Renamed from OS_WINDOWS_95. + + * w32heap.c (cache_system_info): + * w32.c (sys_rename): + * w32proc.c (find_child_console, sys_kill): All users changed. + 2012-07-29 Paul Eggert * alloc.c (Fgarbage_collect): Indent as per usual Emacs style. diff --git a/src/w32.c b/src/w32.c index cd1d927e6fc..a9f4f6fb50e 100644 --- a/src/w32.c +++ b/src/w32.c @@ -2929,7 +2929,7 @@ sys_rename (const char * oldname, const char * newname) /* volume_info is set indirectly by map_w32_filename. */ oldname_dev = volume_info.serialnum; - if (os_subtype == OS_WINDOWS_95) + if (os_subtype == OS_9X) { char * o; char * p; diff --git a/src/w32heap.c b/src/w32heap.c index e34021b1099..26cc9aa0a0f 100644 --- a/src/w32heap.c +++ b/src/w32heap.c @@ -66,7 +66,7 @@ cache_system_info (void) w32_minor_version = version.info.minor; if (version.info.platform & 0x8000) - os_subtype = OS_WINDOWS_95; + os_subtype = OS_9X; else os_subtype = OS_NT; @@ -79,7 +79,7 @@ cache_system_info (void) GetVersionEx (&osinfo_cache); w32_build_number = osinfo_cache.dwBuildNumber; - if (os_subtype == OS_WINDOWS_95) + if (os_subtype == OS_9X) w32_build_number &= 0xffff; } diff --git a/src/w32heap.h b/src/w32heap.h index 7a20ba2a8b6..fda3c58bf01 100644 --- a/src/w32heap.h +++ b/src/w32heap.h @@ -51,7 +51,7 @@ extern int w32_minor_version; extern int w32_build_number; enum { - OS_WINDOWS_95 = 1, + OS_9X = 1, OS_NT }; diff --git a/src/w32proc.c b/src/w32proc.c index 15b0ea25bc7..cfc82fa2c47 100644 --- a/src/w32proc.c +++ b/src/w32proc.c @@ -1386,7 +1386,7 @@ find_child_console (HWND hwnd, LPARAM arg) GetClassName (hwnd, window_class, sizeof (window_class)); if (strcmp (window_class, - (os_subtype == OS_WINDOWS_95) + (os_subtype == OS_9X) ? "tty" : "ConsoleWindowClass") == 0) { @@ -1517,7 +1517,7 @@ sys_kill (int pid, int sig) if (NILP (Vw32_start_process_share_console) && cp && cp->hwnd) { #if 1 - if (os_subtype == OS_WINDOWS_95) + if (os_subtype == OS_9X) { /* Another possibility is to try terminating the VDM out-right by From bb6eb9fcbd3ce25724ce3823132fa5d758a5ade1 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 29 Jul 2012 09:29:23 -0700 Subject: [PATCH 49/89] * international/mule-cmds.el (inactivate-input-method): Mark obsolete. --- lisp/ChangeLog | 2 ++ lisp/international/mule-cmds.el | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d55ecc7fd52..81afe67fd5b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -13,6 +13,8 @@ Rename from inactivate-current-input-method-function. (input-method-deactivate-hook): New hook. (input-method-inactivate-hook): Mark obsolete. + (inactivate-input-method): Mark obsolete. + * international/quail.el (quail-activate): Also run quail-deactivate-hook. (quail-deactivate): Rename from quail-inactivate. diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index 5a3f7246f9c..0fbd6453c55 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -1468,6 +1468,10 @@ If INPUT-METHOD is nil, deactivate any current input method." (setq current-input-method nil) (force-mode-line-update))))) +(define-obsolete-function-alias + 'inactivate-input-method + 'deactivate-input-method "24.2") + (defun set-input-method (input-method &optional interactive) "Select and activate input method INPUT-METHOD for the current buffer. This also sets the default input method to the one you specify. From ffd817eb10bd5e4ad1bf693fc2ebdffd25dea874 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dj=C3=A4rv?= Date: Sun, 29 Jul 2012 18:55:02 +0200 Subject: [PATCH 50/89] * Makefile.in (install-arch-indep): Handle space in locallisppath. * src/lread.c (init_lread): Remove if-statement in ifdef HAVE_NS before setting sitelisp. Fixes: debbugs:12010 --- ChangeLog | 4 ++++ Makefile.in | 9 +++++---- src/ChangeLog | 5 +++++ src/lread.c | 10 ---------- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index f9546f9e056..82b4e7fd15c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2012-07-29 Jan Djärv + + * Makefile.in (install-arch-indep): Handle space in locallisppath. + 2012-07-28 Paul Eggert Use Gnulib environ module (Bug#9772). diff --git a/Makefile.in b/Makefile.in index 95b0931087f..c6df480ce7c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -285,9 +285,9 @@ removenullpaths=sed -e 's/^://g' -e 's/:$$//g' -e 's/::/:/g' # to just letting configure generate epaths.h from epaths.in in a # similar way to how Makefile is made from Makefile.in. epaths-force: FRC - @(standardlisppath=`echo ${standardlisppath} | ${removenullpaths}` ; \ - locallisppath=`echo ${locallisppath} | ${removenullpaths}` ; \ - buildlisppath=`echo ${buildlisppath} | ${removenullpaths}` ; \ + @(standardlisppath=`echo "${standardlisppath}" | ${removenullpaths}` ; \ + locallisppath=`echo "${locallisppath}" | ${removenullpaths}` ; \ + buildlisppath=`echo "${buildlisppath}" | ${removenullpaths}` ; \ x_default_search_path=`echo ${x_default_search_path}`; \ gamedir=`echo ${gamedir}`; \ sed < ${srcdir}/src/epaths.in > epaths.h.$$$$ \ @@ -489,7 +489,8 @@ set_installuser=for installuser in $${LOGNAME} $${USERNAME} $${USER} \ ## http://lists.gnu.org/archive/html/autoconf-patches/2004-11/msg00005.html install-arch-indep: install-info install-man ${INSTALL_ARCH_INDEP_EXTRA} umask 022 ; \ - $(MKDIR_P) $(DESTDIR)`echo ${locallisppath} | sed 's,:, $(DESTDIR),g'` + eval sh -x $(MKDIR_P) \ + "'$(DESTDIR)`echo ${locallisppath}|sed \"s,:,' '$(DESTDIR),g\"`'" -set ${COPYDESTS} ; \ unset CDPATH; \ $(set_installuser); \ diff --git a/src/ChangeLog b/src/ChangeLog index aba9846f6a6..d6143d15bde 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2012-07-29 Jan Djärv + + * lread.c (init_lread): Remove if-statement in ifdef HAVE_NS before + setting sitelisp (Bug#12010). + 2012-07-29 Eli Zaretskii * w32heap.h (OS_9X): Renamed from OS_WINDOWS_95. diff --git a/src/lread.c b/src/lread.c index 39378bb11dd..0db37d7492f 100644 --- a/src/lread.c +++ b/src/lread.c @@ -4121,12 +4121,7 @@ init_lread (void) difference between initialized and !initialized in this case, so we'll have to do it unconditionally when Vinstallation_directory is non-nil. */ -#ifdef HAVE_NS - /* loadpath already includes the app-bundle's site-lisp. */ - if (!no_site_lisp && !egetenv ("EMACSLOADPATH") && !loadpath) -#else if (!no_site_lisp && !egetenv ("EMACSLOADPATH")) -#endif { Lisp_Object sitelisp; sitelisp = decode_env_path (0, PATH_SITELOADSEARCH); @@ -4270,12 +4265,7 @@ init_lread (void) load_path_check (); /* Add the site-lisp directories at the front. */ -#ifdef HAVE_NS - /* loadpath already includes the app-bundle's site-lisp. */ - if (!no_site_lisp && !loadpath) -#else if (!no_site_lisp) -#endif { Lisp_Object sitelisp; sitelisp = decode_env_path (0, PATH_SITELOADSEARCH); From 1117bd24d198694f3f6922fa5c2abe5318b732cd Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Sun, 29 Jul 2012 18:56:18 +0200 Subject: [PATCH 51/89] nt/config.nt: Sync with autogen/config.in. (HAVE_ENVIRON_DECL): New macro. --- nt/ChangeLog | 5 +++++ nt/config.nt | 3 +++ 2 files changed, 8 insertions(+) diff --git a/nt/ChangeLog b/nt/ChangeLog index 033a909c752..000e21a842e 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog @@ -1,3 +1,8 @@ +2012-07-29 Juanma Barranquero + + * config.nt: Sync with autogen/config.in. + (HAVE_ENVIRON_DECL): New macro. + 2012-07-29 Eli Zaretskii * inc/stdalign.h (_Alignas, alignas): Define. diff --git a/nt/config.nt b/nt/config.nt index d32ead3d9c0..dfb4f61ac80 100644 --- a/nt/config.nt +++ b/nt/config.nt @@ -339,6 +339,9 @@ along with GNU Emacs. If not, see . */ /* Define to 1 if you have the `endpwent' function. */ #undef HAVE_ENDPWENT +/* Define if you have the declaration of environ. */ +#undef HAVE_ENVIRON_DECL + /* Define to 1 if you have the `euidaccess' function. */ #undef HAVE_EUIDACCESS From 7e63e0c3c6c94188a614cdd934a8e784c295fdc5 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Sun, 29 Jul 2012 21:14:51 +0400 Subject: [PATCH 52/89] Remove HIDE_LISP_IMPLEMENTATION and cleanup cons free list check. * lisp.h (HIDE_LISP_IMPLEMENTATION): Remove as useless for a long time. Adjust users. (CHECK_CONS_LIST): Remove. Convert all users to check_cons_list. --- src/ChangeLog | 7 +++++++ src/alloc.c | 9 ++------- src/eval.c | 10 +++++----- src/lisp.h | 47 +++++++---------------------------------------- 4 files changed, 21 insertions(+), 52 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index d6143d15bde..8a0f998cfc6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2012-07-29 Dmitry Antipov + + Remove HIDE_LISP_IMPLEMENTATION and cleanup cons free list check. + * lisp.h (HIDE_LISP_IMPLEMENTATION): Remove as useless for a long + time. Adjust users. + (CHECK_CONS_LIST): Remove. Convert all users to check_cons_list. + 2012-07-29 Jan Djärv * lread.c (init_lread): Remove if-statement in ifdef HAVE_NS before diff --git a/src/alloc.c b/src/alloc.c index 7680b3a2d84..f6f656fffa3 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -29,11 +29,6 @@ along with GNU Emacs. If not, see . */ #include #endif -/* This file is part of the core Lisp implementation, and thus must - deal with the real data structures. If the Lisp implementation is - replaced, this file likely will not be used. */ - -#undef HIDE_LISP_IMPLEMENTATION #include "lisp.h" #include "process.h" #include "intervals.h" @@ -5447,7 +5442,7 @@ See Info node `(elisp)Garbage Collection'. */) if (pure_bytes_used_before_overflow) return Qnil; - CHECK_CONS_LIST (); + check_cons_list (); /* Don't keep undo information around forever. Do this early on, so it is no problem if the user quits. */ @@ -5615,7 +5610,7 @@ See Info node `(elisp)Garbage Collection'. */) UNBLOCK_INPUT; - CHECK_CONS_LIST (); + check_cons_list (); gc_in_progress = 0; diff --git a/src/eval.c b/src/eval.c index a0a05ebf0dc..e6cd4e8dc27 100644 --- a/src/eval.c +++ b/src/eval.c @@ -2094,7 +2094,7 @@ eval_sub (Lisp_Object form) args_left = original_args; numargs = Flength (args_left); - CHECK_CONS_LIST (); + check_cons_list (); if (XINT (numargs) < XSUBR (fun)->min_args || (XSUBR (fun)->max_args >= 0 @@ -2222,7 +2222,7 @@ eval_sub (Lisp_Object form) else xsignal1 (Qinvalid_function, original_fun); } - CHECK_CONS_LIST (); + check_cons_list (); lisp_eval_depth--; if (backtrace.debug_on_exit) @@ -2762,7 +2762,7 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */) if (debug_on_next_call) do_debug_on_call (Qlambda); - CHECK_CONS_LIST (); + check_cons_list (); original_fun = args[0]; @@ -2871,13 +2871,13 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */) else if (EQ (funcar, Qautoload)) { Fautoload_do_load (fun, original_fun, Qnil); - CHECK_CONS_LIST (); + check_cons_list (); goto retry; } else xsignal1 (Qinvalid_function, original_fun); } - CHECK_CONS_LIST (); + check_cons_list (); lisp_eval_depth--; if (backtrace.debug_on_exit) val = call_debugger (Fcons (Qexit, Fcons (val, Qnil))); diff --git a/src/lisp.h b/src/lisp.h index a45e9c2c892..a7d120a6985 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -28,20 +28,6 @@ along with GNU Emacs. If not, see . */ #include -/* Use the configure flag --enable-checking[=LIST] to enable various - types of run time checks for Lisp objects. */ - -#ifdef GC_CHECK_CONS_LIST -extern void check_cons_list (void); -#define CHECK_CONS_LIST() check_cons_list () -#else -#define CHECK_CONS_LIST() ((void) 0) -#endif - -/* Temporarily disable wider-than-pointer integers until they're tested more. - Build with CFLAGS='-DWIDE_EMACS_INT' to try them out. */ -/* #undef WIDE_EMACS_INT */ - /* EMACS_INT - signed integer wide enough to hold an Emacs value EMACS_INT_MAX - maximum value of EMACS_INT; can be used in #if pI - printf length modifier for EMACS_INT @@ -642,21 +628,12 @@ struct Lisp_Cons { /* Please do not use the names of these elements in code other than the core lisp implementation. Use XCAR and XCDR below. */ -#ifdef HIDE_LISP_IMPLEMENTATION - Lisp_Object car_; - union - { - Lisp_Object cdr_; - struct Lisp_Cons *chain; - } u; -#else Lisp_Object car; union { Lisp_Object cdr; struct Lisp_Cons *chain; } u; -#endif }; /* Take the car or cdr of something known to be a cons cell. */ @@ -666,13 +643,8 @@ struct Lisp_Cons fields are not accessible as lvalues. (What if we want to switch to a copying collector someday? Cached cons cell field addresses may be invalidated at arbitrary points.) */ -#ifdef HIDE_LISP_IMPLEMENTATION -#define XCAR_AS_LVALUE(c) (XCONS ((c))->car_) -#define XCDR_AS_LVALUE(c) (XCONS ((c))->u.cdr_) -#else #define XCAR_AS_LVALUE(c) (XCONS ((c))->car) #define XCDR_AS_LVALUE(c) (XCONS ((c))->u.cdr) -#endif /* Use these from normal code. */ #define XCAR(c) LISP_MAKE_RVALUE (XCAR_AS_LVALUE (c)) @@ -1485,23 +1457,13 @@ struct Lisp_Float { union { -#ifdef HIDE_LISP_IMPLEMENTATION - double data_; -#else double data; -#endif struct Lisp_Float *chain; } u; }; -#ifdef HIDE_LISP_IMPLEMENTATION -#define XFLOAT_DATA(f) (0 ? XFLOAT (f)->u.data_ : XFLOAT (f)->u.data_) -#else -#define XFLOAT_DATA(f) (0 ? XFLOAT (f)->u.data : XFLOAT (f)->u.data) -/* This should be used only in alloc.c, which always disables - HIDE_LISP_IMPLEMENTATION. */ -#define XFLOAT_INIT(f,n) (XFLOAT (f)->u.data = (n)) -#endif +#define XFLOAT_DATA(f) (0 ? XFLOAT (f)->u.data : XFLOAT (f)->u.data) +#define XFLOAT_INIT(f, n) (XFLOAT (f)->u.data = (n)) /* A character, declared with the following typedef, is a member of some character set associated with the current buffer. */ @@ -2702,6 +2664,11 @@ extern void init_alloc (void); extern void syms_of_alloc (void); extern struct buffer * allocate_buffer (void); extern int valid_lisp_object_p (Lisp_Object); +#ifdef GC_CHECK_CONS_LIST +extern void check_cons_list (void); +#else +#define check_cons_list() ((void) 0) +#endif #ifdef REL_ALLOC /* Defined in ralloc.c */ From 7f259ae657fd3df9f7aef276fe0d83c2277d61bc Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Sun, 29 Jul 2012 19:20:16 +0200 Subject: [PATCH 53/89] src/makefile.w32-in: Update dependencies. --- src/ChangeLog | 5 +++++ src/makefile.w32-in | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 8a0f998cfc6..6dc07cffc46 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2012-07-29 Juanma Barranquero + + * makefile.w32-in (LISP_H, $(BLD)/emacs.$(O), $(BLD)/w32inevt.$(O)) + ($(BLD)/w32console.$(O)): Update dependencies. + 2012-07-29 Dmitry Antipov Remove HIDE_LISP_IMPLEMENTATION and cleanup cons free list check. diff --git a/src/makefile.w32-in b/src/makefile.w32-in index 00b9a21065b..45972db2cf4 100644 --- a/src/makefile.w32-in +++ b/src/makefile.w32-in @@ -438,8 +438,8 @@ LANGINFO_H = $(NT_INC)/langinfo.h \ LISP_H = $(SRC)/lisp.h \ $(SRC)/globals.h \ $(GNU_LIB)/intprops.h \ - $(NT_INC)/stdalign.h \ - $(INTTYPES_H) + $(INTTYPES_H) \ + $(NT_INC)/stdalign.h MD5_H = $(GNU_LIB)/md5.h \ $(NT_INC)/stdint.h MENU_H = $(SRC)/menu.h \ @@ -784,7 +784,6 @@ $(BLD)/emacs.$(O) : \ $(SRC)/w32heap.h \ $(NT_INC)/sys/file.h \ $(NT_INC)/unistd.h \ - $(GNU_LIB)/verify.h \ $(BLOCKINPUT_H) \ $(BUFFER_H) \ $(CHARACTER_H) \ @@ -1165,6 +1164,7 @@ $(BLD)/w32inevt.$(O) : \ $(SRC)/w32inevt.c \ $(SRC)/termchar.h \ $(SRC)/w32heap.h \ + $(SRC)/w32inevt.h \ $(BLOCKINPUT_H) \ $(CONFIG_H) \ $(DISPEXTERN_H) \ @@ -1196,6 +1196,7 @@ $(BLD)/w32console.$(O) : \ $(SRC)/w32console.c \ $(SRC)/disptab.h \ $(SRC)/termchar.h \ + $(SRC)/w32heap.h \ $(SRC)/w32inevt.h \ $(CHARACTER_H) \ $(CODING_H) \ From a5dcc929862f6727c71db5e45d8750f8c322c53b Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Sun, 29 Jul 2012 21:11:42 +0300 Subject: [PATCH 54/89] * lisp/simple.el (goto-line): Don't display default line number in the prompt because it should be displayed by `read-number' (bug#9952). Add the current line number to the defaults of `goto-line' to allow its easier modification by users with `M-n' (bug#9201). * lisp/subr.el (read-number): Support multiple default values like in other minibuffer reading functions. Replace `read' with `string-to-number' for consistency with `number-to-string'. --- lisp/ChangeLog | 11 +++++++++++ lisp/simple.el | 7 ++----- lisp/subr.el | 22 +++++++++++++--------- 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 81afe67fd5b..61ae993319a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,14 @@ +2012-07-29 Juri Linkov + + * simple.el (goto-line): Don't display default line number in the + prompt because it should be displayed by `read-number' (bug#9952). + Add the current line number to the defaults of `goto-line' to + allow its easier modification by users with `M-n' (bug#9201). + + * subr.el (read-number): Support multiple default values like in + other minibuffer reading functions. Replace `read' with + `string-to-number' for consistency with `number-to-string'. + 2012-07-29 Paul Eggert deactive->inactive, inactivate->deactivate spelling fixes (Bug#10150) diff --git a/lisp/simple.el b/lisp/simple.el index 4b6d6c7a73b..e1d6760e72b 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -948,11 +948,8 @@ rather than line counts." (concat " in " (buffer-name buffer)) ""))) ;; Read the argument, offering that number (if any) as default. - (list (read-number (format (if default "Goto line%s (%s): " - "Goto line%s: ") - buffer-prompt - default) - default) + (list (read-number (format "Goto line%s: " buffer-prompt) + (list default (line-number-at-pos))) buffer)))) ;; Switch to the desired buffer, one way or another. (if buffer diff --git a/lisp/subr.el b/lisp/subr.el index 76fec5dd5ac..73bc1d99e05 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2188,23 +2188,27 @@ by doing (clear-string STRING)." "Read a numeric value in the minibuffer, prompting with PROMPT. DEFAULT specifies a default value to return if the user just types RET. The value of DEFAULT is inserted into PROMPT." - (let ((n nil)) - (when default + (let ((n nil) + (default1 (if (consp default) (car default) default))) + (when default1 (setq prompt (if (string-match "\\(\\):[ \t]*\\'" prompt) - (replace-match (format " (default %s)" default) t t prompt 1) + (replace-match (format " (default %s)" default1) t t prompt 1) (replace-regexp-in-string "[ \t]*\\'" - (format " (default %s) " default) + (format " (default %s) " default1) prompt t t)))) (while (progn - (let ((str (read-from-minibuffer prompt nil nil nil nil - (and default - (number-to-string default))))) + (let ((str (read-from-minibuffer + prompt nil nil nil nil + (when default + (if (consp default) + (mapcar 'number-to-string (delq nil default)) + (number-to-string default)))))) (condition-case nil (setq n (cond - ((zerop (length str)) default) - ((stringp str) (read str)))) + ((zerop (length str)) default1) + ((stringp str) (string-to-number str)))) (error nil))) (unless (numberp n) (message "Please enter a number.") From 20ba0cb429e59716eeb84b0b6d828f675d53b1e2 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 29 Jul 2012 21:27:35 +0300 Subject: [PATCH 55/89] Fix bug #12082 with non-ASCII output in Windows GUI sessions. lisp/international/mule-cmds.el (set-locale-environment): Revert last change, since display-graphic-p returns nil when this function is called during startup. Instead... lisp/term/w32console.el (terminal-init-w32console): ...setup the keyboard and terminal encoding for TTY sessions here. --- lisp/ChangeLog | 9 ++++++++ lisp/international/mule-cmds.el | 41 +++++++++++++-------------------- lisp/term/w32console.el | 12 ++++++++++ 3 files changed, 37 insertions(+), 25 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 61ae993319a..a6fd9c3e0d3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2012-07-29 Eli Zaretskii + + * international/mule-cmds.el (set-locale-environment): Revert last + change, since display-graphic-p returns nil when this function is + called during startup. Instead... + + * term/w32console.el (terminal-init-w32console): ...setup the + keyboard and terminal encoding for TTY sessions here. (Bug#12082) + 2012-07-29 Juri Linkov * simple.el (goto-line): Don't display default line number in the diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index 0fbd6453c55..524840e05fd 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -2666,32 +2666,23 @@ See also `locale-charset-language-names', `locale-language-names', ;; On Windows, override locale-coding-system, ;; default-file-name-coding-system, keyboard-coding-system, - ;; terminal-coding-system with the appropriate codepages. + ;; terminal-coding-system with system codepage. (when (boundp 'w32-ansi-code-page) - (let ((ansi-code-page-coding (intern (format "cp%d" w32-ansi-code-page))) - (oem-code-page-coding - (intern (format "cp%d" (w32-get-console-codepage)))) - (oem-code-page-output-coding - (intern (format "cp%d" (w32-get-console-output-codepage)))) - ansi-cs-p oem-cs-p oem-o-cs-p) - (setq ansi-cs-p (coding-system-p ansi-code-page-coding)) - (setq oem-cs-p (coding-system-p oem-code-page-coding)) - (setq oem-o-cs-p (coding-system-p oem-code-page-output-coding)) - ;; Set the keyboard and display encoding to either the current - ;; ANSI codepage of the OEM codepage, depending on whether - ;; this is a GUI or a TTY frame. - (when ansi-cs-p - (unless frame (setq locale-coding-system ansi-code-page-coding)) - (when (display-graphic-p frame) - (set-keyboard-coding-system ansi-code-page-coding frame) - (set-terminal-coding-system ansi-code-page-coding frame)) - (setq default-file-name-coding-system ansi-code-page-coding)) - (when oem-cs-p - (unless (display-graphic-p frame) - (set-keyboard-coding-system oem-code-page-coding frame) - (set-terminal-coding-system - (if oem-o-cs-p oem-code-page-output-coding oem-code-page-coding) - frame))))) + (let ((code-page-coding (intern (format "cp%d" w32-ansi-code-page)))) + (when (coding-system-p code-page-coding) + (unless frame (setq locale-coding-system code-page-coding)) + (set-keyboard-coding-system code-page-coding frame) + (set-terminal-coding-system code-page-coding frame) + ;; Set default-file-name-coding-system last, so that Emacs + ;; doesn't try to use cpNNNN when it defines keyboard and + ;; terminal encoding. That's because the above two lines + ;; will want to load code-pages.el, where cpNNNN are + ;; defined; if default-file-name-coding-system were set to + ;; cpNNNN while these two lines run, Emacs will want to use + ;; it for encoding the file name it wants to load. And that + ;; will fail, since cpNNNN is not yet usable until + ;; code-pages.el finishes loading. + (setq default-file-name-coding-system code-page-coding)))) (when (eq system-type 'darwin) ;; On Darwin, file names are always encoded in utf-8, no matter diff --git a/lisp/term/w32console.el b/lisp/term/w32console.el index d52a4e68932..ceaa936e79b 100644 --- a/lisp/term/w32console.el +++ b/lisp/term/w32console.el @@ -52,6 +52,18 @@ "Terminal initialization function for w32 console." ;; Share function key initialization with w32 gui frames (x-setup-function-keys (selected-frame)) + ;; Set terminal and keyboard encodings to the current OEM codepage. + (let ((oem-code-page-coding + (intern (format "cp%d" (w32-get-console-codepage)))) + (oem-code-page-output-coding + (intern (format "cp%d" (w32-get-console-output-codepage)))) + oem-cs-p oem-o-cs-p) + (setq oem-cs-p (coding-system-p oem-code-page-coding)) + (setq oem-o-cs-p (coding-system-p oem-code-page-output-coding)) + (when oem-cs-p + (set-keyboard-coding-system oem-code-page-coding) + (set-terminal-coding-system + (if oem-o-cs-p oem-code-page-output-coding oem-code-page-coding)))) (let* ((colors w32-tty-standard-colors) (color (car colors))) (tty-color-clear) From 26918d77f774755ffb1621d614364cd38c9736ab Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 29 Jul 2012 21:33:47 +0300 Subject: [PATCH 56/89] Remove obsolete comment in mule-cmds.el. --- lisp/international/mule-cmds.el | 9 --------- 1 file changed, 9 deletions(-) diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index 524840e05fd..a6ea2c1796c 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -2673,15 +2673,6 @@ See also `locale-charset-language-names', `locale-language-names', (unless frame (setq locale-coding-system code-page-coding)) (set-keyboard-coding-system code-page-coding frame) (set-terminal-coding-system code-page-coding frame) - ;; Set default-file-name-coding-system last, so that Emacs - ;; doesn't try to use cpNNNN when it defines keyboard and - ;; terminal encoding. That's because the above two lines - ;; will want to load code-pages.el, where cpNNNN are - ;; defined; if default-file-name-coding-system were set to - ;; cpNNNN while these two lines run, Emacs will want to use - ;; it for encoding the file name it wants to load. And that - ;; will fail, since cpNNNN is not yet usable until - ;; code-pages.el finishes loading. (setq default-file-name-coding-system code-page-coding)))) (when (eq system-type 'darwin) From 9052f9f01ea219b9e9819b3cb3c6bfd9a6751460 Mon Sep 17 00:00:00 2001 From: Jay Belanger Date: Sun, 29 Jul 2012 13:51:16 -0500 Subject: [PATCH 57/89] calc/calc.el (math-normalize-error): New variable. (math-normalize): Set `math-normalize-error' to t when there's an error. calc/calc-alg.el (math-simplify): Don't simplify when `math-normalize' returns an error. --- lisp/ChangeLog | 9 +++++++++ lisp/calc/calc-alg.el | 12 ++++++++---- lisp/calc/calc.el | 11 +++++++++++ 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a6fd9c3e0d3..18772064d7d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2012-07-29 Jay Belanger + + * calc/calc.el (math-normalize-error): New variable. + (math-normalize): Set `math-normalize-error' to t + when there's an error. + + * calc/calc-alg.el (math-simplify): Don't simplify when + `math-normalize' returns an error. + 2012-07-29 Eli Zaretskii * international/mule-cmds.el (set-locale-environment): Revert last diff --git a/lisp/calc/calc-alg.el b/lisp/calc/calc-alg.el index 50b31400a6a..3182e85a8c6 100644 --- a/lisp/calc/calc-alg.el +++ b/lisp/calc/calc-alg.el @@ -356,6 +356,8 @@ ;; math-simplify-step, which is called by math-simplify. (defvar math-top-only) +;; math-normalize-error is declared in calc.el. +(defvar math-normalize-error) (defun math-simplify (top-expr) (let ((math-simplifying t) (math-top-only (consp calc-simplify-mode)) @@ -383,10 +385,12 @@ (calc-with-default-simplification (while (let ((r simp-rules)) (setq res (math-normalize top-expr)) - (while r - (setq res (math-rewrite res (car r)) - r (cdr r))) - (not (equal top-expr (setq res (math-simplify-step res))))) + (if (not math-normalize-error) + (progn + (while r + (setq res (math-rewrite res (car r)) + r (cdr r))) + (not (equal top-expr (setq res (math-simplify-step res))))))) (setq top-expr res))))) top-expr) diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index 7fb9148535a..a149cfe7966 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el @@ -2583,7 +2583,11 @@ largest Emacs integer.") ;;; Reduce an object to canonical (normalized) form. [O o; Z Z] [Public] (defvar math-normalize-a) +(defvar math-normalize-error nil + "Non-nil if the last call the `math-normalize' returned an error.") + (defun math-normalize (math-normalize-a) + (setq math-normalize-error nil) (cond ((not (consp math-normalize-a)) (if (integerp math-normalize-a) @@ -2672,31 +2676,38 @@ largest Emacs integer.") (fboundp (car math-normalize-a)))) (apply (car math-normalize-a) args))))) (wrong-number-of-arguments + (setq math-normalize-error t) (calc-record-why "*Wrong number of arguments" (cons (car math-normalize-a) args)) nil) (wrong-type-argument + (setq math-normalize-error t) (or calc-next-why (calc-record-why "Wrong type of argument" (cons (car math-normalize-a) args))) nil) (args-out-of-range + (setq math-normalize-error t) (calc-record-why "*Argument out of range" (cons (car math-normalize-a) args)) nil) (inexact-result + (setq math-normalize-error t) (calc-record-why "No exact representation for result" (cons (car math-normalize-a) args)) nil) (math-overflow + (setq math-normalize-error t) (calc-record-why "*Floating-point overflow occurred" (cons (car math-normalize-a) args)) nil) (math-underflow + (setq math-normalize-error t) (calc-record-why "*Floating-point underflow occurred" (cons (car math-normalize-a) args)) nil) (void-variable + (setq math-normalize-error t) (if (eq (nth 1 err) 'var-EvalRules) (progn (setq var-EvalRules nil) From c91562a619ba72b93196791a519e6481ff633fc1 Mon Sep 17 00:00:00 2001 From: David Engster Date: Sun, 29 Jul 2012 21:57:28 +0200 Subject: [PATCH 58/89] New tests for XML name expansion. * automated/xml-parse-tests.el (xml-parse-tests--qnames): New variable to hold test data for name expansion. (xml-parse-tests): Test the two different types of name expansion. --- test/ChangeLog | 6 +++++ test/automated/xml-parse-tests.el | 43 ++++++++++++++++++++++++++++++- 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/test/ChangeLog b/test/ChangeLog index 54030e210ed..03d43d72b54 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,9 @@ +2012-07-29 David Engster + + * automated/xml-parse-tests.el (xml-parse-tests--qnames): New + variable to hold test data for name expansion. + (xml-parse-tests): Test the two different types of name expansion. + 2012-07-29 Juri Linkov * automated/occur-tests.el (occur-test-case): Use predefined diff --git a/test/automated/xml-parse-tests.el b/test/automated/xml-parse-tests.el index e6553060345..35009ed36a2 100644 --- a/test/automated/xml-parse-tests.el +++ b/test/automated/xml-parse-tests.el @@ -74,6 +74,25 @@ "abc") "List of XML strings that should signal an error in the parser") +(defvar xml-parse-tests--qnames + '( ;; Test data for name expansion + ("/calendar/events/HTTP/1.1 200 OK" + ;; Result with qnames as cons + ((("DAV:" . "multistatus") + ((("http://www.w3.org/2000/xmlns/" . "D") . "DAV:")) + (("DAV:" . "response") nil (("DAV:" . "href") nil "/calendar/events/") + (("DAV:" . "propstat") nil (("DAV:" . "status") nil "HTTP/1.1 200 OK"))))) + ;; Result with qnames as symbols + ((DAV:multistatus + ((("http://www.w3.org/2000/xmlns/" . "D") . "DAV:")) + (DAV:response nil (DAV:href nil "/calendar/events/") + (DAV:propstat nil (DAV:status nil "HTTP/1.1 200 OK")))))) + ("hi there" + ((("FOOBAR:" . "something") nil "hi there")) + ((FOOBAR:something nil "hi there")))) + "List of strings which are parsed using namespace expansion. +Parser is called with and without 'symbol-qnames argument.") + (ert-deftest xml-parse-tests () "Test XML parsing." (with-temp-buffer @@ -85,7 +104,29 @@ (dolist (test xml-parse-tests--bad-data) (erase-buffer) (insert test) - (should-error (xml-parse-region)))))) + (should-error (xml-parse-region)))) + (let ((testdata (car xml-parse-tests--qnames))) + (erase-buffer) + (insert (car testdata)) + (should (equal (nth 1 testdata) + (xml-parse-region nil nil nil nil t))) + (should (equal (nth 2 testdata) + (xml-parse-region nil nil nil nil 'symbol-qnames)))) + (let ((testdata (nth 1 xml-parse-tests--qnames))) + (erase-buffer) + (insert (car testdata)) + ;; Provide additional namespace-URI mapping + (should (equal (nth 1 testdata) + (xml-parse-region + nil nil nil nil + (append xml-default-ns + '(("F" . "FOOBAR:")))))) + (should (equal (nth 2 testdata) + (xml-parse-region + nil nil nil nil + (cons 'symbol-qnames + (append xml-default-ns + '(("F" . "FOOBAR:")))))))))) ;; Local Variables: ;; no-byte-compile: t From d7fcec5d7d7b5c457dd6b44572f672c81691e171 Mon Sep 17 00:00:00 2001 From: Ted Zlatanov Date: Sun, 29 Jul 2012 22:07:41 +0000 Subject: [PATCH 59/89] lisp/gnus/auth-source.el: Support Mac OS X Keychains --- lisp/gnus/ChangeLog | 11 ++ lisp/gnus/auth-source.el | 264 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 274 insertions(+), 1 deletion(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 0476fc043c2..9426b7889c8 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,14 @@ +2012-07-29 Teodor Zlatanov + + * auth-source.el (auth-sources, auth-source-backend-parse) + (auth-source-macos-keychain-search) + (auth-source-macos-keychain-search-items) + (auth-source-macos-keychain-result-append) + (auth-source-macos-keychain-create): Support Mac OS X Keychains in + auth-source.el through the /usr/bin/security utility. + (auth-sources): Fix syntax error. + (auth-source-macos-keychain-result-append): Fix variable name. + 2012-07-27 Julien Danjou * message.el (fboundp): Add a defalias on `mail-dont-reply-to' for diff --git a/lisp/gnus/auth-source.el b/lisp/gnus/auth-source.el index 47359500dc4..87f09632250 100644 --- a/lisp/gnus/auth-source.el +++ b/lisp/gnus/auth-source.el @@ -254,6 +254,13 @@ can get pretty complex." (const :tag "Default Secrets API Collection" 'default) (const :tag "Login Secrets API Collection" "secrets:Login") (const :tag "Temp Secrets API Collection" "secrets:session") + + (const :tag "Default internet Mac OS Keychain" + 'macos-keychain-internet) + + (const :tag "Default generic Mac OS Keychain" + 'macos-keychain-generic) + (list :tag "Source definition" (const :format "" :value :source) (choice :tag "Authentication backend choice" @@ -266,7 +273,21 @@ can get pretty complex." (const :tag "Default" 'default) (const :tag "Login" "Login") (const - :tag "Temporary" "session")))) + :tag "Temporary" "session"))) + (list + :tag "Mac OS internet Keychain" + (const :format "" + :value :macos-keychain-internet) + (choice :tag "Collection to use" + (string :tag "internet Keychain path") + (const :tag "default" 'default)))) + (list + :tag "Mac OS generic Keychain" + (const :format "" + :value :macos-keychain-generic) + (choice :tag "Collection to use" + (string :tag "generic Keychain path") + (const :tag "default" 'default)))) (repeat :tag "Extra Parameters" :inline t (choice :tag "Extra parameter" (list @@ -377,6 +398,10 @@ with \"[a/b/c] \" if CHOICES is '\(?a ?b ?c\)." ;; (auth-source-backend-parse "myfile.gpg") ;; (auth-source-backend-parse 'default) ;; (auth-source-backend-parse "secrets:Login") +;; (auth-source-backend-parse 'macos-keychain-internet) +;; (auth-source-backend-parse 'macos-keychain-generic) +;; (auth-source-backend-parse "macos-keychain-internet:/path/here.keychain") +;; (auth-source-backend-parse "macos-keychain-generic:/path/here.keychain") (defun auth-source-backend-parse (entry) "Creates an auth-source-backend from an ENTRY in `auth-sources'." @@ -391,6 +416,28 @@ with \"[a/b/c] \" if CHOICES is '\(?a ?b ?c\)." ;; matching any user, host, and protocol ((and (stringp entry) (string-match "^secrets:\\(.+\\)" entry)) (auth-source-backend-parse `(:source (:secrets ,(match-string 1 entry))))) + + ;; take 'macos-keychain-internet and recurse to get it as a Mac OS + ;; Keychain collection matching any user, host, and protocol + ((eq entry 'macos-keychain-internet) + (auth-source-backend-parse '(:source (:macos-keychain-internet default)))) + ;; take 'macos-keychain-generic and recurse to get it as a Mac OS + ;; Keychain collection matching any user, host, and protocol + ((eq entry 'macos-keychain-generic) + (auth-source-backend-parse '(:source (:macos-keychain-generic default)))) + ;; take macos-keychain-internet:XYZ and recurse to get it as MacOS + ;; Keychain "XYZ" matching any user, host, and protocol + ((and (stringp entry) (string-match "^macos-keychain-internet:\\(.+\\)" + entry)) + (auth-source-backend-parse `(:source (:macos-keychain-internet + ,(match-string 1 entry))))) + ;; take macos-keychain-generic:XYZ and recurse to get it as MacOS + ;; Keychain "XYZ" matching any user, host, and protocol + ((and (stringp entry) (string-match "^macos-keychain-generic:\\(.+\\)" + entry)) + (auth-source-backend-parse `(:source (:macos-keychain-generic + ,(match-string 1 entry))))) + ;; take just a file name and recurse to get it as a netrc file ;; matching any user, host, and protocol ((stringp entry) @@ -413,6 +460,33 @@ with \"[a/b/c] \" if CHOICES is '\(?a ?b ?c\)." :search-function 'auth-source-netrc-search :create-function 'auth-source-netrc-create))) + ;; the MacOS Keychain + ((and + (not (null (plist-get entry :source))) ; the source must not be nil + (listp (plist-get entry :source)) ; and it must be a list + (or + (plist-get (plist-get entry :source) :macos-keychain-generic) + (plist-get (plist-get entry :source) :macos-keychain-internet))) + + (let* ((source-spec (plist-get entry :source)) + (keychain-generic (plist-get source-spec :macos-keychain-generic)) + (keychain-type (if keychain-generic + 'macos-keychain-generic + 'macos-keychain-internet)) + (source (plist-get source-spec (if keychain-generic + :macos-keychain-generic + :macos-keychain-internet)))) + + (when (symbolp source) + (setq source (symbol-name source))) + + (auth-source-backend + (format "Mac OS Keychain (%s)" source) + :source source + :type keychain-type + :search-function 'auth-source-macos-keychain-search + :create-function 'auth-source-macos-keychain-create))) + ;; the Secrets API. We require the package, in order to have a ;; defined value for `secrets-enabled'. ((and @@ -694,6 +768,7 @@ must call it to obtain the actual value." (let* ((bmatches (apply (slot-value backend 'search-function) :backend backend + :type (slot-value backend :type) ;; note we're overriding whatever the spec ;; has for :require, :create, and :delete :require require @@ -1515,6 +1590,193 @@ authentication tokens: ;; (apply 'secrets-create-item (auth-get-source entry) name passwd spec) (debug spec)) +;;; Backend specific parsing: Mac OS Keychain (using /usr/bin/security) backend + +;; (let ((auth-sources '(macos-keychain-internet))) (auth-source-search :max 1 :create t)) +;; (let ((auth-sources '(macos-keychain-internet))) (auth-source-search :max 1 :delete t)) +;; (let ((auth-sources '(macos-keychain-internet))) (auth-source-search :max 1)) +;; (let ((auth-sources '(macos-keychain-internet))) (auth-source-search)) + +;; (let ((auth-sources '(macos-keychain-generic))) (auth-source-search :max 1 :create t)) +;; (let ((auth-sources '(macos-keychain-generic))) (auth-source-search :max 1 :delete t)) +;; (let ((auth-sources '(macos-keychain-generic))) (auth-source-search :max 1)) +;; (let ((auth-sources '(macos-keychain-generic))) (auth-source-search)) + +;; (let ((auth-sources '("macos-keychain-internet:/Users/tzz/Library/Keychains/login.keychain"))) (auth-source-search :max 1)) +;; (let ((auth-sources '("macos-keychain-generic:Login"))) (auth-source-search :max 1 :host "git.gnus.org")) + +(defun* auth-source-macos-keychain-search (&rest + spec + &key backend create delete label + type max host user port + &allow-other-keys) + "Search the MacOS Keychain; spec is like `auth-source'. + +All search keys must match exactly. If you need substring +matching, do a wider search and narrow it down yourself. + +You'll get back all the properties of the token as a plist. + +The :type key is either 'macos-keychain-internet or +'macos-keychain-generic. + +For the internet keychain type, the :label key searches the +item's labels (\"-l LABEL\" passed to \"/usr/bin/security\"). +Similarly, :host maps to \"-s HOST\", :user maps to \"-a USER\", +and :port maps to \"-P PORT\" or \"-r PROT\" +(note PROT has to be a 4-character string). + +For the generic keychain type, the :label key searches the item's +labels (\"-l LABEL\" passed to \"/usr/bin/security\"). +Similarly, :host maps to \"-c HOST\" (the \"creator\" keychain +field), :user maps to \"-a USER\", and :port maps to \"-s PORT\". + +Here's an example that looks for the first item in the default +generic MacOS Keychain: + + \(let ((auth-sources '(macos-keychain-generic))) + (auth-source-search :max 1) + +Here's another that looks for the first item in the internet +MacOS Keychain collection whose label is 'gnus': + + \(let ((auth-sources '(macos-keychain-internet))) + (auth-source-search :max 1 :label \"gnus\") + +And this one looks for the first item in the internet keychain +entries for git.gnus.org: + + \(let ((auth-sources '(macos-keychain-internet\"))) + (auth-source-search :max 1 :host \"git.gnus.org\")) +" + ;; TODO + (assert (not create) nil + "The MacOS Keychain auth-source backend doesn't support creation yet") + ;; TODO + ;; (macos-keychain-delete-item coll elt) + (assert (not delete) nil + "The MacOS Keychain auth-source backend doesn't support deletion yet") + + (let* ((coll (oref backend source)) + (max (or max 5000)) ; sanity check: default to stop at 5K + (ignored-keys '(:create :delete :max :backend :label)) + (search-keys (loop for i below (length spec) by 2 + unless (memq (nth i spec) ignored-keys) + collect (nth i spec))) + ;; build a search spec without the ignored keys + ;; if a search key is nil or t (match anything), we skip it + (search-spec (apply 'append (mapcar + (lambda (k) + (if (or (null (plist-get spec k)) + (eq t (plist-get spec k))) + nil + (list k (plist-get spec k)))) + search-keys))) + ;; needed keys (always including host, login, port, and secret) + (returned-keys (mm-delete-duplicates (append + '(:host :login :port :secret) + search-keys))) + (items (apply 'auth-source-macos-keychain-search-items + coll + type + max + search-spec)) + + ;; ensure each item has each key in `returned-keys' + (items (mapcar (lambda (plist) + (append + (apply 'append + (mapcar (lambda (req) + (if (plist-get plist req) + nil + (list req nil))) + returned-keys)) + plist)) + items))) + items)) + +(defun* auth-source-macos-keychain-search-items (coll type max + &rest spec + &key label type + host user port + &allow-other-keys) + + (let* ((keychain-generic (eq type 'macos-keychain-generic)) + (args `(,(if keychain-generic + "find-generic-password" + "find-internet-password") + "-g")) + (ret (list :type type))) + (when label + (setq args (append args (list "-l" label)))) + (when host + (setq args (append args (list (if keychain-generic "-c" "-s") host)))) + (when user + (setq args (append args (list "-a" user)))) + + (when port + (if keychain-generic + (setq args (append args (list "-s" port))) + (setq args (append args (list + (if (string-match "[0-9]+" port) "-P" "-r") + port))))) + + (unless (equal coll "default") + (setq args (append args (list coll)))) + + (with-temp-buffer + (apply 'call-process "/usr/bin/security" nil t nil args) + (goto-char (point-min)) + (while (not (eobp)) + (cond + ((looking-at "^password: \"\\(.+\\)\"$") + (auth-source-macos-keychain-result-append + ret + keychain-generic + "secret" + (lexical-let ((v (match-string 1))) + (lambda () v)))) + ;; TODO: check if this is really the label + ;; match 0x00000007 ="AppleID" + ((looking-at "^[ ]+0x00000007 =\"\\(.+\\)\"") + (auth-source-macos-keychain-result-append + ret + keychain-generic + "label" + (match-string 1))) + ;; match "crtr"="aapl" + ;; match "svce"="AppleID" + ((looking-at "^[ ]+\"\\([a-z]+\\)\"[^=]+=\"\\(.+\\)\"") + (auth-source-macos-keychain-result-append + ret + keychain-generic + (match-string 1) + (match-string 2)))) + (forward-line))) + ;; return `ret' iff it has the :secret key + (and (plist-get ret :secret) (list ret)))) + +(defun auth-source-macos-keychain-result-append (result generic k v) + (push v ret) + (setq k (cond + ((equal k "acct") "user") + ;; for generic keychains, creator is host, service is port + ((and generic (equal k "crtr")) "host") + ((and generic (equal k "svce")) "port") + ;; for internet keychains, protocol is port, server is host + ((and (not generic) (equal k "ptcl")) "port") + ((and (not generic) (equal k "srvr")) "host") + (t k))) + + (push (intern (format ":%s" k)) ret)) + +(defun* auth-source-macos-keychain-create (&rest + spec + &key backend type max host user port + &allow-other-keys) + ;; TODO + (debug spec)) + ;;; Backend specific parsing: PLSTORE backend (defun* auth-source-plstore-search (&rest From d6e7c17b31f74169fc787d02a36b15f17ba41f86 Mon Sep 17 00:00:00 2001 From: Ted Zlatanov Date: Sun, 29 Jul 2012 22:17:54 +0000 Subject: [PATCH 60/89] lisp/gnus/auth-source.el: Fix last change --- lisp/gnus/ChangeLog | 1 + lisp/gnus/auth-source.el | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 9426b7889c8..f13ffb5afd7 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -8,6 +8,7 @@ auth-source.el through the /usr/bin/security utility. (auth-sources): Fix syntax error. (auth-source-macos-keychain-result-append): Fix variable name. + (auth-sources, auth-source-macos-keychain-result-append): More fixes. 2012-07-27 Julien Danjou diff --git a/lisp/gnus/auth-source.el b/lisp/gnus/auth-source.el index 87f09632250..79358b401b8 100644 --- a/lisp/gnus/auth-source.el +++ b/lisp/gnus/auth-source.el @@ -280,7 +280,7 @@ can get pretty complex." :value :macos-keychain-internet) (choice :tag "Collection to use" (string :tag "internet Keychain path") - (const :tag "default" 'default)))) + (const :tag "default" 'default))) (list :tag "Mac OS generic Keychain" (const :format "" @@ -1757,7 +1757,7 @@ entries for git.gnus.org: (and (plist-get ret :secret) (list ret)))) (defun auth-source-macos-keychain-result-append (result generic k v) - (push v ret) + (push v result) (setq k (cond ((equal k "acct") "user") ;; for generic keychains, creator is host, service is port @@ -1768,7 +1768,7 @@ entries for git.gnus.org: ((and (not generic) (equal k "srvr")) "host") (t k))) - (push (intern (format ":%s" k)) ret)) + (push (intern (format ":%s" k)) result)) (defun* auth-source-macos-keychain-create (&rest spec From d5040d2dec0f7e08b715ce6952d5568ed86d1812 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 29 Jul 2012 15:42:12 -0700 Subject: [PATCH 61/89] * lisp.h (LISP_INT_TAG, LISP_INT1_TAG, LISP_STRING_TAG): Remove. These macros are confusing and no longer need to be defined, as the enum values now suffice. Each use replaced with definiens. (Lisp_Int1, Lisp_String): Define directly; this is clearer. --- src/ChangeLog | 7 +++++++ src/buffer.c | 8 ++++---- src/data.c | 2 +- src/lisp.h | 9 +++------ 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 6dc07cffc46..3d490df4fe9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2012-07-29 Paul Eggert + + * lisp.h (LISP_INT_TAG, LISP_INT1_TAG, LISP_STRING_TAG): Remove. + These macros are confusing and no longer need to be defined, as + the enum values now suffice. All uses replaced with definiens. + (Lisp_Int1, Lisp_String): Define directly; this is clearer. + 2012-07-29 Juanma Barranquero * makefile.w32-in (LISP_H, $(BLD)/emacs.$(O), $(BLD)/w32inevt.$(O)) diff --git a/src/buffer.c b/src/buffer.c index 70630de53cb..833eb843168 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -5457,17 +5457,17 @@ Use the command `abbrev-mode' to change this variable. */); doc: /* Non-nil if searches and matches should ignore case. */); DEFVAR_PER_BUFFER ("fill-column", &BVAR (current_buffer, fill_column), - make_number (LISP_INT_TAG), + make_number (Lisp_Int0), doc: /* Column beyond which automatic line-wrapping should happen. Interactively, you can set the buffer local value using \\[set-fill-column]. */); DEFVAR_PER_BUFFER ("left-margin", &BVAR (current_buffer, left_margin), - make_number (LISP_INT_TAG), + make_number (Lisp_Int0), doc: /* Column for the default `indent-line-function' to indent to. Linefeed indents to this column in Fundamental mode. */); DEFVAR_PER_BUFFER ("tab-width", &BVAR (current_buffer, tab_width), - make_number (LISP_INT_TAG), + make_number (Lisp_Int0), doc: /* Distance between tab stops (for display of tab characters), in columns. This should be an integer greater than zero. */); @@ -5588,7 +5588,7 @@ If it is nil, that means don't auto-save this buffer. */); Backing up is done before the first time the file is saved. */); DEFVAR_PER_BUFFER ("buffer-saved-size", &BVAR (current_buffer, save_length), - make_number (LISP_INT_TAG), + make_number (Lisp_Int0), doc: /* Length of current buffer when last read in, saved or auto-saved. 0 initially. -1 means auto-saving turned off until next real save. diff --git a/src/data.c b/src/data.c index b23bcbe15b3..bef2888a969 100644 --- a/src/data.c +++ b/src/data.c @@ -928,7 +928,7 @@ store_symval_forwarding (union Lisp_Fwd *valcontents, register Lisp_Object newva Lisp_Object type = XBUFFER_OBJFWD (valcontents)->slottype; if (!(NILP (type) || NILP (newval) - || (XINT (type) == LISP_INT_TAG + || (XINT (type) == Lisp_Int0 ? INTEGERP (newval) : XTYPE (newval) == XINT (type)))) buffer_slot_type_mismatch (newval, XINT (type)); diff --git a/src/lisp.h b/src/lisp.h index a7d120a6985..a530148e4dd 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -213,11 +213,8 @@ enum enum_USE_LSB_TAG { USE_LSB_TAG = 0 }; /* Lisp integers use 2 tags, to give them one extra bit, thus extending their range from, e.g., -2^28..2^28-1 to -2^29..2^29-1. */ #define INTMASK (EMACS_INT_MAX >> (INTTYPEBITS - 1)) -#define LISP_INT_TAG Lisp_Int0 #define case_Lisp_Int case Lisp_Int0: case Lisp_Int1 -#define LISP_INT1_TAG (USE_LSB_TAG ? 1 << INTTYPEBITS : 1) -#define LISP_STRING_TAG (5 - LISP_INT1_TAG) -#define LISP_INT_TAG_P(x) (((x) & ~LISP_INT1_TAG) == 0) +#define LISP_INT_TAG_P(x) (((x) & ~Lisp_Int1) == 0) /* Stolen from GDB. The only known compiler that doesn't support enums in bitfields is MSVC. */ @@ -232,7 +229,7 @@ enum Lisp_Type { /* Integer. XINT (obj) is the integer value. */ Lisp_Int0 = 0, - Lisp_Int1 = LISP_INT1_TAG, + Lisp_Int1 = USE_LSB_TAG ? 1 << INTTYPEBITS : 1, /* Symbol. XSYMBOL (object) points to a struct Lisp_Symbol. */ Lisp_Symbol = 2, @@ -243,7 +240,7 @@ enum Lisp_Type /* String. XSTRING (object) points to a struct Lisp_String. The length of the string, and its contents, are stored therein. */ - Lisp_String = LISP_STRING_TAG, + Lisp_String = USE_LSB_TAG ? 1 : 1 << INTTYPEBITS, /* Vector of Lisp objects, or something resembling it. XVECTOR (object) points to a struct Lisp_Vector, which contains From 1823ac5abe03117aab926ff0d51a189d513251ce Mon Sep 17 00:00:00 2001 From: Jay Belanger Date: Sun, 29 Jul 2012 18:19:09 -0500 Subject: [PATCH 62/89] calc/calc.el (calc-simplify-mode): Make 'alg the default value. (calc-set-mode-line): Don't display "AlgSimp ". calc/calc-mode.el (calc-alg-simplify-mode): Remove function. (calc-lim-simplify-mode): New function. (calc-set-simplify-mode): Default to 'alg. (calc-default-simplify-mode): Make algebraic simplifications the default. calc/calc-ext.el (calc-init-extensions): Remove binding for `calc-alg-simplify-mode'. Add binding for `calc-lim-simplify-mode'. calc/README: Mention new default simplification mode. --- lisp/ChangeLog | 14 ++++++++++++++ lisp/calc/README | 6 ++++++ lisp/calc/calc-ext.el | 4 ++-- lisp/calc/calc-mode.el | 19 +++++++++++-------- lisp/calc/calc.el | 8 ++++---- 5 files changed, 37 insertions(+), 14 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 18772064d7d..5434f9ed8ba 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,19 @@ 2012-07-29 Jay Belanger + * calc/calc.el (calc-simplify-mode): Make 'alg the default value. + (calc-set-mode-line): Don't display "AlgSimp ". + + * calc/calc-mode.el (calc-alg-simplify-mode): Remove function. + (calc-lim-simplify-mode): New function. + (calc-set-simplify-mode): Default to 'alg. + (calc-default-simplify-mode): Make algebraic simplifications + the default. + + * calc/calc-ext.el (calc-init-extensions): Remove binding for + `calc-alg-simplify-mode'. Add binding for `calc-lim-simplify-mode'. + + * calc/README: Mention new default simplification mode. + * calc/calc.el (math-normalize-error): New variable. (math-normalize): Set `math-normalize-error' to t when there's an error. diff --git a/lisp/calc/README b/lisp/calc/README index e4b681d5625..b09ac6f79eb 100644 --- a/lisp/calc/README +++ b/lisp/calc/README @@ -70,6 +70,12 @@ opinions. Summary of changes to "Calc" ------- -- ------- -- ---- +Emacs 24.2 + +Algebraic simplification mode is now the default. +To restrict to the limited simplifications given by the former +default simplification mode, use `m L'. + Emacs 24.1 * Support for musical notes added. diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el index 818b19757be..883cc3dd939 100644 --- a/lisp/calc/calc-ext.el +++ b/lisp/calc/calc-ext.el @@ -454,12 +454,12 @@ (define-key calc-mode-map "mv" 'calc-matrix-mode) (define-key calc-mode-map "mw" 'calc-working) (define-key calc-mode-map "mx" 'calc-always-load-extensions) - (define-key calc-mode-map "mA" 'calc-alg-simplify-mode) (define-key calc-mode-map "mB" 'calc-bin-simplify-mode) (define-key calc-mode-map "mC" 'calc-auto-recompute) (define-key calc-mode-map "mD" 'calc-default-simplify-mode) (define-key calc-mode-map "mE" 'calc-ext-simplify-mode) (define-key calc-mode-map "mF" 'calc-settings-file-name) + (define-key calc-mode-map "mL" 'calc-lim-simplify-mode) (define-key calc-mode-map "mM" 'calc-more-recursion-depth) (define-key calc-mode-map "mN" 'calc-num-simplify-mode) (define-key calc-mode-map "mO" 'calc-no-simplify-mode) @@ -1093,7 +1093,7 @@ calc-pi calc-radians-mode calc-sec calc-sech calc-sin calc-sincos calc-sinh calc-sqrt calc-tan calc-tanh calc-to-degrees calc-to-radians) - ("calc-mode" calc-alg-simplify-mode calc-algebraic-mode + ("calc-mode" calc-lim-simplify-mode calc-algebraic-mode calc-always-load-extensions calc-auto-recompute calc-auto-why calc-bin-simplify-mode calc-break-vectors calc-center-justify calc-default-simplify-mode calc-display-raw calc-eng-notation diff --git a/lisp/calc/calc-mode.el b/lisp/calc/calc-mode.el index 3f583192bcf..28cb58656c0 100644 --- a/lisp/calc/calc-mode.el +++ b/lisp/calc/calc-mode.el @@ -504,7 +504,7 @@ mode))) (message "%s" (if (eq calc-simplify-mode mode) msg - "Default simplifications enabled"))) + "Default algebraic simplifications enabled"))) (defun calc-no-simplify-mode (arg) (interactive "P") @@ -519,15 +519,18 @@ "Default simplifications apply only if arguments are numeric"))) (defun calc-default-simplify-mode (arg) - (interactive "p") - (cond ((= arg 1) + (interactive "P") + (cond ((or (not arg) (= arg 3)) + (calc-wrapper + (calc-set-simplify-mode + 'alg nil "Default algebraic simplifications enabled"))) + ((= arg 1) (calc-wrapper (calc-set-simplify-mode - nil nil "Usual default simplifications are enabled"))) + nil nil "Limited simplifications occur by default"))) ((= arg 0) (calc-num-simplify-mode 1)) ((< arg 0) (calc-no-simplify-mode 1)) ((= arg 2) (calc-bin-simplify-mode 1)) - ((= arg 3) (calc-alg-simplify-mode 1)) ((= arg 4) (calc-ext-simplify-mode 1)) ((= arg 5) (calc-units-simplify-mode 1)) (t (error "Prefix argument out of range")))) @@ -539,11 +542,11 @@ (format "Binary simplification occurs by default (word size=%d)" calc-word-size)))) -(defun calc-alg-simplify-mode (arg) +(defun calc-lim-simplify-mode (arg) (interactive "P") (calc-wrapper - (calc-set-simplify-mode 'alg arg - "Algebraic simplification occurs by default"))) + (calc-set-simplify-mode nil arg + "Limited simplifications occur by default"))) (defun calc-ext-simplify-mode (arg) (interactive "P") diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index a149cfe7966..dd1efd014fb 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el @@ -698,11 +698,11 @@ If `C' is present, display outer brackets for matrices (centered).") (defcalcmodevar calc-previous-modulo nil "Most recently used value of M in a modulo form.") -(defcalcmodevar calc-simplify-mode nil +(defcalcmodevar calc-simplify-mode 'alg "Type of simplification applied to results. If `none', results are not simplified when pushed on the stack. If `num', functions are simplified only when args are constant. -If nil, only fast simplifications are applied. +If nil, only limited simplifications are applied. If `binary', `math-clip' is applied if appropriate. If `alg', `math-simplify' is applied. If `ext', `math-simplify-extended' is applied. @@ -1757,10 +1757,10 @@ See calc-keypad for details." ((eq calc-simplify-mode 'num) "NumSimp ") ((eq calc-simplify-mode 'binary) (format "BinSimp%d " calc-word-size)) - ((eq calc-simplify-mode 'alg) "AlgSimp ") + ((eq calc-simplify-mode 'alg) "") ((eq calc-simplify-mode 'ext) "ExtSimp ") ((eq calc-simplify-mode 'units) "UnitSimp ") - (t "")) + (t "LimSimp ")) ;; Display modes (cond ((= calc-number-radix 10) "") From 4b33740959019dc33dc7ce3795ddc0b1594ae589 Mon Sep 17 00:00:00 2001 From: Jay Belanger Date: Sun, 29 Jul 2012 18:25:39 -0500 Subject: [PATCH 63/89] calc/calc-help (calc-m-prefix-help): Change message. --- lisp/ChangeLog | 3 +++ lisp/calc/calc-help.el | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5434f9ed8ba..5b703837257 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -12,6 +12,9 @@ * calc/calc-ext.el (calc-init-extensions): Remove binding for `calc-alg-simplify-mode'. Add binding for `calc-lim-simplify-mode'. + * calc/calc-help (calc-m-prefix-help): Change messages to + indicate new simplification modes. + * calc/README: Mention new default simplification mode. * calc/calc.el (math-normalize-error): New variable. diff --git a/lisp/calc/calc-help.el b/lisp/calc/calc-help.el index 8ef917fb5f4..f48fae388d5 100644 --- a/lisp/calc/calc-help.el +++ b/lisp/calc/calc-help.el @@ -642,7 +642,7 @@ C-w Describe how there is no warranty for Calc." '("Deg, Rad, HMS; Frac; Polar; Inf; Alg, Total; Symb; Vec/mat" "Working; Xtensions; Mode-save; preserve Embedded modes" "SHIFT + Shifted-prefixes, mode-Filename; Record; reCompute" - "SHIFT + simplify: Off, Num, Default, Bin, Alg, Ext, Units") + "SHIFT + simplify: Off, Num, Limited, Default, Bin, Ext, Units") "mode" ?m)) From 4514c2522dc0d5a65698b5a2d397e53102b247eb Mon Sep 17 00:00:00 2001 From: Jay Belanger Date: Sun, 29 Jul 2012 21:32:57 -0500 Subject: [PATCH 64/89] calc/calc-mode.el (calc-alg-simplify-mode): Remove function. (calc-limited-simplify-mode): Renamed from calc-lim-simplify-mode. calc/calc-ext.el (calc-init-extensions): Fix bindings for `calc-limited-simplify-mode'. --- lisp/calc/calc-ext.el | 4 ++-- lisp/calc/calc-mode.el | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el index 883cc3dd939..954251f842b 100644 --- a/lisp/calc/calc-ext.el +++ b/lisp/calc/calc-ext.el @@ -459,7 +459,7 @@ (define-key calc-mode-map "mD" 'calc-default-simplify-mode) (define-key calc-mode-map "mE" 'calc-ext-simplify-mode) (define-key calc-mode-map "mF" 'calc-settings-file-name) - (define-key calc-mode-map "mL" 'calc-lim-simplify-mode) + (define-key calc-mode-map "mL" 'calc-limited-simplify-mode) (define-key calc-mode-map "mM" 'calc-more-recursion-depth) (define-key calc-mode-map "mN" 'calc-num-simplify-mode) (define-key calc-mode-map "mO" 'calc-no-simplify-mode) @@ -1093,7 +1093,7 @@ calc-pi calc-radians-mode calc-sec calc-sech calc-sin calc-sincos calc-sinh calc-sqrt calc-tan calc-tanh calc-to-degrees calc-to-radians) - ("calc-mode" calc-lim-simplify-mode calc-algebraic-mode + ("calc-mode" calc-limited-simplify-mode calc-algebraic-mode calc-always-load-extensions calc-auto-recompute calc-auto-why calc-bin-simplify-mode calc-break-vectors calc-center-justify calc-default-simplify-mode calc-display-raw calc-eng-notation diff --git a/lisp/calc/calc-mode.el b/lisp/calc/calc-mode.el index 28cb58656c0..8403d7f7de9 100644 --- a/lisp/calc/calc-mode.el +++ b/lisp/calc/calc-mode.el @@ -542,7 +542,7 @@ (format "Binary simplification occurs by default (word size=%d)" calc-word-size)))) -(defun calc-lim-simplify-mode (arg) +(defun calc-limited-simplify-mode (arg) (interactive "P") (calc-wrapper (calc-set-simplify-mode nil arg From d2bd74ff3e3f88027c4a7de0dcdb7dfb3e12716e Mon Sep 17 00:00:00 2001 From: Jay Belanger Date: Sun, 29 Jul 2012 22:38:24 -0500 Subject: [PATCH 65/89] doc/misc/calc.texi (Getting Started, Tutorial): Change simulated Calc output to match actual output. (Simplifying Formulas): Mention that algebraic simplification is now the default. --- doc/misc/ChangeLog | 7 + doc/misc/calc.texi | 415 +++++++++++++++++++++------------------------ 2 files changed, 201 insertions(+), 221 deletions(-) diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index fe7687424ca..d0f60c60234 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,10 @@ +2012-07-30 Jay Belanger + + * calc.texi (Getting Started, Tutorial): Change simulated + Calc output to match actual output. + (Simplifying Formulas): Mention that algebraic simplification is now + the default. + 2012-07-28 Eli Zaretskii * faq.texi (Right-to-left alphabets): Update for Emacs 24. diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi index fe11cedce5d..301866ad65c 100644 --- a/doc/misc/calc.texi +++ b/doc/misc/calc.texi @@ -910,12 +910,12 @@ The derivative of is -1 / ln(x) x +1 / x ln(x) @end group @end smallexample (Note that by default, Calc gives division lower precedence than multiplication, -so that @samp{1 / ln(x) x} is equivalent to @samp{1 / (ln(x) x)}.) +so that @samp{1 / x ln(x)} is equivalent to @samp{1 / (x ln(x))}.) To make this look nicer, you might want to press @kbd{d =} to center the formula, and even @kbd{d B} to use Big display mode. @@ -932,7 +932,7 @@ is 1 ------- - ln(x) x + x ln(x) @end group @end smallexample @@ -964,7 +964,9 @@ and keyboard will revert to the way they were before. The related command @kbd{C-x * w} operates on a single word, which generally means a single number, inside text. It searches for an expression which ``looks'' like a number containing the point. -Here's an example of its use: +Here's an example of its use (before you try this, remove the Calc +annotations or use a new buffer so that the extra settings in the +annotations don't take effect): @smallexample A slope of one-third corresponds to an angle of 1 degrees. @@ -1175,15 +1177,16 @@ turned out to be more open-ended than one might have expected. Emacs Lisp didn't have built-in floating point math (now it does), so this had to be simulated in software. In fact, Emacs integers would -only comfortably fit six decimal digits or so---not enough for a decent -calculator. So I had to write my own high-precision integer code as -well, and once I had this I figured that arbitrary-size integers were -just as easy as large integers. Arbitrary floating-point precision was -the logical next step. Also, since the large integer arithmetic was -there anyway it seemed only fair to give the user direct access to it, -which in turn made it practical to support fractions as well as floats. -All these features inspired me to look around for other data types that -might be worth having. +only comfortably fit six decimal digits or so (at the time)---not +enough for a decent calculator. So I had to write my own +high-precision integer code as well, and once I had this I figured +that arbitrary-size integers were just as easy as large integers. +Arbitrary floating-point precision was the logical next step. Also, +since the large integer arithmetic was there anyway it seemed only +fair to give the user direct access to it, which in turn made it +practical to support fractions as well as floats. All these features +inspired me to look around for other data types that might be worth +having. Around this time, my friend Rick Koshi showed me his nifty new HP-28 calculator. It allowed the user to manipulate formulas as well as @@ -1359,15 +1362,14 @@ to control various modes of the Calculator. @subsection RPN Calculations and the Stack @cindex RPN notation -@ifnottex @noindent +@ifnottex Calc normally uses RPN notation. You may be familiar with the RPN system from Hewlett-Packard calculators, FORTH, or PostScript. (Reverse Polish Notation, RPN, is named after the Polish mathematician Jan Lukasiewicz.) @end ifnottex @tex -\noindent Calc normally uses RPN notation. You may be familiar with the RPN system from Hewlett-Packard calculators, FORTH, or PostScript. (Reverse Polish Notation, RPN, is named after the Polish mathematician @@ -1473,7 +1475,7 @@ multiplication.) Figure it out by hand, then try it with Calc to see if you're right. @xref{RPN Answer 1, 1}. (@bullet{}) (@bullet{}) @strong{Exercise 2.} Compute -@texline @math{(2\times4) + (7\times9.4) + {5\over4}} +@texline @math{(2\times4) + (7\times9.5) + {5\over4}} @infoline @expr{2*4 + 7*9.5 + 5/4} using the stack. @xref{RPN Answer 2, 2}. (@bullet{}) @@ -1964,7 +1966,7 @@ values are left alone, even when you evaluate the formula. @smallexample @group -1: 2 a + 2 b 1: 34 + 2 b +1: 2 a + 2 b 1: 2 b + 34 . . ' 2a+2b @key{RET} = @@ -1976,7 +1978,7 @@ alone, as are calls for which the value is undefined. @smallexample @group -1: 2 + log10(0) + log10(x) + log10(5, 6) + foo(3) +1: log10(0) + log10(x) + log10(5, 6) + foo(3) + 2 . ' log10(100) + log10(0) + log10(x) + log10(5,6) + foo(3) @key{RET} @@ -4588,7 +4590,7 @@ that arises in the second one. @cindex Fermat, primality test of (@bullet{}) @strong{Exercise 10.} A theorem of Pierre de Fermat says that -@texline @w{@math{x^{n-1} \bmod n = 1}} +@texline @math{x^{n-1} \bmod n = 1} @infoline @expr{x^(n-1) mod n = 1} if @expr{n} is a prime number and @expr{x} is an integer less than @expr{n}. If @expr{n} is @emph{not} a prime number, this will @@ -4704,19 +4706,17 @@ for them. @smallexample @group -1: 20 degF 1: 11.1111 degC 1: -20:3 degC 1: -6.666 degC +1: 20 degF 1: 11.1111 degC 1: -6.666 degC . . . . - ' 20 degF @key{RET} u c degC @key{RET} U u t degC @key{RET} c f + ' 20 degF @key{RET} u c degC @key{RET} U u t degC @key{RET} @end group @end smallexample @noindent First we convert a change of 20 degrees Fahrenheit into an equivalent change in degrees Celsius (or Centigrade). Then, we convert the -absolute temperature 20 degrees Fahrenheit into Celsius. Since -this comes out as an exact fraction, we then convert to floating-point -for easier comparison with the other result. +absolute temperature 20 degrees Fahrenheit into Celsius. For simple unit conversions, you can put a plain number on the stack. Then @kbd{u c} and @kbd{u t} will prompt for both old and new units. @@ -4775,7 +4775,7 @@ formulas as regular data objects. @smallexample @group -1: 2 x^2 - 6 1: 6 - 2 x^2 1: (6 - 2 x^2) (3 x^2 + y) +1: 2 x^2 - 6 1: 6 - 2 x^2 1: (3 x^2 + y) (6 - 2 x^2) . . . ' 2x^2-6 @key{RET} n ' 3x^2+y @key{RET} * @@ -4791,7 +4791,7 @@ formulas. Continuing with the formula from the last example, @smallexample @group -1: 18 x^2 + 6 y - 6 x^4 - 2 x^2 y 1: (18 - 2 y) x^2 - 6 x^4 + 6 y +1: 18 x^2 - 6 x^4 + 6 y - 2 y x^2 1: (18 - 2 y) x^2 - 6 x^4 + 6 y . . a x a c x @key{RET} @@ -4849,17 +4849,17 @@ the other root(s), let's divide through by @expr{x} and then solve: @smallexample @group -1: (34 x - 24 x^3) / x 1: 34 x / x - 24 x^3 / x 1: 34 - 24 x^2 - . . . +1: (34 x - 24 x^3) / x 1: 34 - 24 x^2 + . . - ' x @key{RET} / a x a s + ' x @key{RET} / a x @end group @end smallexample @noindent @smallexample @group -1: 34 - 24 x^2 = 0 1: x = 1.19023 +1: 0.70588 x^2 = 1 1: x = 1.19023 . . 0 a = s 3 a S x @key{RET} @@ -4867,10 +4867,6 @@ the other root(s), let's divide through by @expr{x} and then solve: @end smallexample @noindent -Notice the use of @kbd{a s} to ``simplify'' the formula. When the -default algebraic simplifications don't do enough, you can use -@kbd{a s} to tell Calc to spend more time on the job. - Now we compute the second derivative and plug in our values of @expr{x}: @smallexample @@ -4905,7 +4901,7 @@ has a maximum value at @expr{x = 1.19023}. (The function also has a local @emph{minimum} at @expr{x = 0}.) When we solved for @expr{x}, we got only one value even though -@expr{34 - 24 x^2 = 0} is a quadratic equation that ought to have +@expr{0.70588 x^2 = 1} is a quadratic equation that ought to have two solutions. The reason is that @w{@kbd{a S}} normally returns a single ``principal'' solution. If it needs to come up with an arbitrary sign (as occurs in the quadratic formula) it picks @expr{+}. @@ -4914,7 +4910,7 @@ solution by pressing @kbd{H} (the Hyperbolic flag) before @kbd{a S}. @smallexample @group -1: 34 - 24 x^2 = 0 1: x = 1.19023 s1 1: x = -1.19023 +1: 0.70588 x^2 = 1 1: x = 1.19023 s1 1: x = -1.19023 . . . r 3 H a S x @key{RET} s 5 1 n s l s1 @key{RET} @@ -5135,7 +5131,7 @@ also have used plain @kbd{v x} as follows: @kbd{v x 10 @key{RET} 9 + .1 *}.) @smallexample @group 2: [1, 1.1, ... ] 1: [0., 0.084941, 0.16993, ... ] -1: sin(x) ln(x) . +1: ln(x) sin(x) . . ' sin(x) ln(x) @key{RET} s 1 m r p 5 @key{RET} V M $ @key{RET} @@ -5168,7 +5164,7 @@ we're not doing too well. Let's try another approach. @smallexample @group -1: sin(x) ln(x) 1: 0.84147 x - 0.84147 + 0.11957 (x - 1)^2 - ... +1: ln(x) sin(x) 1: 0.84147 x + 0.11957 (x - 1)^2 - ... . . r 1 a t x=1 @key{RET} 4 @key{RET} @@ -5277,61 +5273,44 @@ Suppose we want to simplify this trigonometric formula: @smallexample @group -1: 2 / cos(x)^2 - 2 tan(x)^2 +1: 2 sec(x)^2 / tan(x)^2 - 2 / tan(x)^2 . - ' 2/cos(x)^2 - 2tan(x)^2 @key{RET} s 1 + ' 2sec(x)^2/tan(x)^2 - 2/tan(x)^2 @key{RET} s 1 @end group @end smallexample @noindent -If we were simplifying this by hand, we'd probably replace the -@samp{tan} with a @samp{sin/cos} first, then combine over a common -denominator. The @kbd{I a s} command will do the former and the @kbd{a n} -algebra command will do the latter, but we'll do both with rewrite -rules just for practice. +If we were simplifying this by hand, we'd probably combine over the common +denominator. The @kbd{a n} algebra command will do this, but we'll do +it with a rewrite rule just for practice. Rewrite rules are written with the @samp{:=} symbol. @smallexample @group -1: 2 / cos(x)^2 - 2 sin(x)^2 / cos(x)^2 - . - - a r tan(a) := sin(a)/cos(a) @key{RET} -@end group -@end smallexample - -@noindent -(The ``assignment operator'' @samp{:=} has several uses in Calc. All -by itself the formula @samp{tan(a) := sin(a)/cos(a)} doesn't do anything, -but when it is given to the @kbd{a r} command, that command interprets -it as a rewrite rule.) - -The lefthand side, @samp{tan(a)}, is called the @dfn{pattern} of the -rewrite rule. Calc searches the formula on the stack for parts that -match the pattern. Variables in a rewrite pattern are called -@dfn{meta-variables}, and when matching the pattern each meta-variable -can match any sub-formula. Here, the meta-variable @samp{a} matched -the actual variable @samp{x}. - -When the pattern part of a rewrite rule matches a part of the formula, -that part is replaced by the righthand side with all the meta-variables -substituted with the things they matched. So the result is -@samp{sin(x) / cos(x)}. Calc's normal algebraic simplifications then -mix this in with the rest of the original formula. - -To merge over a common denominator, we can use another simple rule: - -@smallexample -@group -1: (2 - 2 sin(x)^2) / cos(x)^2 +1: (2 sec(x)^2 - 2) / tan(x)^2 . a r a/x + b/x := (a+b)/x @key{RET} @end group @end smallexample +@noindent +(The ``assignment operator'' @samp{:=} has several uses in Calc. All +by itself the formula @samp{a/x + b/x := (a+b)/x} doesn't do anything, +but when it is given to the @kbd{a r} command, that command interprets +it as a rewrite rule.) + +The lefthand side, @samp{a/x + b/x}, is called the @dfn{pattern} of the +rewrite rule. Calc searches the formula on the stack for parts that +match the pattern. Variables in a rewrite pattern are called +@dfn{meta-variables}, and when matching the pattern each meta-variable +can match any sub-formula. Here, the meta-variable @samp{a} matched +the expression @samp{2 sec(x)^2}, the meta-variable @samp{b} matched +the constant @samp{-2} and the meta-variable @samp{x} matched +the expression @samp{tan(x)^2}. + This rule points out several interesting features of rewrite patterns. First, if a meta-variable appears several times in a pattern, it must match the same thing everywhere. This rule detects common denominators @@ -5340,13 +5319,18 @@ denominators. Second, meta-variable names are independent from variables in the target formula. Notice that the meta-variable @samp{x} here matches -the subformula @samp{cos(x)^2}; Calc never confuses the two meanings of +the subformula @samp{tan(x)^2}; Calc never confuses the two meanings of @samp{x}. And third, rewrite patterns know a little bit about the algebraic properties of formulas. The pattern called for a sum of two quotients; Calc was able to match a difference of two quotients by matching -@samp{a = 2}, @samp{b = -2 sin(x)^2}, and @samp{x = cos(x)^2}. +@samp{a = 2 sec(x)^2}, @samp{b = -2}, and @samp{x = tan(x)^2}. + +When the pattern part of a rewrite rule matches a part of the formula, +that part is replaced by the righthand side with all the meta-variables +substituted with the things they matched. So the result is +@samp{(2 sec(x)^2 - 2) / tan(x)^2}. @c [fix-ref Algebraic Properties of Rewrite Rules] We could just as easily have written @samp{a/x - b/x := (a-b)/x} for @@ -5356,19 +5340,19 @@ we could have used the @code{plain} symbol. @xref{Algebraic Properties of Rewrite Rules}, for some examples of this.) One more rewrite will complete the job. We want to use the identity -@samp{sin(x)^2 + cos(x)^2 = 1}, but of course we must first rearrange +@samp{tan(x)^2 + 1 = sec(x)^2}, but of course we must first rearrange the identity in a way that matches our formula. The obvious rule -would be @samp{@w{2 - 2 sin(x)^2} := 2 cos(x)^2}, but a little thought shows -that the rule @samp{sin(x)^2 := 1 - cos(x)^2} will also work. The +would be @samp{@w{2 sec(x)^2 - 2} := 2 tan(x)^2}, but a little thought shows +that the rule @samp{sec(x)^2 := 1 + tan(x)^2} will also work. The latter rule has a more general pattern so it will work in many other situations, too. @smallexample @group -1: (2 + 2 cos(x)^2 - 2) / cos(x)^2 1: 2 - . . +1: 2 + . - a r sin(x)^2 := 1 - cos(x)^2 @key{RET} a s + a r sec(x)^2 := 1 + tan(x)^2 @key{RET} @end group @end smallexample @@ -5383,14 +5367,13 @@ having to retype it. @smallexample @group -' tan(x) := sin(x)/cos(x) @key{RET} s t tsc @key{RET} -' a/x + b/x := (a+b)/x @key{RET} s t merge @key{RET} -' sin(x)^2 := 1 - cos(x)^2 @key{RET} s t sinsqr @key{RET} +' a/x + b/x := (a+b)/x @key{RET} s t merge @key{RET} +' sec(x)^2 := 1 + tan(x)^2 @key{RET} s t secsqr @key{RET} -1: 2 / cos(x)^2 - 2 tan(x)^2 1: 2 +1: 2 sec(x)^2 / tan(x)^2 - 2 / tan(x)^2 1: 2 . . - r 1 a r tsc @key{RET} a r merge @key{RET} a r sinsqr @key{RET} a s + r 1 a r merge @key{RET} a r secsqr @key{RET} @end group @end smallexample @@ -5420,20 +5403,20 @@ a variable containing a vector of rules. @smallexample @group -1: [tsc, merge, sinsqr] 1: [tan(x) := sin(x) / cos(x), ... ] +1: [merge, secsqr] 1: [a/x + b/x := (a + b)/x, ... ] . . - ' [tsc,merge,sinsqr] @key{RET} = + ' [merge,sinsqr] @key{RET} = @end group @end smallexample @noindent @smallexample @group -1: 1 / cos(x) - sin(x) tan(x) 1: cos(x) +1: 2 sec(x)^2 / tan(x)^2 - 2 / tan(x)^2 1: 2 . . - s t trig @key{RET} r 1 a r trig @key{RET} a s + s t trig @key{RET} r 1 a r trig @key{RET} @end group @end smallexample @@ -5451,10 +5434,10 @@ only one rewrite at a time. @smallexample @group -1: 1 / cos(x) - sin(x)^2 / cos(x) 1: (1 - sin(x)^2) / cos(x) - . . +1: (2 sec(x)^2 - 2) / tan(x)^2 1: 2 + . . - r 1 M-1 a r trig @key{RET} M-1 a r trig @key{RET} + r 1 M-1 a r trig @key{RET} M-1 a r trig @key{RET} @end group @end smallexample @@ -5466,20 +5449,20 @@ with a @samp{::} symbol and the desired condition. For example, @smallexample @group -1: exp(2 pi i) + exp(3 pi i) + exp(4 pi i) +1: sin(x + 2 pi) + sin(x + 3 pi) + sin(x + 4 pi) . - ' exp(2 pi i) + exp(3 pi i) + exp(4 pi i) @key{RET} + ' sin(x+2pi) + sin(x+3pi) + sin(x+4pi) @key{RET} @end group @end smallexample @noindent @smallexample @group -1: 1 + exp(3 pi i) + 1 +1: sin(x + 3 pi) + 2 sin(x) . - a r exp(k pi i) := 1 :: k % 2 = 0 @key{RET} + a r sin(a + k pi) := sin(a) :: k % 2 = 0 @key{RET} @end group @end smallexample @@ -5487,10 +5470,10 @@ with a @samp{::} symbol and the desired condition. For example, (Recall, @samp{k % 2} is the remainder from dividing @samp{k} by 2, which will be zero only when @samp{k} is an even integer.) -An interesting point is that the variables @samp{pi} and @samp{i} -were matched literally rather than acting as meta-variables. -This is because they are special-constant variables. The special -constants @samp{e}, @samp{phi}, and so on also match literally. +An interesting point is that the variable @samp{pi} was matched +literally rather than acting as a meta-variable. +This is because it is a special-constant variable. The special +constants @samp{e}, @samp{i}, @samp{phi}, and so on also match literally. A common error with rewrite rules is to write, say, @samp{f(a,b,c,d,e) := g(a+b+c+d+e)}, expecting to match any @samp{f} with five arguments but in fact matching @@ -5541,7 +5524,7 @@ Now: @smallexample @group -1: fib(6) + fib(x) + fib(0) 1: 8 + fib(x) + fib(0) +1: fib(6) + fib(x) + fib(0) 1: fib(x) + fib(0) + 8 . . ' fib(6)+fib(x)+fib(0) @key{RET} a r fib @key{RET} @@ -5707,10 +5690,10 @@ power series represented as @samp{@var{polynomial} + O(@var{var}^@var{n})}. For example, given @samp{1 - x^2 / 2 + O(x^3)} and @samp{x - x^3 / 6 + O(x^4)} on the stack, we want to be able to type @kbd{*} and get the result @samp{x - 2:3 x^3 + O(x^4)}. Don't worry if the terms of the sum are -rearranged or if @kbd{a s} needs to be typed after rewriting. (This one -is rather tricky; the solution at the end of this chapter uses 6 rewrite -rules. Hint: The @samp{constant(x)} condition tests whether @samp{x} is -a number.) @xref{Rewrites Answer 6, 6}. (@bullet{}) +rearranged. (This one is rather tricky; the solution at the end of +this chapter uses 6 rewrite rules. Hint: The @samp{constant(x)} +condition tests whether @samp{x} is a number.) @xref{Rewrites Answer +6, 6}. (@bullet{}) Just for kicks, try adding the rule @code{2+3 := 6} to @code{EvalRules}. What happens? (Be sure to remove this rule afterward, or you might get @@ -5737,7 +5720,7 @@ case @kbd{z} prefix. @smallexample @group -1: 1 + x + x^2 / 2 + x^3 / 6 1: 1 + x + x^2 / 2 + x^3 / 6 +1: x + x^2 / 2 + x^3 / 6 + 1 1: x + x^2 / 2 + x^3 / 6 + 1 . . ' 1 + x + x^2/2! + x^3/3! @key{RET} Z F e myexp @key{RET} @key{RET} @key{RET} y @@ -5808,7 +5791,7 @@ you may wish to program a keyboard macro to type this for you. ' y=sqrt(x) @key{RET} C-x ( H a S x @key{RET} C-x ) -1: y = cos(x) 1: x = s1 arccos(y) + 2 pi n1 +1: y = cos(x) 1: x = s1 arccos(y) + 2 n1 pi . . ' y=cos(x) @key{RET} X @@ -6874,7 +6857,7 @@ matrix as usual. @smallexample @group -1: [6, 10] 2: [6, 10] 1: [6 - 4 a / (b - a), 4 / (b - a) ] +1: [6, 10] 2: [6, 10] 1: [4 a / (a - b) + 6, 4 / (b - a) ] . 1: [ [ 1, a ] . [ 1, b ] ] . @@ -6888,9 +6871,9 @@ mode: @smallexample @group - 4 a 4 -1: [6 - -----, -----] - b - a b - a + 4 a 4 +1: [----- + 6, -----] + a - b b - a @end group @end smallexample @@ -8442,11 +8425,11 @@ to the other? @smallexample @group -1: 3.3356 ns 1: 0.81356 ns / ns 1: 0.81356 -2: 4.1 ns . . +1: 3.3356 ns 1: 0.81356 +2: 4.1 ns . . - ' 4.1 ns @key{RET} / u s + ' 4.1 ns @key{RET} / @end group @end smallexample @@ -8523,7 +8506,7 @@ familiar form. @noindent @smallexample @group -1: [x - 1.19023, x + 1.19023, x] 1: (x - 1.19023) (x + 1.19023) x +1: [x - 1.19023, x + 1.19023, x] 1: x*(x + 1.19023) (x - 1.19023) . . V M ' x-$ @key{RET} V R * @@ -8549,7 +8532,7 @@ same as the original polynomial. @smallexample @group -1: x sin(pi x) 1: (sin(pi x) - pi x cos(pi x)) / pi^2 +1: x sin(pi x) 1: sin(pi x) / pi^2 - x cos(pi x) / pi . . ' x sin(pi x) @key{RET} m r a i x @key{RET} @@ -8560,7 +8543,7 @@ same as the original polynomial. @smallexample @group 1: [y, 1] -2: (sin(pi x) - pi x cos(pi x)) / pi^2 +2: sin(pi x) / pi^2 - x cos(pi x) / pi . ' [y,1] @key{RET} @key{TAB} @@ -8570,7 +8553,7 @@ same as the original polynomial. @noindent @smallexample @group -1: [(sin(pi y) - pi y cos(pi y)) / pi^2, (sin(pi) - pi cos(pi)) / pi^2] +1: [sin(pi y) / pi^2 - y cos(pi y) / pi, 1 / pi] . V M $ @key{RET} @@ -8580,7 +8563,7 @@ same as the original polynomial. @noindent @smallexample @group -1: (sin(pi y) - pi y cos(pi y)) / pi^2 + (pi cos(pi) - sin(pi)) / pi^2 +1: sin(pi y) / pi^2 - y cos(pi y) / pi - 1 / pi . V R - @@ -8590,7 +8573,7 @@ same as the original polynomial. @noindent @smallexample @group -1: (sin(3.14159 y) - 3.14159 y cos(3.14159 y)) / 9.8696 - 0.3183 +1: sin(3.14159 y) / 9.8696 - y cos(3.14159 y) / 3.14159 - 0.3183 . = @@ -8685,11 +8668,11 @@ We'll use Big mode to make the formulas more readable. @smallexample @group - ___ - 2 + V 2 -1: (2 + sqrt(2)) / (1 + sqrt(2)) 1: -------- - . ___ - 1 + V 2 + ___ + V 2 + 2 +1: (2 + sqrt(2)) / (1 + sqrt(2)) 1: --------- + . ___ + V 2 + 1 . @@ -8713,11 +8696,11 @@ Multiplying by the conjugate helps because @expr{(a+b) (a-b) = a^2 - b^2}. @noindent @smallexample @group - ___ ___ -1: 2 + V 2 - 2 1: V 2 - . . + ___ +1: V 2 + . - a r a*(b+c) := a*b + a*c a s + a r a*(b+c) := a*b + a*c @end group @end smallexample @@ -12601,7 +12584,11 @@ followed by a shifted letter. The @kbd{m O} (@code{calc-no-simplify-mode}) command turns off all optional simplifications. These would leave a formula like @expr{2+3} alone. In fact, nothing except simple numbers are ever affected by normalization -in this mode. +in this mode. Explicit simplification commands, such as @kbd{=} or +@kbd{a s}, can still be given to simplify any formulas. +@xref{Algebraic Definitions}, for a sample use of +No-Simplification mode. + @kindex m N @pindex calc-num-simplify-mode @@ -12616,29 +12603,27 @@ A constant is a number or other numeric object (such as a constant error form or modulo form), or a vector all of whose elements are constant. -@kindex m D -@pindex calc-default-simplify-mode -The @kbd{m D} (@code{calc-default-simplify-mode}) command restores the -default simplifications for all formulas. This includes many easy and +@kindex m L +@pindex calc-limited-simplify-mode +The @kbd{m L} (@code{calc-limited-simplify-mode}) command does limited +simplifications for all formulas. This includes many easy and fast algebraic simplifications such as @expr{a+0} to @expr{a}, and @expr{a + 2 a} to @expr{3 a}, as well as evaluating functions like @expr{@tfn{deriv}(x^2, x)} to @expr{2 x}. @kindex m B @pindex calc-bin-simplify-mode -The @kbd{m B} (@code{calc-bin-simplify-mode}) mode applies the default +The @kbd{m B} (@code{calc-bin-simplify-mode}) mode applies the limited simplifications to a result and then, if the result is an integer, uses the @kbd{b c} (@code{calc-clip}) command to clip the integer according to the current binary word size. @xref{Binary Functions}. Real numbers are rounded to the nearest integer and then clipped; other kinds of results (after the default simplifications) are left alone. -@kindex m A -@pindex calc-alg-simplify-mode -The @kbd{m A} (@code{calc-alg-simplify-mode}) mode does algebraic -simplification; it applies all the default simplifications, and also -the more powerful (and slower) simplifications made by @kbd{a s} -(@code{calc-simplify}). @xref{Algebraic Simplifications}. +@kindex m D +@pindex calc-default-simplify-mode +The @kbd{m D} (@code{calc-default-simplify-mode}) mode does standard +algebraic simplifications. @xref{Algebraic Simplifications}. @kindex m E @pindex calc-ext-simplify-mode @@ -12658,9 +12643,7 @@ are simplified with their unit definitions in mind. A common technique is to set the simplification mode down to the lowest amount of simplification you will allow to be applied automatically, then use manual commands like @kbd{a s} and @kbd{c c} (@code{calc-clean}) to -perform higher types of simplifications on demand. @xref{Algebraic -Definitions}, for another sample use of No-Simplification mode. - +perform higher types of simplifications on demand. @node Declarations, Display Modes, Simplification Modes, Mode Settings @section Declarations @@ -15893,8 +15876,8 @@ Default simplifications for numeric arguments only (@kbd{m N}). @item BinSimp@var{w} Binary-integer simplification mode; word size @var{w} (@kbd{m B}, @kbd{b w}). -@item AlgSimp -Algebraic simplification mode (@kbd{m A}). +@item LimSimp +Limited simplification mode (@kbd{m L}). @item ExtSimp Extended algebraic simplification mode (@kbd{m E}). @@ -16733,9 +16716,9 @@ produced!) Integers and fractions are generally unaffected by this operation. Vectors and formulas are cleaned by cleaning each component number (i.e., pervasively). -If the simplification mode is set below the default level, it is raised -to the default level for the purposes of this command. Thus, @kbd{c c} -applies the default simplifications even if their automatic application +If the simplification mode is set below the limited level, it is raised +to the limited level for the purposes of this command. Thus, @kbd{c c} +applies the limited simplifications even if their automatic application is disabled. @xref{Simplification Modes}. @cindex Roundoff errors, correcting @@ -18336,7 +18319,7 @@ of the current angular mode. @xref{Basic Operations on Units}. Also, the symbolic variable @code{pi} is not ordinarily recognized in arguments to trigonometric functions, as in @samp{sin(3 pi / 4)}, but -the @kbd{a s} (@code{calc-simplify}) command recognizes many such +the default algebraic simplifications recognize many such formulas when the current angular mode is Radians @emph{and} Symbolic mode is enabled; this example would be replaced by @samp{sqrt(2) / 2}. @xref{Symbolic Mode}. Beware, this simplification occurs even if you @@ -22075,8 +22058,8 @@ as well as equations. @pindex calc-sel-div-both-sides The @kbd{j *} (@code{calc-sel-mult-both-sides}) command prompts for a formula using algebraic entry, then multiplies both sides of the -selected quotient or equation by that formula. It simplifies each -side with @kbd{a s} (@code{calc-simplify}) before re-forming the +selected quotient or equation by that formula. It performs the +default algebraic simplifications before re-forming the quotient or equation. You can suppress this simplification by providing a prefix argument: @kbd{C-u j *}. There is also a @kbd{j /} (@code{calc-sel-div-both-sides}) which is similar to @kbd{j *} but @@ -22143,15 +22126,15 @@ now to take the cosine of the selected part.) @kindex j v @pindex calc-sel-evaluate The @kbd{j v} (@code{calc-sel-evaluate}) command performs the -normal default simplifications on the selected sub-formula. -These are the simplifications that are normally done automatically -on all results, but which may have been partially inhibited by +limited simplifications on the selected sub-formula. +These simplifications would normally be done automatically +on all results, but may have been partially inhibited by previous selection-related operations, or turned off altogether by the @kbd{m O} command. This command is just an auto-selecting version of the @w{@kbd{a v}} command (@pxref{Algebraic Manipulation}). With a numeric prefix argument of 2, @kbd{C-u 2 j v} applies -the @kbd{a s} (@code{calc-simplify}) command to the selected +the default algebraic simplifications to the selected sub-formula. With a prefix argument of 3 or more, e.g., @kbd{C-u j v} applies the @kbd{a e} (@code{calc-simplify-extended}) command. @xref{Simplifying Formulas}. With a negative prefix argument @@ -22340,15 +22323,8 @@ turn the default simplifications off first (with @kbd{m O}). @kindex H a s @pindex calc-simplify @tindex simplify -The @kbd{a s} (@code{calc-simplify}) [@code{simplify}] command applies -various algebraic rules to simplify a formula. This includes rules which -are not part of the default simplifications because they may be too slow -to apply all the time, or may not be desirable all of the time. For -example, non-adjacent terms of sums are combined, as in @samp{a + b + 2 a} -to @samp{b + 3 a}, and some formulas like @samp{sin(arcsin(x))} are -simplified to @samp{x}. -The sections below describe all the various kinds of algebraic +The sections below describe all the various kinds of simplifications Calc provides in full detail. None of Calc's simplification commands are designed to pull rabbits out of hats; they simply apply certain specific rules to put formulas into @@ -22358,8 +22334,10 @@ and rewrite rules. @xref{Rearranging with Selections}. @xref{Rewrite Rules}. @xref{Simplification Modes}, for commands to control what level of -simplification occurs automatically. Normally only the ``default -simplifications'' occur. +simplification occurs automatically. Normally only the default +algebraic simplifications occur. If you have turned on a +simplification mode which does not do these default simplifications, +you can still perform them on a formula with the @kbd{a s} command. There are some simplifications that, while sometimes useful, are never done automatically. For example, the @kbd{I} prefix can be given to @@ -22379,29 +22357,23 @@ combinations of @samp{sinh}s and @samp{cosh}s before simplifying. @menu -* Default Simplifications:: +* Limited Simplifications:: * Algebraic Simplifications:: * Unsafe Simplifications:: * Simplification of Units:: @end menu -@node Default Simplifications, Algebraic Simplifications, Simplifying Formulas, Simplifying Formulas -@subsection Default Simplifications +@node Limited Simplifications, Algebraic Simplifications, Simplifying Formulas, Simplifying Formulas +@subsection Limited Simplifications @noindent -@cindex Default simplifications -This section describes the ``default simplifications,'' those which are -normally applied to all results. For example, if you enter the variable -@expr{x} on the stack twice and push @kbd{+}, Calc's default -simplifications automatically change @expr{x + x} to @expr{2 x}. +@cindex Limited simplifications +This section describes a limited set of simplifications. These, as +well as those described in the next section, are normally applied to +all results. You can type @kbd{m L} to restrict the simplifications +done on the stack to this limited set. -The @kbd{m O} command turns off the default simplifications, so that -@expr{x + x} will remain in this form unless you give an explicit -``simplify'' command like @kbd{=} or @kbd{a v}. @xref{Algebraic -Manipulation}. The @kbd{m D} command turns the default simplifications -back on. - -The most basic default simplification is the evaluation of functions. +The most basic simplification is the evaluation of functions. For example, @expr{2 + 3} is evaluated to @expr{5}, and @expr{@tfn{sqrt}(9)} is evaluated to @expr{3}. Evaluation does not occur if the arguments to a function are somehow of the wrong type @expr{@tfn{tan}([2,3,4])}), @@ -22419,16 +22391,17 @@ operator) do not evaluate their arguments, @code{if} (the @code{? :} operator) does not evaluate all of its arguments, and @code{evalto} does not evaluate its lefthand argument. -Most commands apply the default simplifications to all arguments they -take from the stack, perform a particular operation, then simplify -the result before pushing it back on the stack. In the common special -case of regular arithmetic commands like @kbd{+} and @kbd{Q} [@code{sqrt}], -the arguments are simply popped from the stack and collected into a -suitable function call, which is then simplified (the arguments being -simplified first as part of the process, as described above). +Most commands apply at least these limited simplifications to all +arguments they take from the stack, perform a particular operation, +then simplify the result before pushing it back on the stack. In the +common special case of regular arithmetic commands like @kbd{+} and +@kbd{Q} [@code{sqrt}], the arguments are simply popped from the stack +and collected into a suitable function call, which is then simplified +(the arguments being simplified first as part of the process, as +described above). -The default simplifications are too numerous to describe completely -here, but this section will describe the ones that apply to the +Even the limited set of simplifications are too numerous to describe +completely here, but this section will describe the ones that apply to the major arithmetic operators. This list will be rather technical in nature, and will probably be interesting to you only if you are a serious user of Calc's algebra facilities. @@ -22446,7 +22419,7 @@ will also be applied before any built-in default simplifications. \bigskip @end tex -And now, on with the default simplifications: +And now, on with the limited set of simplifications: Arithmetic operators like @kbd{+} and @kbd{*} always take two arguments in Calc's internal form. Sums and products of three or @@ -22720,29 +22693,29 @@ Most other Calc functions have few if any default simplifications defined, aside of course from evaluation when the arguments are suitable numbers. -@node Algebraic Simplifications, Unsafe Simplifications, Default Simplifications, Simplifying Formulas +@node Algebraic Simplifications, Unsafe Simplifications, Limited Simplifications, Simplifying Formulas @subsection Algebraic Simplifications @noindent @cindex Algebraic simplifications -The @kbd{a s} command makes simplifications that may be too slow to -do all the time, or that may not be desirable all of the time. -If you find these simplifications are worthwhile, you can type -@kbd{m A} to have Calc apply them automatically. - +@kindex a s +@kindex I a s +@kindex H a s +@pindex calc-simplify +@tindex simplify This section describes all simplifications that are performed by -the @kbd{a s} command. Note that these occur in addition to the -default simplifications; even if the default simplifications have -been turned off by an @kbd{m O} command, @kbd{a s} will turn them -back on temporarily while it simplifies the formula. +the default algebraic simplification mode. If you have switched to a different +simplification mode, you can switch back with the @kbd{m D} command. +Even in other simplification modes, the @kbd{a s} command will use +these algebraic simplifications to simplifies the formula. There is a variable, @code{AlgSimpRules}, in which you can put rewrites -to be applied by @kbd{a s}. Its use is analogous to @code{EvalRules}, +to be applied. Its use is analogous to @code{EvalRules}, but without the special restrictions. Basically, the simplifier does @samp{@w{a r} AlgSimpRules} with an infinite repeat count on the whole expression being simplified, then it traverses the expression applying the built-in rules described below. If the result is different from -the original expression, the process repeats with the default +the original expression, the process repeats with the limited simplifications (including @code{EvalRules}), then @code{AlgSimpRules}, then the built-in simplifications, and so on. @@ -22767,11 +22740,11 @@ non-adjacent ones. Products are sorted into a canonical order using the commutative law. For example, @expr{b c a} is commuted to @expr{a b c}. -This allows easier comparison of products; for example, the default +This allows easier comparison of products; for example, the limited simplifications will not change @expr{x y + y x} to @expr{2 x y}, -but @kbd{a s} will; it first rewrites the sum to @expr{x y + x y}, -and then the default simplifications are able to recognize a sum -of identical terms. +but the algebraic simplifications; it first rewrites the sum to +@expr{x y + x y} which can then be recognized as a sum of identical +terms. The canonical ordering used to sort terms of products has the property that real-valued numbers, interval forms and infinities @@ -22813,10 +22786,11 @@ as described above.) If there is any common integer or fractional factor in the numerator and denominator, it is canceled out; for example, @expr{(4 x + 6) / 8 x} simplifies to @expr{(2 x + 3) / 4 x}. -Non-constant common factors are not found even by @kbd{a s}. To -cancel the factor @expr{a} in @expr{(a x + a) / a^2} you could first -use @kbd{j M} on the product @expr{a x} to Merge the numerator to -@expr{a (1+x)}, which can then be simplified successfully. +Non-constant common factors are not found even by algebraic +simplifications. To cancel the factor @expr{a} in +@expr{(a x + a) / a^2} you could first use @kbd{j M} on the product +@expr{a x} to Merge the numerator to @expr{a (1+x)}, which can then be +simplified successfully. @tex \bigskip @@ -22825,11 +22799,10 @@ use @kbd{j M} on the product @expr{a x} to Merge the numerator to Integer powers of the variable @code{i} are simplified according to the identity @expr{i^2 = -1}. If you store a new value other than the complex number @expr{(0,1)} in @code{i}, this simplification -will no longer occur. This is done by @kbd{a s} instead of by default -in case someone (unwisely) uses the name @code{i} for a variable -unrelated to complex numbers; it would be unfortunate if Calc -quietly and automatically changed this formula for reasons the -user might not have been thinking of. +will no longer occur. This is not done by the limited +simplifications; in case someone (unwisely) wants to use the name +@code{i} for a variable unrelated to complex numbers, they can use +limited simplifications. Square roots of integer or rational arguments are simplified in several ways. (Note that these will be left unevaluated only in @@ -28800,7 +28773,7 @@ Edit @code{AlgSimpRules}. @xref{Algebraic Simplifications}. @item s D Edit @code{Decls}. @xref{Declarations}. @item s E -Edit @code{EvalRules}. @xref{Default Simplifications}. +Edit @code{EvalRules}. @xref{Limited Simplifications}. @item s F Edit @code{FitRules}. @xref{Curve Fitting}. @item s G From e499d0eebc7d8c12b42b2aa5392ce747ca3619ea Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Mon, 30 Jul 2012 08:02:39 +0400 Subject: [PATCH 66/89] Cleanup string bytes checking. * alloc.c (GC_STRING_BYTES, CHECK_STRING_BYTES): Remove. Convert all users to STRING_BYTES or string_bytes if GC_CHECK_STRING_BYTES. (check_string_bytes): Define to empty if not GC_CHECK_STRING_BYTES. (check_sblock, compact_small_strings): Simplify. --- src/ChangeLog | 8 +++++++ src/alloc.c | 65 +++++++++++++++++---------------------------------- 2 files changed, 29 insertions(+), 44 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 3d490df4fe9..6f3c0fc0913 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2012-07-30 Dmitry Antipov + + Cleanup string bytes checking. + * alloc.c (GC_STRING_BYTES, CHECK_STRING_BYTES): Remove. Convert + all users to STRING_BYTES or string_bytes if GC_CHECK_STRING_BYTES. + (check_string_bytes): Define to empty if not GC_CHECK_STRING_BYTES. + (check_sblock, compact_small_strings): Simplify. + 2012-07-29 Paul Eggert * lisp.h (LISP_INT_TAG, LISP_INT1_TAG, LISP_STRING_TAG): Remove. diff --git a/src/alloc.c b/src/alloc.c index f6f656fffa3..cb375f5432d 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -150,12 +150,6 @@ static pthread_mutex_t alloc_mutex; #define VECTOR_UNMARK(V) ((V)->header.size &= ~ARRAY_MARK_FLAG) #define VECTOR_MARKED_P(V) (((V)->header.size & ARRAY_MARK_FLAG) != 0) -/* Value is the number of bytes of S, a pointer to a struct Lisp_String. - Be careful during GC, because S->size contains the mark bit for - strings. */ - -#define GC_STRING_BYTES(S) (STRING_BYTES (S)) - /* Default value of gc_cons_threshold (see below). */ #define GC_DEFAULT_THRESHOLD (100000 * sizeof (Lisp_Object)) @@ -1802,10 +1796,8 @@ init_strings (void) static int check_string_bytes_count; -#define CHECK_STRING_BYTES(S) STRING_BYTES (S) - - -/* Like GC_STRING_BYTES, but with debugging check. */ +/* Like STRING_BYTES, but with debugging check. Can be + called during GC, so pay attention to the mark bit. */ ptrdiff_t string_bytes (struct Lisp_String *s) @@ -1837,15 +1829,8 @@ check_sblock (struct sblock *b) /* Check that the string size recorded in the string is the same as the one recorded in the sdata structure. */ - if (from->string) - CHECK_STRING_BYTES (from->string); - - if (from->string) - nbytes = GC_STRING_BYTES (from->string); - else - nbytes = SDATA_NBYTES (from); - - nbytes = SDATA_SIZE (nbytes); + nbytes = SDATA_SIZE (from->string ? string_bytes (from->string) + : SDATA_NBYTES (from)); from_end = (struct sdata *) ((char *) from + nbytes + GC_STRING_EXTRA); } } @@ -1866,7 +1851,7 @@ check_string_bytes (int all_p) { struct Lisp_String *s = b->first_data.string; if (s) - CHECK_STRING_BYTES (s); + string_bytes (s); } for (b = oldest_sblock; b; b = b->next) @@ -1876,6 +1861,10 @@ check_string_bytes (int all_p) check_sblock (current_sblock); } +#else /* not GC_CHECK_STRING_BYTES */ + +#define check_string_bytes(all) ((void) 0) + #endif /* GC_CHECK_STRING_BYTES */ #ifdef GC_CHECK_STRING_FREE_LIST @@ -1987,7 +1976,7 @@ allocate_string_data (struct Lisp_String *s, if (s->data) { old_data = SDATA_OF_STRING (s); - old_nbytes = GC_STRING_BYTES (s); + old_nbytes = STRING_BYTES (s); } else old_data = NULL; @@ -2121,10 +2110,10 @@ sweep_strings (void) how large that is. Reset the sdata's string back-pointer so that we know it's free. */ #ifdef GC_CHECK_STRING_BYTES - if (GC_STRING_BYTES (s) != SDATA_NBYTES (data)) + if (string_bytes (s) != SDATA_NBYTES (data)) abort (); #else - data->u.nbytes = GC_STRING_BYTES (s); + data->u.nbytes = STRING_BYTES (s); #endif data->string = NULL; @@ -2227,22 +2216,17 @@ compact_small_strings (void) /* Compute the next FROM here because copying below may overwrite data we need to compute it. */ ptrdiff_t nbytes; + struct Lisp_String *s = from->string; #ifdef GC_CHECK_STRING_BYTES /* Check that the string size recorded in the string is the same as the one recorded in the sdata structure. */ - if (from->string - && GC_STRING_BYTES (from->string) != SDATA_NBYTES (from)) + if (s && string_bytes (s) != SDATA_NBYTES (from)) abort (); #endif /* GC_CHECK_STRING_BYTES */ - if (from->string) - nbytes = GC_STRING_BYTES (from->string); - else - nbytes = SDATA_NBYTES (from); - - if (nbytes > LARGE_STRING_BYTES) - abort (); + nbytes = s ? STRING_BYTES (s) : SDATA_NBYTES (from); + eassert (nbytes <= LARGE_STRING_BYTES); nbytes = SDATA_SIZE (nbytes); from_end = (struct sdata *) ((char *) from + nbytes + GC_STRING_EXTRA); @@ -2254,8 +2238,8 @@ compact_small_strings (void) abort (); #endif - /* FROM->string non-null means it's alive. Copy its data. */ - if (from->string) + /* Non-NULL S means it's alive. Copy its data. */ + if (s) { /* If TB is full, proceed with the next sblock. */ to_end = (struct sdata *) ((char *) to + nbytes + GC_STRING_EXTRA); @@ -5955,7 +5939,7 @@ mark_object (Lisp_Object arg) #ifdef GC_CHECK_STRING_BYTES /* Check that the string size recorded in the string is the same as the one recorded in the sdata structure. */ - CHECK_STRING_BYTES (ptr); + string_bytes (ptr); #endif /* GC_CHECK_STRING_BYTES */ } break; @@ -6294,10 +6278,7 @@ gc_sweep (void) sweep_weak_hash_tables (); sweep_strings (); -#ifdef GC_CHECK_STRING_BYTES - if (!noninteractive) - check_string_bytes (1); -#endif + check_string_bytes (!noninteractive); /* Put all unmarked conses on free list */ { @@ -6617,11 +6598,7 @@ gc_sweep (void) } sweep_vectors (); - -#ifdef GC_CHECK_STRING_BYTES - if (!noninteractive) - check_string_bytes (1); -#endif + check_string_bytes (!noninteractive); } From 03a660a609328ce854721de7ba403f6725ab4ace Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 29 Jul 2012 22:41:10 -0700 Subject: [PATCH 67/89] Export to GDB most of lisp.h's remaining object-like macros. * lisp.h (min, max): Move earlier, because they're used earlier now. (INTMASK, ARRAY_MARK_FLAG, PSEUDOVECTOR_FLAG, VALMASK) (CHAR_TABLE_STANDARD_SLOTS, CHARTAB_SIZE_BITS_0) (CHARTAB_SIZE_BITS_1, CHARTAB_SIZE_BITS_2, CHARTAB_SIZE_BITS_3) (DEFAULT_HASH_SIZE, COMPILED_ARGLIST, COMPILED_BYTECODE) (COMPILED_CONSTANTS, COMPILED_STACK_DEPTH, COMPILED_DOC_STRING) (COMPILED_INTERACTIVE, CHAR_ALT, CHAR_SUPER, CHAR_HYPER, CHAR_SHIFT) (CHAR_CTL, CHAR_META, CHAR_MODIFIER_MASK, CHARACTERBITS) (MANY, UNEVALLED, FLOAT_TO_STRING_BUFSIZE, MAX_ALLOCA): Now constants, for GDB. They need not be macros. (MOST_POSITIVE_FIXNUM, MOST_NEGATIVE_FIXNUM, STRING_BYTES_BOUND): Now constants, for GDB, as well as macros, for static initializers. (CHAR_TABLE_STANDARD_SLOTS, CHAR_TABLE_EXTRA_SLOTS): Move to after the definition of struct Lisp_Char_Table, since the former now needs that type defined. (enum CHARTAB_SIZE_BITS, enum CHAR_TABLE_STANDARD_SLOTS) (enum DEFAULT_HASH_SIZE, enum Lisp_Compiled, enum char_bits) (enum maxargs, enum FLOAT_TO_STRING_BUFSIZE, enum MAX_ALLOCA): New enums, for gdb_make_enums_visible. (GLYPH_MODE_LINE_FACE): Remove; unused. * alloc.c (STRING_BYTES_MAX): Now a constant, now a macro. (gdb_make_enums_visible): Add enum CHARTAB_SIZE_BITS, enum CHAR_TABLE_STANDARD_SLOTS, enum char_bits, enum DEFAULT_HASH_SIZE, enum FLOAT_TO_STRING_BUFSIZE, enum Lisp_Bits, enum Lisp_Compiled, enum maxargs, enum MAX_ALLOCA. (ARRAY_MARK_FLAG_VAL, PSEUDOVECTOR_FLAG_VAL, VALMASK_VAL): Remove. (ARRAY_MARK_FLAG, PSEUDOVECTOR_FLAG, VALMASK): Remove; no longer needed, now that they are done in lisp.h. --- src/ChangeLog | 32 ++++++++++++ src/alloc.c | 48 ++++++------------ src/lisp.h | 132 +++++++++++++++++++++++++++++--------------------- 3 files changed, 123 insertions(+), 89 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 6f3c0fc0913..6825a22c08a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,35 @@ +2012-07-30 Paul Eggert + + Export to GDB most of lisp.h's remaining object-like macros. + * lisp.h (min, max): Move earlier, because they're used earlier now. + (INTMASK, ARRAY_MARK_FLAG, PSEUDOVECTOR_FLAG, VALMASK) + (CHAR_TABLE_STANDARD_SLOTS, CHARTAB_SIZE_BITS_0) + (CHARTAB_SIZE_BITS_1, CHARTAB_SIZE_BITS_2, CHARTAB_SIZE_BITS_3) + (DEFAULT_HASH_SIZE, COMPILED_ARGLIST, COMPILED_BYTECODE) + (COMPILED_CONSTANTS, COMPILED_STACK_DEPTH, COMPILED_DOC_STRING) + (COMPILED_INTERACTIVE, CHAR_ALT, CHAR_SUPER, CHAR_HYPER, CHAR_SHIFT) + (CHAR_CTL, CHAR_META, CHAR_MODIFIER_MASK, CHARACTERBITS) + (MANY, UNEVALLED, FLOAT_TO_STRING_BUFSIZE, MAX_ALLOCA): + Now constants, for GDB. They need not be macros. + (MOST_POSITIVE_FIXNUM, MOST_NEGATIVE_FIXNUM, STRING_BYTES_BOUND): + Now constants, for GDB, as well as macros, for static initializers. + (CHAR_TABLE_STANDARD_SLOTS, CHAR_TABLE_EXTRA_SLOTS): + Move to after the definition of struct Lisp_Char_Table, + since the former now needs that type defined. + (enum CHARTAB_SIZE_BITS, enum CHAR_TABLE_STANDARD_SLOTS) + (enum DEFAULT_HASH_SIZE, enum Lisp_Compiled, enum char_bits) + (enum maxargs, enum FLOAT_TO_STRING_BUFSIZE, enum MAX_ALLOCA): + New enums, for gdb_make_enums_visible. + (GLYPH_MODE_LINE_FACE): Remove; unused. + * alloc.c (STRING_BYTES_MAX): Now a constant, now a macro. + (gdb_make_enums_visible): Add enum CHARTAB_SIZE_BITS, enum + CHAR_TABLE_STANDARD_SLOTS, enum char_bits, enum DEFAULT_HASH_SIZE, + enum FLOAT_TO_STRING_BUFSIZE, enum Lisp_Bits, enum Lisp_Compiled, + enum maxargs, enum MAX_ALLOCA. + (ARRAY_MARK_FLAG_VAL, PSEUDOVECTOR_FLAG_VAL, VALMASK_VAL): Remove. + (ARRAY_MARK_FLAG, PSEUDOVECTOR_FLAG, VALMASK): Remove; + no longer needed, now that they are done in lisp.h. + 2012-07-30 Dmitry Antipov Cleanup string bytes checking. diff --git a/src/alloc.c b/src/alloc.c index cb375f5432d..c5ed1980d7c 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -1774,13 +1774,13 @@ static char const string_overrun_cookie[GC_STRING_OVERRUN_COOKIE_SIZE] = STRING_BYTES_BOUND, nor can it be so long that the size_t arithmetic in allocate_string_data would overflow while it is calculating a value to be passed to malloc. */ -#define STRING_BYTES_MAX \ - min (STRING_BYTES_BOUND, \ - ((SIZE_MAX - XMALLOC_OVERRUN_CHECK_OVERHEAD \ - - GC_STRING_EXTRA \ - - offsetof (struct sblock, first_data) \ - - SDATA_DATA_OFFSET) \ - & ~(sizeof (EMACS_INT) - 1))) +static ptrdiff_t const STRING_BYTES_MAX = + min (STRING_BYTES_BOUND, + ((SIZE_MAX - XMALLOC_OVERRUN_CHECK_OVERHEAD + - GC_STRING_EXTRA + - offsetof (struct sblock, first_data) + - SDATA_DATA_OFFSET) + & ~(sizeof (EMACS_INT) - 1))); /* Initialize string allocation. Called from init_alloc_once. */ @@ -6863,41 +6863,23 @@ The time is in seconds as a floating point value. */); #endif } -/* Make some symbols visible to GDB. This section is last, so that - the #undef lines don't mess up later code. */ - /* When compiled with GCC, GDB might say "No enum type named pvec_type" if we don't have at least one symbol with that type, and then xbacktrace could fail. Similarly for the other enums and their values. */ union { + enum CHARTAB_SIZE_BITS CHARTAB_SIZE_BITS; + enum CHAR_TABLE_STANDARD_SLOTS CHAR_TABLE_STANDARD_SLOTS; + enum char_bits char_bits; enum CHECK_LISP_OBJECT_TYPE CHECK_LISP_OBJECT_TYPE; + enum DEFAULT_HASH_SIZE DEFAULT_HASH_SIZE; enum enum_USE_LSB_TAG enum_USE_LSB_TAG; + enum FLOAT_TO_STRING_BUFSIZE FLOAT_TO_STRING_BUFSIZE; enum Lisp_Bits Lisp_Bits; + enum Lisp_Compiled Lisp_Compiled; + enum maxargs maxargs; + enum MAX_ALLOCA MAX_ALLOCA; enum More_Lisp_Bits More_Lisp_Bits; enum pvec_type pvec_type; } const EXTERNALLY_VISIBLE gdb_make_enums_visible = {0}; - -/* These symbols cannot be done as enums, since values might not be - in 'int' range. Each symbol X has a corresponding X_VAL symbol, - verified to have the correct value. */ - -#define ARRAY_MARK_FLAG_VAL PTRDIFF_MIN -#define PSEUDOVECTOR_FLAG_VAL (PTRDIFF_MAX - PTRDIFF_MAX / 2) -#define VALMASK_VAL (USE_LSB_TAG ? -1 << GCTYPEBITS : VAL_MAX) - -verify (ARRAY_MARK_FLAG_VAL == ARRAY_MARK_FLAG); -verify (PSEUDOVECTOR_FLAG_VAL == PSEUDOVECTOR_FLAG); -verify (VALMASK_VAL == VALMASK); - -#undef ARRAY_MARK_FLAG -#undef PSEUDOVECTOR_FLAG -#undef VALMASK - -ptrdiff_t const EXTERNALLY_VISIBLE - ARRAY_MARK_FLAG = ARRAY_MARK_FLAG_VAL, - PSEUDOVECTOR_FLAG = PSEUDOVECTOR_FLAG_VAL; - -EMACS_INT const EXTERNALLY_VISIBLE - VALMASK = VALMASK_VAL; diff --git a/src/lisp.h b/src/lisp.h index a530148e4dd..cf5c70bf1e4 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -28,6 +28,12 @@ along with GNU Emacs. If not, see . */ #include +/* The ubiquitous max and min macros. */ +#undef min +#undef max +#define max(a, b) ((a) > (b) ? (a) : (b)) +#define min(a, b) ((a) < (b) ? (a) : (b)) + /* EMACS_INT - signed integer wide enough to hold an Emacs value EMACS_INT_MAX - maximum value of EMACS_INT; can be used in #if pI - printf length modifier for EMACS_INT @@ -212,7 +218,7 @@ enum enum_USE_LSB_TAG { USE_LSB_TAG = 0 }; /* Lisp integers use 2 tags, to give them one extra bit, thus extending their range from, e.g., -2^28..2^28-1 to -2^29..2^29-1. */ -#define INTMASK (EMACS_INT_MAX >> (INTTYPEBITS - 1)) +static EMACS_INT const INTMASK = EMACS_INT_MAX >> (INTTYPEBITS - 1); #define case_Lisp_Int case Lisp_Int0: case Lisp_Int1 #define LISP_INT_TAG_P(x) (((x) & ~Lisp_Int1) == 0) @@ -320,11 +326,11 @@ enum CHECK_LISP_OBJECT_TYPE { CHECK_LISP_OBJECT_TYPE = 0 }; /* In the size word of a vector, this bit means the vector has been marked. */ -#define ARRAY_MARK_FLAG PTRDIFF_MIN +static ptrdiff_t const ARRAY_MARK_FLAG = PTRDIFF_MIN; /* In the size word of a struct Lisp_Vector, this bit means it's really some other vector-like object. */ -#define PSEUDOVECTOR_FLAG (PTRDIFF_MAX - PTRDIFF_MAX / 2) +static ptrdiff_t const PSEUDOVECTOR_FLAG = PTRDIFF_MAX - PTRDIFF_MAX / 2; /* In a pseudovector, the size field actually contains a word with one PSEUDOVECTOR_FLAG bit set, and exactly one of the following bits to @@ -392,7 +398,7 @@ enum More_Lisp_Bits #if USE_LSB_TAG -#define VALMASK (-1 << GCTYPEBITS) +static int const VALMASK = -1 << GCTYPEBITS; #define TYPEMASK ((1 << GCTYPEBITS) - 1) #define XTYPE(a) ((enum Lisp_Type) (XLI (a) & TYPEMASK)) #define XINT(a) (XLI (a) >> INTTYPEBITS) @@ -407,7 +413,7 @@ enum More_Lisp_Bits #else /* not USE_LSB_TAG */ -#define VALMASK VAL_MAX +static EMACS_INT const VALMASK = VAL_MAX; #define XTYPE(a) ((enum Lisp_Type) ((EMACS_UINT) XLI (a) >> VALBITS)) @@ -455,9 +461,14 @@ enum More_Lisp_Bits #define EQ(x, y) (XHASH (x) == XHASH (y)) /* Largest and smallest representable fixnum values. These are the C - values. */ + values. They are macros for use in static initializers, and + constants for visibility to GDB. */ +static EMACS_INT const MOST_POSITIVE_FIXNUM = #define MOST_POSITIVE_FIXNUM (EMACS_INT_MAX >> INTTYPEBITS) + MOST_POSITIVE_FIXNUM; +static EMACS_INT const MOST_NEGATIVE_FIXNUM = #define MOST_NEGATIVE_FIXNUM (-1 - MOST_POSITIVE_FIXNUM) + MOST_NEGATIVE_FIXNUM; /* Value is non-zero if I doesn't fit into a Lisp fixnum. It is written this way so that it also works if I is of unsigned @@ -702,10 +713,15 @@ extern ptrdiff_t string_bytes (struct Lisp_String *); Although the actual size limit (see STRING_BYTES_MAX in alloc.c) may be a bit smaller than STRING_BYTES_BOUND, calculating it here would expose alloc.c internal details that we'd rather keep - private. The cast to ptrdiff_t ensures that STRING_BYTES_BOUND is - signed. */ + private. + + This is a macros for use in static initializers, and a constant for + visibility to GDB. The cast to ptrdiff_t ensures that + STRING_BYTES_BOUND is signed. */ +static ptrdiff_t const STRING_BYTES_BOUND = #define STRING_BYTES_BOUND \ min (MOST_POSITIVE_FIXNUM, (ptrdiff_t) min (SIZE_MAX, PTRDIFF_MAX) - 1) + STRING_BYTES_BOUND; /* Mark STR as a unibyte string. */ #define STRING_SET_UNIBYTE(STR) \ @@ -814,16 +830,6 @@ struct Lisp_Vector of a char-table, and there's no way to access it directly from Emacs Lisp program. */ -/* This is the number of slots that every char table must have. This - counts the ordinary slots and the top, defalt, parent, and purpose - slots. */ -#define CHAR_TABLE_STANDARD_SLOTS (VECSIZE (struct Lisp_Char_Table) - 1) - -/* Return the number of "extra" slots in the char table CT. */ - -#define CHAR_TABLE_EXTRA_SLOTS(CT) \ - (((CT)->header.size & PSEUDOVECTOR_SIZE_MASK) - CHAR_TABLE_STANDARD_SLOTS) - #ifdef __GNUC__ #define CHAR_TABLE_REF_ASCII(CT, IDX) \ @@ -885,10 +891,13 @@ struct Lisp_Vector ? XSUB_CHAR_TABLE (XCHAR_TABLE (CT)->ascii)->contents[IDX] = VAL \ : char_table_set (CT, IDX, VAL)) -#define CHARTAB_SIZE_BITS_0 6 -#define CHARTAB_SIZE_BITS_1 4 -#define CHARTAB_SIZE_BITS_2 5 -#define CHARTAB_SIZE_BITS_3 7 +enum CHARTAB_SIZE_BITS + { + CHARTAB_SIZE_BITS_0 = 6, + CHARTAB_SIZE_BITS_1 = 4, + CHARTAB_SIZE_BITS_2 = 5, + CHARTAB_SIZE_BITS_3 = 7 + }; extern const int chartab_size[4]; @@ -987,6 +996,19 @@ struct Lisp_Subr const char *doc; }; +/* This is the number of slots that every char table must have. This + counts the ordinary slots and the top, defalt, parent, and purpose + slots. */ +enum CHAR_TABLE_STANDARD_SLOTS + { + CHAR_TABLE_STANDARD_SLOTS = VECSIZE (struct Lisp_Char_Table) - 1 + }; + +/* Return the number of "extra" slots in the char table CT. */ + +#define CHAR_TABLE_EXTRA_SLOTS(CT) \ + (((CT)->header.size & PSEUDOVECTOR_SIZE_MASK) - CHAR_TABLE_STANDARD_SLOTS) + /*********************************************************************** Symbols @@ -1214,7 +1236,7 @@ struct Lisp_Hash_Table /* Default size for hash tables if not specified. */ -#define DEFAULT_HASH_SIZE 65 +enum DEFAULT_HASH_SIZE { DEFAULT_HASH_SIZE = 65 }; /* Default threshold specifying when to resize a hash table. The value gives the ratio of current entries in the hash table and the @@ -1471,31 +1493,38 @@ typedef unsigned char UCHAR; /* Meanings of slots in a Lisp_Compiled: */ -#define COMPILED_ARGLIST 0 -#define COMPILED_BYTECODE 1 -#define COMPILED_CONSTANTS 2 -#define COMPILED_STACK_DEPTH 3 -#define COMPILED_DOC_STRING 4 -#define COMPILED_INTERACTIVE 5 +enum Lisp_Compiled + { + COMPILED_ARGLIST = 0, + COMPILED_BYTECODE = 1, + COMPILED_CONSTANTS = 2, + COMPILED_STACK_DEPTH = 3, + COMPILED_DOC_STRING = 4, + COMPILED_INTERACTIVE = 5 + }; /* Flag bits in a character. These also get used in termhooks.h. Richard Stallman thinks that MULE (MUlti-Lingual Emacs) might need 22 bits for the character value itself, so we probably shouldn't use any bits lower than 0x0400000. */ -#define CHAR_ALT (0x0400000) -#define CHAR_SUPER (0x0800000) -#define CHAR_HYPER (0x1000000) -#define CHAR_SHIFT (0x2000000) -#define CHAR_CTL (0x4000000) -#define CHAR_META (0x8000000) +enum char_bits + { + CHAR_ALT = 0x0400000, + CHAR_SUPER = 0x0800000, + CHAR_HYPER = 0x1000000, + CHAR_SHIFT = 0x2000000, + CHAR_CTL = 0x4000000, + CHAR_META = 0x8000000, -#define CHAR_MODIFIER_MASK \ - (CHAR_ALT | CHAR_SUPER | CHAR_HYPER | CHAR_SHIFT | CHAR_CTL | CHAR_META) + CHAR_MODIFIER_MASK = + (CHAR_ALT | CHAR_SUPER | CHAR_HYPER | CHAR_SHIFT | CHAR_CTL | CHAR_META), + + /* Actually, the current Emacs uses 22 bits for the character value + itself. */ + CHARACTERBITS = 22 + }; -/* Actually, the current Emacs uses 22 bits for the character value - itself. */ -#define CHARACTERBITS 22 /* The glyph datatype, used to represent characters on the display. @@ -1552,9 +1581,6 @@ typedef struct { (XINT (gc) >> CHARACTERBITS)); \ } \ while (0) - -/* The ID of the mode line highlighting face. */ -#define GLYPH_MODE_LINE_FACE 1 /* Structure to hold mouse highlight data. This is here because other header files need it for defining struct x_output etc. */ @@ -1874,8 +1900,11 @@ typedef struct { is how we define the symbol for function `name' at start-up time. */ extern void defsubr (struct Lisp_Subr *); -#define MANY -2 -#define UNEVALLED -1 +enum maxargs + { + MANY = -2, + UNEVALLED = -1 + }; extern void defvar_lisp (struct Lisp_Objfwd *, const char *, Lisp_Object *); extern void defvar_lisp_nopro (struct Lisp_Objfwd *, const char *, Lisp_Object *); @@ -2708,7 +2737,7 @@ extern void print_error_message (Lisp_Object, Lisp_Object, const char *, Lisp_Object); extern Lisp_Object internal_with_output_to_temp_buffer (const char *, Lisp_Object (*) (Lisp_Object), Lisp_Object); -#define FLOAT_TO_STRING_BUFSIZE 350 +enum FLOAT_TO_STRING_BUFSIZE { FLOAT_TO_STRING_BUFSIZE = 350 }; extern int float_to_string (char *, double); extern void syms_of_print (void); @@ -3304,15 +3333,6 @@ extern void init_system_name (void); # define lint_assume(cond) ((void) (0 && (cond))) #endif -/* The ubiquitous min and max macros. */ - -#ifdef max -#undef max -#undef min -#endif -#define min(a, b) ((a) < (b) ? (a) : (b)) -#define max(a, b) ((a) > (b) ? (a) : (b)) - /* We used to use `abs', but that clashes with system headers on some platforms, and using a name reserved by Standard C is a bad idea anyway. */ @@ -3355,7 +3375,7 @@ extern void init_system_name (void); /* SAFE_ALLOCA normally allocates memory on the stack, but if size is larger than MAX_ALLOCA, use xmalloc to avoid overflowing the stack. */ -#define MAX_ALLOCA 16*1024 +enum MAX_ALLOCA { MAX_ALLOCA = 16*1024 }; extern Lisp_Object safe_alloca_unwind (Lisp_Object); From dc5493f11d93f4a97ebc37dac5df286746496bf8 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 29 Jul 2012 23:07:22 -0700 Subject: [PATCH 68/89] Merge from gnulib, incorporating: * doc/misc/texinfo.tex: Update to 2012-07-29.17 version. --- ChangeLog | 5 ++++ doc/misc/texinfo.tex | 68 +++++++++++++++++++++++--------------------- 2 files changed, 40 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index 82b4e7fd15c..872cf56a82f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-07-30 Paul Eggert + + Merge from gnulib, incorporating: + * doc/misc/texinfo.tex: Update to 2012-07-29.17 version. + 2012-07-29 Jan Djärv * Makefile.in (install-arch-indep): Handle space in locallisppath. diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex index 2b646dd671c..c7354edcaf9 100644 --- a/doc/misc/texinfo.tex +++ b/doc/misc/texinfo.tex @@ -3,7 +3,7 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2012-07-03.16} +\def\texinfoversion{2012-07-29.17} % % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, @@ -2448,34 +2448,12 @@ % @samp. \def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}} -% definition of @key that produces a lozenge. Doesn't adjust to text size. -%\setfont\keyrm\rmshape{8}{1000}{OT1} -%\font\keysy=cmsy9 -%\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% -% \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% -% \vbox{\hrule\kern-0.4pt -% \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% -% \kern-0.4pt\hrule}% -% \kern-.06em\raise0.4pt\hbox{\angleright}}}} +% @indicateurl is \samp, that is, with quotes. +\let\indicateurl=\samp -% definition of @key with no lozenge. If the current font is already -% monospace, don't change it; that way, we respect @kbdinputstyle. But -% if it isn't monospace, then use \tt. -% -\def\key#1{{\setupmarkupstyle{key}% - \nohyphenation - \ifmonospace\else\tt\fi - #1}\null} - -% ctrl is no longer a Texinfo command. -\def\ctrl #1{{\tt \rawbackslash \hat}#1} - -% @file, @option are the same as @samp. -\let\file=\samp -\let\option=\samp - -% @code is a modification of @t, -% which makes spaces the same size as normal in the surrounding text. +% @code (and similar) prints in typewriter, but with spaces the same +% size as normal in the surrounding text, without hyphenation, etc. +% This is a subroutine for that. \def\tclose#1{% {% % Change normal interword space to be same as for the current font. @@ -2500,7 +2478,7 @@ % We *must* turn on hyphenation at `-' and `_' in @code. % Otherwise, it is too hard to avoid overfull hboxes % in the Emacs manual, the Library manual, etc. - +% % Unfortunately, TeX uses one parameter (\hyphenchar) to control % both hyphenation at - and hyphenation within words. % We must therefore turn them both off (\tclose does that) @@ -2564,6 +2542,13 @@ \fi\fi } +% For @command, @env, @file, @option quotes seem unnecessary, +% so use \code rather than \samp. +\let\command=\code +\let\env=\code +\let\file=\code +\let\option=\code + % @uref (abbreviation for `urlref') takes an optional (comma-separated) % second argument specifying the text to display and an optional third % arg as text to display instead of (rather than in addition to) the url @@ -2743,10 +2728,24 @@ \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi} -% For @indicateurl, @env, @command quotes seem unnecessary, so use \code. -\let\indicateurl=\code -\let\env=\code -\let\command=\code +% definition of @key that produces a lozenge. Doesn't adjust to text size. +%\setfont\keyrm\rmshape{8}{1000}{OT1} +%\font\keysy=cmsy9 +%\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% +% \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% +% \vbox{\hrule\kern-0.4pt +% \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% +% \kern-0.4pt\hrule}% +% \kern-.06em\raise0.4pt\hbox{\angleright}}}} + +% definition of @key with no lozenge. If the current font is already +% monospace, don't change it; that way, we respect @kbdinputstyle. But +% if it isn't monospace, then use \tt. +% +\def\key#1{{\setupmarkupstyle{key}% + \nohyphenation + \ifmonospace\else\tt\fi + #1}\null} % @clicksequence{File @click{} Open ...} \def\clicksequence#1{\begingroup #1\endgroup} @@ -2854,6 +2853,9 @@ } } +% ctrl is no longer a Texinfo command, but leave this definition for fun. +\def\ctrl #1{{\tt \rawbackslash \hat}#1} + % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}. % Ignore unless FMTNAME == tex; then it is like @iftex and @tex, % except specified as a normal braced arg, so no newlines to worry about. From d34d6ffc97bea4bc246b1f764f9d9ecdf169e0c2 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sun, 29 Jul 2012 23:18:28 -0700 Subject: [PATCH 69/89] Remove some empty src/s files. * configure.ac (opsysfile): Set to empty on freebsd, gnu-linux, gnu-kfreebsd; and to usg5-4-common.h on sol2*, unixware. * src/s/freebsd.h, src/s/gnu-linux.h, src/s/sol2-6.h, src/s/unixware.h: Remove empty files. --- ChangeLog | 5 +++++ configure.ac | 6 ++++-- src/ChangeLog | 5 +++++ src/s/freebsd.h | 22 ---------------------- src/s/gnu-linux.h | 22 ---------------------- src/s/sol2-6.h | 21 --------------------- src/s/unixware.h | 20 -------------------- 7 files changed, 14 insertions(+), 87 deletions(-) delete mode 100644 src/s/freebsd.h delete mode 100644 src/s/gnu-linux.h delete mode 100644 src/s/sol2-6.h delete mode 100644 src/s/unixware.h diff --git a/ChangeLog b/ChangeLog index 872cf56a82f..9bb6e8a62b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-07-30 Glenn Morris + + * configure.ac (opsysfile): Set to empty on freebsd, gnu-linux, + gnu-kfreebsd; and to usg5-4-common.h on sol2*, unixware. + 2012-07-30 Paul Eggert Merge from gnulib, incorporating: diff --git a/configure.ac b/configure.ac index b43087a0aa3..cd730251ba4 100644 --- a/configure.ac +++ b/configure.ac @@ -3677,6 +3677,7 @@ case $opsys in ;; freebsd) + opsysfile= AC_DEFINE(BSD4_2, []) dnl Hack to avoid calling AC_PREPROC_IFELSE multiple times. dnl Would not be needed with autoconf >= 2.67, where the @@ -3694,6 +3695,7 @@ case $opsys in ;; gnu-linux | gnu-kfreebsd ) + opsysfile= AC_DEFINE(USG, []) AC_DEFINE(GNU_LINUX, [], [Define if ths system is compatible with GNU/Linux.]) ;; @@ -3711,12 +3713,14 @@ case $opsys in ;; sol2*) + opsysfile="s/usg5-4-common.h" AC_DEFINE(USG, []) AC_DEFINE(USG5, []) AC_DEFINE(SOLARIS2, [], [Define if the system is Solaris.]) ;; unixware) + opsysfile="s/usg5-4-common.h" AC_DEFINE(USG, []) AC_DEFINE(USG5, []) ;; @@ -3736,8 +3740,6 @@ case $opsys in gnu) opsysfile= ;; - gnu-kfreebsd) opsysfile="s/gnu-linux.h" ;; - hpux11) dnl See comments in sysdep.c:sys_signal. dnl SA_RESTART resets the timeout of `select' on hpux11. diff --git a/src/ChangeLog b/src/ChangeLog index 6825a22c08a..913c3bc865d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2012-07-30 Glenn Morris + + * s/freebsd.h, s/gnu-linux.h, s/sol2-6.h, s/unixware.h: + Remove empty files. + 2012-07-30 Paul Eggert Export to GDB most of lisp.h's remaining object-like macros. diff --git a/src/s/freebsd.h b/src/s/freebsd.h deleted file mode 100644 index 9177403f426..00000000000 --- a/src/s/freebsd.h +++ /dev/null @@ -1,22 +0,0 @@ -/* System description header for FreeBSD systems. - -Copyright (C) 1994-2012 Free Software Foundation, Inc. - -Author: Shawn M. Carey -(according to authors.el) - -This file is part of GNU Emacs. - -GNU Emacs is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -GNU Emacs is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Emacs. If not, see . */ - diff --git a/src/s/gnu-linux.h b/src/s/gnu-linux.h deleted file mode 100644 index 2847fd6d19c..00000000000 --- a/src/s/gnu-linux.h +++ /dev/null @@ -1,22 +0,0 @@ -/* This file is the configuration file for Linux-based GNU systems - -Copyright (C) 1985-1986, 1992, 1994, 1996, 1999, 2001-2012 - Free Software Foundation, Inc. - -This file was put together by Michael K. Johnson and Rik Faith. - -This file is part of GNU Emacs. - -GNU Emacs is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -GNU Emacs is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Emacs. If not, see . */ - diff --git a/src/s/sol2-6.h b/src/s/sol2-6.h deleted file mode 100644 index 3bed55598b7..00000000000 --- a/src/s/sol2-6.h +++ /dev/null @@ -1,21 +0,0 @@ -/* Definitions file for GNU Emacs running on Solaris 2.6. - -Copyright (C) 1999-2012 Free Software Foundation, Inc. - -This file is part of GNU Emacs. - -GNU Emacs is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -GNU Emacs is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Emacs. If not, see . */ - -#include "usg5-4-common.h" - diff --git a/src/s/unixware.h b/src/s/unixware.h deleted file mode 100644 index 59c74a56f4e..00000000000 --- a/src/s/unixware.h +++ /dev/null @@ -1,20 +0,0 @@ -/* s/ file for Unixware. - -Copyright (C) 1999-2012 Free Software Foundation, Inc. - -This file is part of GNU Emacs. - -GNU Emacs is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -GNU Emacs is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Emacs. If not, see . */ - -#include "usg5-4-common.h" From abc7ec54946e8fa39542ccb6f278b54bc86de11a Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sun, 29 Jul 2012 23:24:20 -0700 Subject: [PATCH 70/89] * configure.ac (opsysfile): Tweak message for null case. (The autoconf manual says this is portable.) --- ChangeLog | 2 ++ configure.ac | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 9bb6e8a62b8..b72f1d50fa0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2012-07-30 Glenn Morris + * configure.ac (opsysfile): Tweak message for null case. + * configure.ac (opsysfile): Set to empty on freebsd, gnu-linux, gnu-kfreebsd; and to usg5-4-common.h on sol2*, unixware. diff --git a/configure.ac b/configure.ac index cd730251ba4..224ac182613 100644 --- a/configure.ac +++ b/configure.ac @@ -4298,7 +4298,7 @@ echo " Configured for \`${canonical}'. Where should the build process find the source code? ${srcdir} - What operating system file should Emacs use? ${opsysfile-none} + What operating system file should Emacs use? ${opsysfile:-none} What compiler should emacs be built with? ${CC} ${CFLAGS} Should Emacs use the GNU version of malloc? ${GNU_MALLOC}${GNU_MALLOC_reason} Should Emacs use a relocating allocator for buffers? ${REL_ALLOC} From 7b8a48e430dbbca60cf7d314f29001408c9b5a69 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sun, 29 Jul 2012 23:32:04 -0700 Subject: [PATCH 71/89] * s/aix4-2.h (sigmask): No need to undefine it. (syssignal.h does that unconditionally) --- src/ChangeLog | 3 +++ src/s/aix4-2.h | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 913c3bc865d..ac4aff4412b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2012-07-30 Glenn Morris + * s/aix4-2.h (sigmask): No need to undefine it, since syssignal.h + does that unconditionally. + * s/freebsd.h, s/gnu-linux.h, s/sol2-6.h, s/unixware.h: Remove empty files. diff --git a/src/s/aix4-2.h b/src/s/aix4-2.h index 6c881a7fb8c..8a957e693eb 100644 --- a/src/s/aix4-2.h +++ b/src/s/aix4-2.h @@ -16,6 +16,3 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ -/* Perry Smith says these are correct. */ -#undef sigmask - From 227f5bd0b41ebec90ec61a2b8832c95cec20c5a9 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sun, 29 Jul 2012 23:34:22 -0700 Subject: [PATCH 72/89] Remove s/aix4-2.h * configure.ac (opsysfile): Set to empty on aix4-2. * src/s/aix4-2.h: Remove empty file. --- ChangeLog | 4 ++-- configure.ac | 1 + src/ChangeLog | 2 +- src/s/aix4-2.h | 18 ------------------ 4 files changed, 4 insertions(+), 21 deletions(-) delete mode 100644 src/s/aix4-2.h diff --git a/ChangeLog b/ChangeLog index b72f1d50fa0..e83265a747d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,8 +2,8 @@ * configure.ac (opsysfile): Tweak message for null case. - * configure.ac (opsysfile): Set to empty on freebsd, gnu-linux, - gnu-kfreebsd; and to usg5-4-common.h on sol2*, unixware. + * configure.ac (opsysfile): Set to empty on aix4-2, freebsd, + gnu-linux, gnu-kfreebsd; and to usg5-4-common.h on sol2*, unixware. 2012-07-30 Paul Eggert diff --git a/configure.ac b/configure.ac index 224ac182613..9b8cabf8e4a 100644 --- a/configure.ac +++ b/configure.ac @@ -3650,6 +3650,7 @@ AH_TEMPLATE(USG5, [Define if the system is compatible with System V.]) case $opsys in aix4-2) + opsysfile= AC_DEFINE(USG, []) AC_DEFINE(USG5, []) dnl This symbol should be defined on AIX Version 3 ??????? diff --git a/src/ChangeLog b/src/ChangeLog index ac4aff4412b..78205746c4f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,7 +1,7 @@ 2012-07-30 Glenn Morris * s/aix4-2.h (sigmask): No need to undefine it, since syssignal.h - does that unconditionally. + does that unconditionally. Remove file, which is now empty. * s/freebsd.h, s/gnu-linux.h, s/sol2-6.h, s/unixware.h: Remove empty files. diff --git a/src/s/aix4-2.h b/src/s/aix4-2.h deleted file mode 100644 index 8a957e693eb..00000000000 --- a/src/s/aix4-2.h +++ /dev/null @@ -1,18 +0,0 @@ -/* -Copyright (C) 1999, 2001-2012 Free Software Foundation, Inc. - -This file is part of GNU Emacs. - -GNU Emacs is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -GNU Emacs is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Emacs. If not, see . */ - From 6cd7a13902729007a4d1e14a299bad47c9808353 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Mon, 30 Jul 2012 10:43:46 +0400 Subject: [PATCH 73/89] Convert safe_call to use variable number of arguments. * xdisp.c (safe_call): Convert to use varargs. Adjust users. (safe_call2): Fix comment. * lisp.h (safe_call): Adjust prototype. * coding.c (encode_coding_object): Change to use safe_call2. * xfaces.c (merge_face_heights): Change to use safe_call1. --- src/ChangeLog | 9 +++++++++ src/coding.c | 7 ++----- src/composite.c | 12 ++---------- src/keyboard.c | 9 +-------- src/lisp.h | 2 +- src/term.c | 3 +-- src/xdisp.c | 32 +++++++++++++++----------------- src/xfaces.c | 6 +----- 8 files changed, 32 insertions(+), 48 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 78205746c4f..41d7759cfb5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2012-07-30 Dmitry Antipov + + Convert safe_call to use variable number of arguments. + * xdisp.c (safe_call): Convert to use varargs. Adjust users. + (safe_call2): Fix comment. + * lisp.h (safe_call): Adjust prototype. + * coding.c (encode_coding_object): Change to use safe_call2. + * xfaces.c (merge_face_heights): Change to use safe_call1. + 2012-07-30 Glenn Morris * s/aix4-2.h (sigmask): No need to undefine it, since syssignal.h diff --git a/src/coding.c b/src/coding.c index 7b178b0ce14..e4ed65079d9 100644 --- a/src/coding.c +++ b/src/coding.c @@ -7931,15 +7931,12 @@ encode_coding_object (struct coding_system *coding, } { - Lisp_Object args[3]; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; GCPRO5 (coding->src_object, coding->dst_object, src_object, dst_object, old_deactivate_mark); - args[0] = CODING_ATTR_PRE_WRITE (attrs); - args[1] = make_number (BEG); - args[2] = make_number (Z); - safe_call (3, args); + safe_call2 (CODING_ATTR_PRE_WRITE (attrs), + make_number (BEG), make_number (Z)); UNGCPRO; } if (XBUFFER (coding->src_object) != current_buffer) diff --git a/src/composite.c b/src/composite.c index bfc8093a87f..62ab3d04948 100644 --- a/src/composite.c +++ b/src/composite.c @@ -947,20 +947,12 @@ autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t string); if (NILP (LGSTRING_ID (lgstring))) { - Lisp_Object args[6]; - /* Save point as marker before calling out to lisp. */ if (NILP (string)) record_unwind_protect (restore_point_unwind, build_marker (current_buffer, pt, pt_byte)); - - args[0] = Vauto_composition_function; - args[1] = AREF (rule, 2); - args[2] = pos; - args[3] = make_number (to); - args[4] = font_object; - args[5] = string; - lgstring = safe_call (6, args); + lgstring = safe_call (6, Vauto_composition_function, AREF (rule, 2), + pos, make_number (to), font_object, string); } return unbind_to (count, lgstring); } diff --git a/src/keyboard.c b/src/keyboard.c index 1f6c47eaf79..00e6f4cbbe9 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -2185,14 +2185,7 @@ show_help_echo (Lisp_Object help, Lisp_Object window, Lisp_Object object, if (!NILP (help) && !STRINGP (help)) { if (FUNCTIONP (help)) - { - Lisp_Object args[4]; - args[0] = help; - args[1] = window; - args[2] = object; - args[3] = pos; - help = safe_call (4, args); - } + help = safe_call (4, help, window, object, pos); else help = safe_eval (help); diff --git a/src/lisp.h b/src/lisp.h index cf5c70bf1e4..491f648de75 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2842,7 +2842,7 @@ extern _Noreturn void verror (const char *, va_list) ATTRIBUTE_FORMAT_PRINTF (1, 0); extern Lisp_Object un_autoload (Lisp_Object); extern void init_eval_once (void); -extern Lisp_Object safe_call (ptrdiff_t, Lisp_Object *); +extern Lisp_Object safe_call (ptrdiff_t, Lisp_Object, ...); extern Lisp_Object safe_call1 (Lisp_Object, Lisp_Object); extern Lisp_Object safe_call2 (Lisp_Object, Lisp_Object, Lisp_Object); extern void init_eval (void); diff --git a/src/term.c b/src/term.c index 4d73f896d21..f24caeffebb 100644 --- a/src/term.c +++ b/src/term.c @@ -2209,11 +2209,10 @@ set_tty_color_mode (struct tty_display_info *tty, struct frame *f) if (mode != tty->previous_color_mode) { - Lisp_Object funsym = intern ("tty-set-up-initial-frame-faces"); tty->previous_color_mode = mode; tty_setup_colors (tty , mode); /* This recomputes all the faces given the new color definitions. */ - safe_call (1, &funsym); + safe_call (1, intern ("tty-set-up-initial-frame-faces")); } } diff --git a/src/xdisp.c b/src/xdisp.c index a11b117f067..83f0ae830f8 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -2403,16 +2403,12 @@ safe_eval_handler (Lisp_Object arg) return Qnil; } - -/* Evaluate SEXPR and return the result, or nil if something went +/* Call function FUNC with the rest of NARGS - 1 arguments + following. Return the result, or nil if something went wrong. Prevent redisplay during the evaluation. */ -/* Call function ARGS[0] with arguments ARGS[1] to ARGS[NARGS - 1]. - Return the result, or nil if something went wrong. Prevent - redisplay during the evaluation. */ - Lisp_Object -safe_call (ptrdiff_t nargs, Lisp_Object *args) +safe_call (ptrdiff_t nargs, Lisp_Object func, ...) { Lisp_Object val; @@ -2420,8 +2416,17 @@ safe_call (ptrdiff_t nargs, Lisp_Object *args) val = Qnil; else { + va_list ap; + ptrdiff_t i; ptrdiff_t count = SPECPDL_INDEX (); struct gcpro gcpro1; + Lisp_Object *args = alloca (nargs * sizeof (Lisp_Object)); + + args[0] = func; + va_start (ap, func); + for (i = 1; i < nargs; i++) + args[i] = va_arg (ap, Lisp_Object); + va_end (ap); GCPRO1 (args[0]); gcpro1.nvars = nargs; @@ -2444,10 +2449,7 @@ safe_call (ptrdiff_t nargs, Lisp_Object *args) Lisp_Object safe_call1 (Lisp_Object fn, Lisp_Object arg) { - Lisp_Object args[2]; - args[0] = fn; - args[1] = arg; - return safe_call (2, args); + return safe_call (2, fn, arg); } static Lisp_Object Qeval; @@ -2458,17 +2460,13 @@ safe_eval (Lisp_Object sexpr) return safe_call1 (Qeval, sexpr); } -/* Call function FN with one argument ARG. +/* Call function FN with two arguments ARG1 and ARG2. Return the result, or nil if something went wrong. */ Lisp_Object safe_call2 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2) { - Lisp_Object args[3]; - args[0] = fn; - args[1] = arg1; - args[2] = arg2; - return safe_call (3, args); + return safe_call (3, fn, arg1, arg2); } diff --git a/src/xfaces.c b/src/xfaces.c index e9089017c4e..6a34c3c8893 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -2254,11 +2254,7 @@ merge_face_heights (Lisp_Object from, Lisp_Object to, Lisp_Object invalid) { /* Call function with current height as argument. From is the new height. */ - Lisp_Object args[2]; - - args[0] = from; - args[1] = to; - result = safe_call (2, args); + result = safe_call1 (from, to); /* Ensure that if TO was absolute, so is the result. */ if (INTEGERP (to) && !INTEGERP (result)) From 169304bdb3445a2d8212bed42ba77e2081e9585a Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Mon, 30 Jul 2012 09:45:58 +0200 Subject: [PATCH 74/89] Fixes: debbugs:12090 * keymap.c (Fkey_description): Don't remove 0x80 bit from non-single-byte char when adding meta modifier. --- src/ChangeLog | 5 +++++ src/keymap.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 41d7759cfb5..e8aff22c2cb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2012-07-30 Andreas Schwab + + * keymap.c (Fkey_description): Don't remove 0x80 bit from + non-single-byte char when adding meta modifier. (Bug#12090) + 2012-07-30 Dmitry Antipov Convert safe_call to use variable number of arguments. diff --git a/src/keymap.c b/src/keymap.c index 6cc76700542..3c5d45b0680 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -2141,7 +2141,7 @@ The `kbd' macro is an approximate inverse of this. */) continue; } else - XSETINT (key, (XINT (key) | meta_modifier) & ~0x80); + XSETINT (key, XINT (key) | meta_modifier); add_meta = 0; } else if (EQ (key, meta_prefix_char)) From 847bb9eb7493049ab67f244b802c061efbc4d816 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dj=C3=A4rv?= Date: Mon, 30 Jul 2012 09:51:29 +0200 Subject: [PATCH 75/89] * Makefile.in (install-arch-indep): Remove sh -x. --- ChangeLog | 4 ++++ Makefile.in | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e83265a747d..ee3ae610a35 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2012-07-30 Jan Djärv + + * Makefile.in (install-arch-indep): Remove sh -x. + 2012-07-30 Glenn Morris * configure.ac (opsysfile): Tweak message for null case. diff --git a/Makefile.in b/Makefile.in index c6df480ce7c..b780576ea5e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -489,7 +489,7 @@ set_installuser=for installuser in $${LOGNAME} $${USERNAME} $${USER} \ ## http://lists.gnu.org/archive/html/autoconf-patches/2004-11/msg00005.html install-arch-indep: install-info install-man ${INSTALL_ARCH_INDEP_EXTRA} umask 022 ; \ - eval sh -x $(MKDIR_P) \ + eval $(MKDIR_P) \ "'$(DESTDIR)`echo ${locallisppath}|sed \"s,:,' '$(DESTDIR),g\"`'" -set ${COPYDESTS} ; \ unset CDPATH; \ From 197755446f1f246683c5abae5c803924723814ba Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Mon, 30 Jul 2012 10:13:52 +0000 Subject: [PATCH 76/89] lisp/gnus/ChangeLog (2012-07-27): Fix author's address e-mail --- lisp/gnus/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index f13ffb5afd7..b123b77273e 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -10,7 +10,7 @@ (auth-source-macos-keychain-result-append): Fix variable name. (auth-sources, auth-source-macos-keychain-result-append): More fixes. -2012-07-27 Julien Danjou +2012-07-27 Julien Danjou * message.el (fboundp): Add a defalias on `mail-dont-reply-to' for Emacs < 24.1 From 259a41782b8470ff72809b83c7b116bf219f14f3 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 30 Jul 2012 06:17:41 -0400 Subject: [PATCH 77/89] Auto-commit of generated files. --- autogen/configure | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/autogen/configure b/autogen/configure index 13ffa90b2df..b52d3157b10 100755 --- a/autogen/configure +++ b/autogen/configure @@ -15179,6 +15179,7 @@ esac case $opsys in aix4-2) + opsysfile= $as_echo "#define USG /**/" >>confdefs.h $as_echo "#define USG5 /**/" >>confdefs.h @@ -15226,6 +15227,7 @@ $as_echo "#define DARWIN_OS /**/" >>confdefs.h ;; freebsd) + opsysfile= $as_echo "#define BSD4_2 /**/" >>confdefs.h @@ -15261,6 +15263,7 @@ rm -f conftest.err conftest.$ac_ext ;; gnu-linux | gnu-kfreebsd ) + opsysfile= $as_echo "#define USG /**/" >>confdefs.h @@ -15289,6 +15292,7 @@ $as_echo "#define IRIX6_5 /**/" >>confdefs.h ;; sol2*) + opsysfile="s/usg5-4-common.h" $as_echo "#define USG /**/" >>confdefs.h $as_echo "#define USG5 /**/" >>confdefs.h @@ -15299,6 +15303,7 @@ $as_echo "#define SOLARIS2 /**/" >>confdefs.h ;; unixware) + opsysfile="s/usg5-4-common.h" $as_echo "#define USG /**/" >>confdefs.h $as_echo "#define USG5 /**/" >>confdefs.h @@ -15316,8 +15321,6 @@ $as_echo "#define G_SLICE_ALWAYS_MALLOC 1" >>confdefs.h gnu) opsysfile= ;; - gnu-kfreebsd) opsysfile="s/gnu-linux.h" ;; - hpux11) $as_echo "#define BROKEN_SA_RESTART 1" >>confdefs.h @@ -23784,7 +23787,7 @@ echo " Configured for \`${canonical}'. Where should the build process find the source code? ${srcdir} - What operating system file should Emacs use? ${opsysfile-none} + What operating system file should Emacs use? ${opsysfile:-none} What compiler should emacs be built with? ${CC} ${CFLAGS} Should Emacs use the GNU version of malloc? ${GNU_MALLOC}${GNU_MALLOC_reason} Should Emacs use a relocating allocator for buffers? ${REL_ALLOC} From 0a763bd17bc8c282523a137ad9984c8a314aabd2 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 30 Jul 2012 07:30:20 -0700 Subject: [PATCH 78/89] Move _longjmp, _setjmp from src/s to configure * configure.ac (_longjmp, _setjmp): Move here from src/s. * src/s/usg5-4-common.h (_longjmp, _setjmp): Let configure set them. * src/s/irix6-5.h (_longjmp, _setjmp): No more need to undefine. --- ChangeLog | 4 ++++ configure.ac | 9 +++++++++ src/ChangeLog | 5 +++++ src/s/irix6-5.h | 3 --- src/s/usg5-4-common.h | 5 ----- 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index ee3ae610a35..5c1f2c6a1b6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2012-07-30 Glenn Morris + + * configure.ac (_longjmp, _setjmp): Move here from src/s. + 2012-07-30 Jan Djärv * Makefile.in (install-arch-indep): Remove sh -x. diff --git a/configure.ac b/configure.ac index 9b8cabf8e4a..9ca02cce7cc 100644 --- a/configure.ac +++ b/configure.ac @@ -3631,6 +3631,15 @@ else esac fi dnl GCC? +case $opsys in + sol2* | unixware ) + dnl setjmp and longjmp can safely replace _setjmp and _longjmp, + dnl but they will run more slowly. + AC_DEFINE(_setjmp, setjmp, [Some platforms redefine this.]) + AC_DEFINE(_longjmp, longjmp, [Some platforms redefine this.]) + ;; +esac + dnl Used in xfaces.c. case $opsys in diff --git a/src/ChangeLog b/src/ChangeLog index e8aff22c2cb..37d660da785 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2012-07-30 Glenn Morris + + * s/usg5-4-common.h (_longjmp, _setjmp): Let configure set them. + * s/irix6-5.h (_longjmp, _setjmp): No more need to undefine. + 2012-07-30 Andreas Schwab * keymap.c (Fkey_description): Don't remove 0x80 bit from diff --git a/src/s/irix6-5.h b/src/s/irix6-5.h index 9b215845461..1750183189d 100644 --- a/src/s/irix6-5.h +++ b/src/s/irix6-5.h @@ -19,9 +19,6 @@ along with GNU Emacs. If not, see . */ #include "usg5-4-common.h" -#undef _longjmp /* use system versions, not conservative aliases */ -#undef _setjmp - #ifdef emacs char *_getpty(); #endif diff --git a/src/s/usg5-4-common.h b/src/s/usg5-4-common.h index 6ead01d3712..12506bd8d08 100644 --- a/src/s/usg5-4-common.h +++ b/src/s/usg5-4-common.h @@ -20,11 +20,6 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ -/* setjmp and longjmp can safely replace _setjmp and _longjmp, - but they will run slower. */ -#define _setjmp setjmp -#define _longjmp longjmp - /* Get FIONREAD from . Get to get struct tchars. But get first to make sure ttold.h doesn't interfere. */ #include From 32bac6d6e81cc5039db7e34e3ac70930d2cb586e Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 30 Jul 2012 07:46:48 -0700 Subject: [PATCH 79/89] Empty src/s/netbsd.h and remove the file * configure.ac (SIGNAL_H_AHB): New hack macro. (opsysfile): Set to empty on netbsd, openbsd. (AH_BOTTOM): Include signal.h if SIGNAL_H_AHB is defined. * src/s/netbsd.h: Let configure include signal.h if needed. Remove file, which is now empty. --- ChangeLog | 4 ++++ configure.ac | 17 +++++++++++++++-- src/ChangeLog | 3 +++ src/s/netbsd.h | 24 ------------------------ 4 files changed, 22 insertions(+), 26 deletions(-) delete mode 100644 src/s/netbsd.h diff --git a/ChangeLog b/ChangeLog index 5c1f2c6a1b6..775b95f4626 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2012-07-30 Glenn Morris + * configure.ac (SIGNAL_H_AHB): New hack macro. + (opsysfile): Set to empty on netbsd, openbsd. + (AH_BOTTOM): Include signal.h if SIGNAL_H_AHB is defined. + * configure.ac (_longjmp, _setjmp): Move here from src/s. 2012-07-30 Jan Djärv diff --git a/configure.ac b/configure.ac index 9ca02cce7cc..77eab0821eb 100644 --- a/configure.ac +++ b/configure.ac @@ -3641,12 +3641,19 @@ case $opsys in esac -dnl Used in xfaces.c. case $opsys in hpux* | sol2* ) + dnl Used in xfaces.c. AC_DEFINE(XOS_NEEDS_TIME_H, 1, [Compensate for a bug in Xos.h on some systems, where it requires time.h.]) ;; + + netbsd | openbsd ) + dnl Greg A. Woods says we must include signal.h + dnl before syssignal.h is included, to work around interface conflicts + dnl that are handled with CPP __RENAME() macro in signal.h. + AC_DEFINE(SIGNAL_H_AHB, 1, [Define if AH_BOTTOM should include signal.h.]) + ;; esac @@ -3772,7 +3779,7 @@ case $opsys in should not call setpgrp.]) ;; - openbsd) opsysfile="s/netbsd.h" ;; + netbsd | openbsd ) opsysfile= ;; sol2-10) AC_DEFINE(_STRUCTURED_PROC, 1, [Needed for system_process_attributes @@ -4186,6 +4193,7 @@ along with GNU Emacs. If not, see . */ #define EMACS_CONFIG_H ])dnl +dnl FIXME undefs in here get commented out by autoconf. :( AH_BOTTOM([ /* On AIX 3 this must be included before any other include file. */ #include @@ -4193,6 +4201,11 @@ AH_BOTTOM([ # error "alloca not available on this machine" #endif +#ifdef SIGNAL_H_AHB +#undef SIGNAL_H_AHB +#include +#endif + /* This silences a few compilation warnings on FreeBSD. */ #ifdef BSD_SYSTEM_AHB #undef BSD_SYSTEM_AHB diff --git a/src/ChangeLog b/src/ChangeLog index 37d660da785..076b5eb1cce 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2012-07-30 Glenn Morris + * s/netbsd.h: Let configure include signal.h if needed. + Remove file, which is now empty. + * s/usg5-4-common.h (_longjmp, _setjmp): Let configure set them. * s/irix6-5.h (_longjmp, _setjmp): No more need to undefine. diff --git a/src/s/netbsd.h b/src/s/netbsd.h deleted file mode 100644 index 7a571ee8116..00000000000 --- a/src/s/netbsd.h +++ /dev/null @@ -1,24 +0,0 @@ -/* s/ file for netbsd system. - -Copyright (C) 2001-2012 Free Software Foundation, Inc. - -This file is part of GNU Emacs. - -GNU Emacs is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -GNU Emacs is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Emacs. If not, see . */ - -/* Greg A. Woods says we must include signal.h - before syssignal.h is included, to work around interface conflicts - that are handled with CPP __RENAME() macro in signal.h. */ -#include - From b65e7c462a0cd29836c0ff8cf868d8a8b5a69fa6 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 30 Jul 2012 07:52:08 -0700 Subject: [PATCH 80/89] Move TIOCSIGSEND from src/s to configure * configure.ac (TIOCSIGSEND): Move here from src/s. * src/s/usg5-4-common.h (TIOCSIGSEND): Let configure set it. * src/s/irix6-5.h (TIOCSIGSEND): No more need to undefine. --- ChangeLog | 2 +- configure.ac | 5 +++++ src/ChangeLog | 6 ++++-- src/s/irix6-5.h | 3 --- src/s/usg5-4-common.h | 5 ----- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 775b95f4626..8ef1837ada7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,7 +4,7 @@ (opsysfile): Set to empty on netbsd, openbsd. (AH_BOTTOM): Include signal.h if SIGNAL_H_AHB is defined. - * configure.ac (_longjmp, _setjmp): Move here from src/s. + * configure.ac (_longjmp, _setjmp, TIOCSIGSEND): Move here from src/s. 2012-07-30 Jan Djärv diff --git a/configure.ac b/configure.ac index 77eab0821eb..23833f4913c 100644 --- a/configure.ac +++ b/configure.ac @@ -3631,12 +3631,17 @@ else esac fi dnl GCC? + case $opsys in sol2* | unixware ) dnl setjmp and longjmp can safely replace _setjmp and _longjmp, dnl but they will run more slowly. AC_DEFINE(_setjmp, setjmp, [Some platforms redefine this.]) AC_DEFINE(_longjmp, longjmp, [Some platforms redefine this.]) + dnl TIOCGPGRP is broken in SysVr4, so we can't send signals to PTY + dnl subprocesses the usual way. But TIOCSIGNAL does work for PTYs, + dnl and this is all we need. + AC_DEFINE(TIOCSIGSEND, TIOCSIGNAL, [Some platforms redefine this.]) ;; esac diff --git a/src/ChangeLog b/src/ChangeLog index 076b5eb1cce..907b54d614f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -3,8 +3,10 @@ * s/netbsd.h: Let configure include signal.h if needed. Remove file, which is now empty. - * s/usg5-4-common.h (_longjmp, _setjmp): Let configure set them. - * s/irix6-5.h (_longjmp, _setjmp): No more need to undefine. + * s/usg5-4-common.h (_longjmp, _setjmp, TIOCSIGSEND): + Let configure set them. + * s/irix6-5.h (_longjmp, _setjmp, TIOCSIGSEND): + No more need to undefine. 2012-07-30 Andreas Schwab diff --git a/src/s/irix6-5.h b/src/s/irix6-5.h index 1750183189d..338c18cca52 100644 --- a/src/s/irix6-5.h +++ b/src/s/irix6-5.h @@ -24,6 +24,3 @@ char *_getpty(); #endif #undef SA_RESTART /* not the same as defining BROKEN_SA_RESTART */ - -#undef TIOCSIGSEND /* defined in usg5-4-common.h */ - diff --git a/src/s/usg5-4-common.h b/src/s/usg5-4-common.h index 12506bd8d08..05f22143460 100644 --- a/src/s/usg5-4-common.h +++ b/src/s/usg5-4-common.h @@ -42,8 +42,3 @@ along with GNU Emacs. If not, see . */ waitpid ((pid_t) -1, (status), (options)) #define WRETCODE(w) (w >> 8) -/* TIOCGPGRP is broken in SysVr4, so we can't send signals to PTY - subprocesses the usual way. But TIOCSIGNAL does work for PTYs, and - this is all we need. */ -#define TIOCSIGSEND TIOCSIGNAL - From 88fb40b443b64be3e217e1d5cb50a77659d03330 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 30 Jul 2012 08:30:40 -0700 Subject: [PATCH 81/89] * lisp.h (STRING_BYTES_BOUND): Cast entire result to ptrdiff_t. This is a bit clearer. Fix some commentary typos. --- src/ChangeLog | 7 ++++++- src/lisp.h | 8 ++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 907b54d614f..d36fff428fe 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2012-07-30 Paul Eggert + + * lisp.h (STRING_BYTES_BOUND): Cast entire result to ptrdiff_t. + This is a bit clearer. Fix some commentary typos. + 2012-07-30 Glenn Morris * s/netbsd.h: Let configure include signal.h if needed. @@ -53,7 +58,7 @@ (enum maxargs, enum FLOAT_TO_STRING_BUFSIZE, enum MAX_ALLOCA): New enums, for gdb_make_enums_visible. (GLYPH_MODE_LINE_FACE): Remove; unused. - * alloc.c (STRING_BYTES_MAX): Now a constant, now a macro. + * alloc.c (STRING_BYTES_MAX): Now a constant, not a macro. (gdb_make_enums_visible): Add enum CHARTAB_SIZE_BITS, enum CHAR_TABLE_STANDARD_SLOTS, enum char_bits, enum DEFAULT_HASH_SIZE, enum FLOAT_TO_STRING_BUFSIZE, enum Lisp_Bits, enum Lisp_Compiled, diff --git a/src/lisp.h b/src/lisp.h index 491f648de75..1b88a51d2d4 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -715,12 +715,12 @@ extern ptrdiff_t string_bytes (struct Lisp_String *); would expose alloc.c internal details that we'd rather keep private. - This is a macros for use in static initializers, and a constant for + This is a macro for use in static initializers, and a constant for visibility to GDB. The cast to ptrdiff_t ensures that - STRING_BYTES_BOUND is signed. */ + the macro is signed. */ static ptrdiff_t const STRING_BYTES_BOUND = #define STRING_BYTES_BOUND \ - min (MOST_POSITIVE_FIXNUM, (ptrdiff_t) min (SIZE_MAX, PTRDIFF_MAX) - 1) + ((ptrdiff_t) min (MOST_POSITIVE_FIXNUM, min (SIZE_MAX, PTRDIFF_MAX) - 1)) STRING_BYTES_BOUND; /* Mark STR as a unibyte string. */ @@ -1517,7 +1517,7 @@ enum char_bits CHAR_META = 0x8000000, CHAR_MODIFIER_MASK = - (CHAR_ALT | CHAR_SUPER | CHAR_HYPER | CHAR_SHIFT | CHAR_CTL | CHAR_META), + CHAR_ALT | CHAR_SUPER | CHAR_HYPER | CHAR_SHIFT | CHAR_CTL | CHAR_META, /* Actually, the current Emacs uses 22 bits for the character value itself. */ From 0aee69126fd23d3b86fae5e4812b62bbe7c59b27 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 30 Jul 2012 09:20:35 -0700 Subject: [PATCH 82/89] Update .PHONY listings in makefiles. --- ChangeLog | 9 +++++++++ Makefile.in | 14 ++++++++------ leim/ChangeLog | 6 ++++++ leim/Makefile.in | 4 ++++ lib-src/ChangeLog | 7 +++++++ lib-src/Makefile.in | 5 +++++ lisp/ChangeLog | 9 +++++++++ lisp/Makefile.in | 11 +++++++++++ src/ChangeLog | 5 +++++ src/Makefile.in | 3 +++ 10 files changed, 67 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8ef1837ada7..d3c52b6922d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2012-07-30 Paul Eggert + + Update .PHONY listings in makefiles. + * Makefile.in (.PHONY): Add all, ${SUBDIR}, blessmail, epath-force, + FRC, install-arch-dep, install-arch-indep, install-doc, + install-info, install-man, install-etc, install-strip, uninstall, + bootstrap-clean, TAGS, tags, info-real, force-info, check-info-dir. + (.RECURSIVE): Remove; hasn't been needed for years. + 2012-07-30 Glenn Morris * configure.ac (SIGNAL_H_AHB): New hack macro. diff --git a/Makefile.in b/Makefile.in index b780576ea5e..4b9364ac3f4 100644 --- a/Makefile.in +++ b/Makefile.in @@ -278,6 +278,8 @@ COPYDESTS = $(DESTDIR)${etcdir} $(DESTDIR)${lispdir} $(DESTDIR)${leimdir}/ja-dic all: ${SUBDIR} +.PHONY: all ${SUBDIR} blessmail epaths-force FRC + removenullpaths=sed -e 's/^://g' -e 's/:$$//g' -e 's/::/:/g' # Generate epaths.h from epaths.in. This target is invoked by `configure'. @@ -307,8 +309,6 @@ lib-src src: lib src: lib-src FRC -.RECURSIVE: ${SUBDIR} - # We need to build `emacs' in `src' to compile the *.elc files in `lisp' # and `leim'. lisp leim: src @@ -393,12 +393,13 @@ $(srcdir)/src/stamp-h.in: $(AUTOCONF_INPUTS) # ==================== Installation ==================== +.PHONY: install install-arch-dep install-arch-indep install-doc install-info +.PHONY: install-man install-etc install-strip uninstall + ## If we let lib-src do its own installation, that means we ## don't have to duplicate the list of utilities to install in ## this Makefile as well. -.PHONY: install - install: all install-arch-indep install-doc install-arch-dep blessmail @true @@ -681,7 +682,7 @@ FRC: # ==================== Cleaning up and miscellanea ==================== -.PHONY: mostlyclean clean distclean maintainer-clean extraclean +.PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean extraclean ### `mostlyclean' ### Like `clean', but may refrain from deleting a few files that people @@ -798,6 +799,7 @@ extraclean: # The src subdir knows how to do the right thing # even when the build directory and source dir are different. +.PHONY: TAGS tags TAGS tags: lib lib-src src cd src; $(MAKE) $(MFLAGS) tags @@ -812,7 +814,7 @@ check: dist: cd ${srcdir}; ./make-dist -.PHONY: info dvi dist check html +.PHONY: info dvi dist check html info-real force-info check-info-dir info-real: (cd doc/emacs; $(MAKE) $(MFLAGS) info) diff --git a/leim/ChangeLog b/leim/ChangeLog index fbe656c037c..cafaf5a9eb1 100644 --- a/leim/ChangeLog +++ b/leim/ChangeLog @@ -1,3 +1,9 @@ +2012-07-30 Paul Eggert + + Update .PHONY listings in makefiles. + * Makefile.in (.PHONY): Add all, compile-main, clean, mostlyclean, + bootstrap-clean, distclean, maintainer-clean, extraclean. + 2012-07-29 Paul Eggert deactive->inactive, inactivate->deactivate spelling fixes (Bug#10150) diff --git a/leim/Makefile.in b/leim/Makefile.in index 04f64c0ce0b..f61ab42b9f3 100644 --- a/leim/Makefile.in +++ b/leim/Makefile.in @@ -82,6 +82,7 @@ TIT_MISC=${CHINESE_TIT} ${MISC} @${RUN_EMACS} -l ${buildlisppath}/international/quail -f batch-byte-compile $< all: leim-list.el compile-main +.PHONY: all TIT_SOURCES= \ ${srcdir}/CXTERM-DIC/4Corner.tit \ @@ -154,6 +155,7 @@ compile-targets: $(TARGETS) # Compile all the Elisp files that need it. Beware: it approximates # `no-byte-compile', so watch out for false-positives! +.PHONY: compile-main compile-main: ${TIT_MISC} @($(setwins); \ els=`echo "$$wins " | sed -e 's| |/*.el |g'`; \ @@ -166,6 +168,8 @@ compile-main: ${TIT_MISC} $(MAKE) $(MFLAGS) compile-targets EMACS="$(EMACS)" TARGETS="$$chunk"; \ done +.PHONY: clean mostlyclean bootstrap-clean distclean maintainer-clean extraclean + clean mostlyclean: rm -f ${TIT_MISC} ${TIT_MISC:.el=.elc} \ leim-list.el changed.tit changed.misc diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 3a5c80db356..2d2bb06cd6f 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,10 @@ +2012-07-30 Paul Eggert + + Update .PHONY listings in makefiles. + * Makefile.in (.PHONY): Add all, need-blessmail, maybe-blessmail, + install, uninstall, mostlyclean, clean, distclean, + maintainer-clean, extraclean, check, tags. + 2012-07-29 Eli Zaretskii * makefile.w32-in ($(BLD)/profile.$(O)): Depend on stamp_BLD. diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in index fe727c65730..a578966b0f0 100644 --- a/lib-src/Makefile.in +++ b/lib-src/Makefile.in @@ -180,6 +180,8 @@ CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS} all: ${EXE_FILES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS} +.PHONY: all need-blessmail maybe-blessmail + LOADLIBES = ../lib/libgnu.a $(LIBS_SYSTEM) $(EXE_FILES): ../lib/libgnu.a @@ -231,6 +233,9 @@ $(DESTDIR)${archlibdir}: all done ; \ fi +.PHONY: install uninstall mostlyclean clean distclean maintainer-clean +.PHONY: extraclean check tags + install: $(DESTDIR)${archlibdir} @echo @echo "Installing utilities for users to run." diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5b703837257..0af7ff9ad11 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2012-07-30 Paul Eggert + + Update .PHONY listings in makefiles. + * Makefile.in (.PHONY): Add all, doit, custom-deps, finder-data, + autoloads, update-subdirs, updates, bzr-update, update-authors, + compile-onefile, compile-calc, backup-compiled-files, + compile-after-backup, compile-one-process, mh-autoloads, + bootstrap-clean, distclean, maintainer-clean. + 2012-07-29 Jay Belanger * calc/calc.el (calc-simplify-mode): Make 'alg the default value. diff --git a/lisp/Makefile.in b/lisp/Makefile.in index 0cb142a7267..643b698c6e8 100644 --- a/lisp/Makefile.in +++ b/lisp/Makefile.in @@ -139,6 +139,8 @@ all: compile-main $(lisp)/cus-load.el $(lisp)/finder-inf.el doit: +.PHONY: all doit custom-deps finder-data autoloads update-subdirs + # custom-deps and finder-data both used to scan _all_ the *.el files. # This could lead to problems in parallel builds if automatically # generated *.el files (eg loaddefs etc) were being changed at the same time. @@ -184,6 +186,8 @@ update-subdirs: doit $(top_srcdir)/build-aux/update-subdirs $$file; \ done; +.PHONY: updates bzr-update update-authors + # Some modes of make-dist use this. updates: update-subdirs autoloads finder-data custom-deps @@ -215,6 +219,7 @@ TAGS TAGS-LISP: $(lisptagsfiles1) $(lisptagsfiles2) $(lisptagsfiles3) $(lisptags # src/Makefile.in to rebuild a particular Lisp file, no questions asked. # Use byte-compile-refresh-preloaded to try and work around some of # the most common problems of not bootstrapping from a clean state. +.PHONY: compile-onefile compile-onefile: @echo Compiling $(THEFILE) @# Use byte-compile-refresh-preloaded to try and work around some of @@ -302,6 +307,8 @@ compile-always: doit cd $(lisp); rm -f *.elc */*.elc */*/*.elc */*/*/*.elc $(MAKE) $(MFLAGS) compile EMACS=$(EMACS) +.PHONY: compile-calc backup-compiled-files compile-after-backup + compile-calc: for el in $(lisp)/calc/*.el; do \ echo Compiling $$el; \ @@ -334,6 +341,7 @@ compile-after-backup: backup-compiled-files compile-always # files that use byte-compile-dynamic are updated. # There is no reason to use this rule unless you only have a single # core and CPU time is an issue. +.PHONY: compile-one-process compile-one-process: doit $(LOADDEFS) compile-first $(lisp)/progmodes/cc-mode.elc $(emacs) $(BYTE_COMPILE_FLAGS) \ --eval "(batch-byte-recompile-directory 0)" $(lisp) @@ -356,6 +364,7 @@ MH_E_SRC = $(MH_E_DIR)/mh-acros.el $(MH_E_DIR)/mh-alias.el \ $(MH_E_DIR)/mh-tool-bar.el $(MH_E_DIR)/mh-utils.el \ $(MH_E_DIR)/mh-xface.el +.PHONY: mh-autoloads mh-autoloads: $(MH_E_DIR)/mh-loaddefs.el $(MH_E_DIR)/mh-loaddefs.el: $(MH_E_SRC) $(emacs) -l autoload \ @@ -418,6 +427,8 @@ $(CAL_DIR)/hol-loaddefs.el: $(CAL_SRC) --eval "(setq make-backup-files nil)" \ -f batch-update-autoloads $(CAL_DIR) +.PHONY: bootstrap-clean distclean maintainer-clean + bootstrap-clean: cd $(lisp); rm -f *.elc */*.elc */*/*.elc */*/*/*.elc $(AUTOGENEL) diff --git a/src/ChangeLog b/src/ChangeLog index d36fff428fe..792dc10f88c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2012-07-30 Paul Eggert + Update .PHONY listings in makefiles. + * Makefile.in (.PHONY): Add all, mostlyclean, clean, + bootstrap-clean, distclean, maintainer-clean, versioclean, + extraclean, frc. + * lisp.h (STRING_BYTES_BOUND): Cast entire result to ptrdiff_t. This is a bit clearer. Fix some commentary typos. diff --git a/src/Makefile.in b/src/Makefile.in index da458b4fb8a..2f96affeb56 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -391,6 +391,7 @@ LIBES = $(LIBS) $(LIBX_BASE) $(LIBX_OTHER) $(LIBSOUND) \ $(LIB_GCC) $(LIB_MATH) $(LIB_STANDARD) $(LIB_GCC) all: emacs$(EXEEXT) $(OTHER_FILES) +.PHONY: all $(leimdir)/leim-list.el: bootstrap-emacs$(EXEEXT) cd $(leimdir) && $(MAKE) $(MFLAGS) leim-list.el EMACS=$(bootstrap_exe) @@ -496,6 +497,8 @@ doc.o: buildobj.h ## If HAVE_NS, some ns-specific rules (for OTHER_FILES) are inserted here. @ns_frag@ +.PHONY: mostlyclean clean bootstrap-clean distclean maintainer-clean +.PHONY: versioclean extraclean frc mostlyclean: rm -f temacs$(EXEEXT) core *.core \#* *.o libXMenu11.a liblw.a From 302fc036e8b6305a45aca868e0001dd8fb3ed123 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 30 Jul 2012 20:07:33 +0300 Subject: [PATCH 83/89] Fix bug #12082 with input of Meta-non-ASCII-characters on MS-Windows. src/w32fns.c (w32_wnd_proc): Pass w32_keyboard_codepage to w32_kbd_patch_key as the 2nd arg. src/w32term.c : Renamed from keyboard_codepage and now external. All users changed. src/w32term.h: Add declaration of w32_keyboard_codepage. src/w32inevt.c (w32_kbd_patch_key): Accept an additional argument -- the codepage to translate keys to Unicode. If this argument is -1, use the value returned by GetConsoleCP. All callers changed. --- src/ChangeLog | 14 ++++++++++++++ src/w32fns.c | 4 ++-- src/w32inevt.c | 14 ++++++++++---- src/w32term.c | 21 +++++++++++---------- src/w32term.h | 3 +++ 5 files changed, 40 insertions(+), 16 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 792dc10f88c..be60f3d22b3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,17 @@ +2012-07-30 Eli Zaretskii + + * w32fns.c (w32_wnd_proc): Pass w32_keyboard_codepage to + w32_kbd_patch_key as the 2nd arg. (Bug#12082) + + * w32term.c : Renamed from + keyboard_codepage and now external. All users changed. + + * w32term.h: Add declaration of w32_keyboard_codepage. + + * w32inevt.c (w32_kbd_patch_key): Accept an additional argument -- + the codepage to translate keys to Unicode. If this argument is + -1, use the value returned by GetConsoleCP. All callers changed. + 2012-07-30 Paul Eggert Update .PHONY listings in makefiles. diff --git a/src/w32fns.c b/src/w32fns.c index 97b7001a3fa..91744e2691f 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -2882,7 +2882,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) key.uChar.AsciiChar = 0; key.dwControlKeyState = modifiers; - add = w32_kbd_patch_key (&key); + add = w32_kbd_patch_key (&key, w32_keyboard_codepage); /* 0 means an unrecognized keycode, negative means dead key. Ignore both. */ while (--add >= 0) @@ -2892,7 +2892,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) (hwnd, WM_CHAR, (unsigned char) key.uChar.AsciiChar, lParam, w32_get_key_modifiers (wParam, lParam)); - w32_kbd_patch_key (&key); + w32_kbd_patch_key (&key, w32_keyboard_codepage); } return 0; } diff --git a/src/w32inevt.c b/src/w32inevt.c index 6d869727d2f..731dd6715dc 100644 --- a/src/w32inevt.c +++ b/src/w32inevt.c @@ -185,9 +185,11 @@ is_dead_key (int wparam) } #endif -/* The return code indicates key code size. */ +/* The return code indicates key code size. cpID is the codepage to + use for translation to Unicode; -1 means use the current console + input codepage. */ int -w32_kbd_patch_key (KEY_EVENT_RECORD *event) +w32_kbd_patch_key (KEY_EVENT_RECORD *event, int cpId) { unsigned int key_code = event->wVirtualKeyCode; unsigned int mods = event->dwControlKeyState; @@ -243,7 +245,11 @@ w32_kbd_patch_key (KEY_EVENT_RECORD *event) keystate, buf, 128, 0); if (isdead > 0) { - int cpId = GetConsoleCP (); + /* When we are called from the GUI message processing code, + we are passed the current keyboard codepage, a positive + number, to use below. */ + if (cpId == -1) + cpId = GetConsoleCP (); event->uChar.UnicodeChar = buf[isdead - 1]; isdead = WideCharToMultiByte (cpId, 0, buf, isdead, @@ -442,7 +448,7 @@ key_event (KEY_EVENT_RECORD *event, struct input_event *emacs_ev, int *isdead) base character (ie. translating the base key plus shift modifier). */ else if (event->uChar.AsciiChar == 0) - w32_kbd_patch_key (event); + w32_kbd_patch_key (event, -1); } if (event->uChar.AsciiChar == 0) diff --git a/src/w32term.c b/src/w32term.c index f02d101cea3..7c4860d5139 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -155,6 +155,9 @@ int vertical_scroll_bar_bottom_border; int last_scroll_bar_drag_pos; +/* Keyboard code page - may be changed by language-change events. */ +int w32_keyboard_codepage; + /* Mouse movement. */ /* Where the mouse was last time we reported a mouse event. */ @@ -188,9 +191,6 @@ static int volatile input_signal_count; static int input_signal_count; #endif -/* Keyboard code page - may be changed by language-change events. */ -static int keyboard_codepage; - static void x_update_window_end (struct window *, int, int); static void w32_handle_tool_bar_click (struct frame *, struct input_event *); @@ -4235,14 +4235,14 @@ w32_read_socket (struct terminal *terminal, int expected, /* lParam contains the input language ID in its low 16 bits. Use it to update our record of the keyboard codepage. */ - keyboard_codepage = codepage_for_locale ((LCID)(msg.msg.lParam - & 0xffff)); + w32_keyboard_codepage = codepage_for_locale ((LCID)(msg.msg.lParam + & 0xffff)); if (f) { inev.kind = LANGUAGE_CHANGE_EVENT; XSETFRAME (inev.frame_or_window, f); - inev.code = keyboard_codepage; + inev.code = w32_keyboard_codepage; inev.modifiers = msg.msg.lParam & 0xffff; } break; @@ -4308,7 +4308,7 @@ w32_read_socket (struct terminal *terminal, int expected, { dbcs[0] = dbcs_lead; dbcs_lead = 0; - if (!MultiByteToWideChar (keyboard_codepage, 0, + if (!MultiByteToWideChar (w32_keyboard_codepage, 0, dbcs, 2, &code, 1)) { /* Garbage */ @@ -4318,7 +4318,7 @@ w32_read_socket (struct terminal *terminal, int expected, break; } } - else if (IsDBCSLeadByteEx (keyboard_codepage, + else if (IsDBCSLeadByteEx (w32_keyboard_codepage, (BYTE) msg.msg.wParam)) { dbcs_lead = (char) msg.msg.wParam; @@ -4327,7 +4327,7 @@ w32_read_socket (struct terminal *terminal, int expected, } else { - if (!MultiByteToWideChar (keyboard_codepage, 0, + if (!MultiByteToWideChar (w32_keyboard_codepage, 0, &dbcs[1], 1, &code, 1)) { /* What to do with garbage? */ @@ -6426,7 +6426,8 @@ w32_initialize (void) { DWORD input_locale_id = (DWORD) GetKeyboardLayout (0); - keyboard_codepage = codepage_for_locale ((LCID) (input_locale_id & 0xffff)); + w32_keyboard_codepage = + codepage_for_locale ((LCID) (input_locale_id & 0xffff)); } /* Create the window thread - it will terminate itself when the app diff --git a/src/w32term.h b/src/w32term.h index b49104dde8b..c0a958ba5e5 100644 --- a/src/w32term.h +++ b/src/w32term.h @@ -667,6 +667,9 @@ extern void x_delete_display (struct w32_display_info *dpyinfo); #define RIGHT_WIN_PRESSED 0x4000 #define APPS_PRESSED 0x2000 +/* The current ANSI input codepage for GUI sessions. */ +extern int w32_keyboard_codepage; + /* When compiling on Windows 9x/ME and NT 3.x, the following are not defined (even though they are supported on 98 and ME. */ #ifndef WM_MOUSELEAVE From c32af1e4a04ef689097f73430982b28392d72372 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 30 Jul 2012 11:44:51 -0700 Subject: [PATCH 84/89] Export DIRECTORY_SEP, TYPEMASK, VALMASK to GDB. * alloc.c (gdb_make_enums_visible) [USE_LSB_TAG]: Add lsb_bits. * lisp.h (enum lsb_bits) [USE_LSB_TAG]: New enum, for gdb_make_enums_visible. (TYPEMASK, VALMASK) [USE_LSB_TAGS]: Now enum constants, not macros. (DIRECTORY_SEP): Now a constant, not a macro. --- src/ChangeLog | 9 +++++++++ src/alloc.c | 3 +++ src/lisp.h | 9 ++++++--- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index be60f3d22b3..7aa4982f6ca 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2012-07-30 Paul Eggert + + Export DIRECTORY_SEP, TYPEMASK, VALMASK to GDB. + * alloc.c (gdb_make_enums_visible) [USE_LSB_TAG]: Add lsb_bits. + * lisp.h (enum lsb_bits) [USE_LSB_TAG]: New enum, for + gdb_make_enums_visible. + (TYPEMASK, VALMASK) [USE_LSB_TAGS]: Now enum constants, not macros. + (DIRECTORY_SEP): Now a constant, not a macro. + 2012-07-30 Eli Zaretskii * w32fns.c (w32_wnd_proc): Pass w32_keyboard_codepage to diff --git a/src/alloc.c b/src/alloc.c index c5ed1980d7c..4227b168c6b 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -6882,4 +6882,7 @@ union enum MAX_ALLOCA MAX_ALLOCA; enum More_Lisp_Bits More_Lisp_Bits; enum pvec_type pvec_type; +#if USE_LSB_TAG + enum lsb_bits lsb_bits; +#endif } const EXTERNALLY_VISIBLE gdb_make_enums_visible = {0}; diff --git a/src/lisp.h b/src/lisp.h index 1b88a51d2d4..2690ab90cb0 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -398,8 +398,11 @@ enum More_Lisp_Bits #if USE_LSB_TAG -static int const VALMASK = -1 << GCTYPEBITS; -#define TYPEMASK ((1 << GCTYPEBITS) - 1) +enum lsb_bits + { + TYPEMASK = (1 << GCTYPEBITS) - 1, + VALMASK = ~ TYPEMASK + }; #define XTYPE(a) ((enum Lisp_Type) (XLI (a) & TYPEMASK)) #define XINT(a) (XLI (a) >> INTTYPEBITS) #define XUINT(a) ((EMACS_UINT) XLI (a) >> INTTYPEBITS) @@ -3301,7 +3304,7 @@ extern void init_system_name (void); in addition to a device separator. Set the path separator to '/', and don't test for a device separator in IS_ANY_SEP. */ -#define DIRECTORY_SEP '/' +static char const DIRECTORY_SEP = '/'; #ifndef IS_DIRECTORY_SEP #define IS_DIRECTORY_SEP(_c_) ((_c_) == DIRECTORY_SEP) #endif From 7393bcbb8bf25c97aed35079da765436d4e9fc03 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 30 Jul 2012 11:56:42 -0700 Subject: [PATCH 85/89] * lisp.h (SWITCH_ENUM_CAST): Remove. All uses removed. This no-op macro hasn't been needed for many years. * src/regex.c (SWITCH_ENUM_CAST) [!emacs]: Likewise. --- admin/CPP-DEFINES | 2 -- src/ChangeLog | 4 ++++ src/alloc.c | 2 +- src/data.c | 6 +++--- src/keyboard.c | 2 +- src/lisp.h | 2 -- src/regex.c | 18 ++++++++---------- src/syntax.c | 8 ++++---- src/xdisp.c | 2 +- 9 files changed, 22 insertions(+), 24 deletions(-) diff --git a/admin/CPP-DEFINES b/admin/CPP-DEFINES index 9fc7ce3e33d..47963edecab 100644 --- a/admin/CPP-DEFINES +++ b/admin/CPP-DEFINES @@ -61,8 +61,6 @@ SYSTEM_TYPE ** Misc macros USER_FULL_NAME If defined, overrides the default pw->pw_gecos for getting at the full user name. Only MSDOS overrides the default. -** Replace, the definition is trivial: SWITCH_ENUM_CAST - ** Defines from src/s/*.h. Some of these might not be used in the code anymore, so they can be removed. The HAVE_* definitions are probably handled by autoconf, so it might be possible to just remove them from src/s/*.h. diff --git a/src/ChangeLog b/src/ChangeLog index 7aa4982f6ca..5354c6e29ba 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2012-07-30 Paul Eggert + * lisp.h (SWITCH_ENUM_CAST): Remove. All uses removed. + This no-op macro hasn't been needed for many years. + * src/regex.c (SWITCH_ENUM_CAST) [!emacs]: Likewise. + Export DIRECTORY_SEP, TYPEMASK, VALMASK to GDB. * alloc.c (gdb_make_enums_visible) [USE_LSB_TAG]: Add lsb_bits. * lisp.h (enum lsb_bits) [USE_LSB_TAG]: New enum, for diff --git a/src/alloc.c b/src/alloc.c index 4227b168c6b..5b2553c69cc 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -5926,7 +5926,7 @@ mark_object (Lisp_Object arg) #endif /* not GC_CHECK_MARKED_OBJECTS */ - switch (SWITCH_ENUM_CAST (XTYPE (obj))) + switch (XTYPE (obj)) { case Lisp_String: { diff --git a/src/data.c b/src/data.c index bef2888a969..fd873b22d4d 100644 --- a/src/data.c +++ b/src/data.c @@ -2522,7 +2522,7 @@ arith_driver (enum arithop code, ptrdiff_t nargs, Lisp_Object *args) ptrdiff_t ok_args; EMACS_INT ok_accum; - switch (SWITCH_ENUM_CAST (code)) + switch (code) { case Alogior: case Alogxor: @@ -2557,7 +2557,7 @@ arith_driver (enum arithop code, ptrdiff_t nargs, Lisp_Object *args) nargs, args); args[argnum] = val; next = XINT (args[argnum]); - switch (SWITCH_ENUM_CAST (code)) + switch (code) { case Aadd: if (INT_ADD_OVERFLOW (accum, next)) @@ -2643,7 +2643,7 @@ float_arith_driver (double accum, ptrdiff_t argnum, enum arithop code, args[argnum] = val; /* runs into a compiler bug. */ next = XINT (args[argnum]); } - switch (SWITCH_ENUM_CAST (code)) + switch (code) { case Aadd: accum += next; diff --git a/src/keyboard.c b/src/keyboard.c index 00e6f4cbbe9..d8533b796c3 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -5319,7 +5319,7 @@ make_lispy_event (struct input_event *event) { int i; - switch (SWITCH_ENUM_CAST (event->kind)) + switch (event->kind) { /* A simple keystroke. */ case ASCII_KEYSTROKE_EVENT: diff --git a/src/lisp.h b/src/lisp.h index 2690ab90cb0..2d9359abacf 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3319,8 +3319,6 @@ static char const DIRECTORY_SEP = '/'; #define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_)) #endif -#define SWITCH_ENUM_CAST(x) (x) - /* Use this to suppress gcc's warnings. */ #ifdef lint diff --git a/src/regex.c b/src/regex.c index 43ee2c45212..afe3751ea5e 100644 --- a/src/regex.c +++ b/src/regex.c @@ -255,8 +255,6 @@ xrealloc (void *block, size_t size) /* Sword must be nonzero for the wordchar pattern commands in re_match_2. */ enum syntaxcode { Swhitespace = 0, Sword = 1, Ssymbol = 2 }; -# define SWITCH_ENUM_CAST(x) (x) - /* Dummy macros for non-Emacs environments. */ # define CHAR_CHARSET(c) 0 # define CHARSET_LEADING_CODE_BASE(c) 0 @@ -3913,7 +3911,7 @@ analyse_first (const re_char *p, const re_char *pend, char *fastmap, const int m as used for the *? operator. */ re_char *p1 = p; - switch (SWITCH_ENUM_CAST ((re_opcode_t) *p++)) + switch (*p++) { case succeed: return 1; @@ -4088,7 +4086,7 @@ analyse_first (const re_char *p, const re_char *pend, char *fastmap, const int m visited. `re_compile' should make sure this is true. */ break; p += j; - switch (SWITCH_ENUM_CAST ((re_opcode_t) *p)) + switch (*p) { case on_failure_jump: case on_failure_keep_string_jump: @@ -4621,7 +4619,7 @@ static int bcmp_translate (re_char *s1, re_char *s2, static re_char * skip_one_char (const re_char *p) { - switch (SWITCH_ENUM_CAST (*p++)) + switch (*p++) { case anychar: break; @@ -4666,7 +4664,7 @@ skip_noops (const re_char *p, const re_char *pend) int mcnt; while (p < pend) { - switch (SWITCH_ENUM_CAST ((re_opcode_t) *p)) + switch (*p) { case start_memory: case stop_memory: @@ -4711,7 +4709,7 @@ mutually_exclusive_p (struct re_pattern_buffer *bufp, const re_char *p1, const r op2 = p2 == pend ? succeed : *p2; - switch (SWITCH_ENUM_CAST (op2)) + switch (op2) { case succeed: case endbuf: @@ -4835,7 +4833,7 @@ mutually_exclusive_p (struct re_pattern_buffer *bufp, const re_char *p1, const r break; case charset_not: - switch (SWITCH_ENUM_CAST (*p1)) + switch (*p1) { case exactn: case charset: @@ -5313,7 +5311,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, } /* Otherwise match next pattern command. */ - switch (SWITCH_ENUM_CAST ((re_opcode_t) *p++)) + switch (*p++) { /* Ignore these. Used to ignore the n of succeed_n's which currently have n == 0. */ @@ -6235,7 +6233,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, /* A restart point is known. Restore to that state. */ DEBUG_PRINT1 ("\nFAIL:\n"); POP_FAILURE_POINT (str, pat); - switch (SWITCH_ENUM_CAST ((re_opcode_t) *pat++)) + switch (*pat++) { case on_failure_keep_string_jump: assert (str == NULL); diff --git a/src/syntax.c b/src/syntax.c index 14bec9a9c2f..f0e30803dea 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -1152,7 +1152,7 @@ DEFUN ("internal-describe-syntax-value", Finternal_describe_syntax_value, insert_string ("\twhich means: "); - switch (SWITCH_ENUM_CAST (code)) + switch (code) { case Swhitespace: insert_string ("whitespace"); break; @@ -2525,7 +2525,7 @@ scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpf if (prefix) continue; - switch (SWITCH_ENUM_CAST (code)) + switch (code) { case Sescape: case Scharquote: @@ -2702,7 +2702,7 @@ scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpf else if (SYNTAX_FLAGS_PREFIX (syntax)) continue; - switch (SWITCH_ENUM_CAST (code)) + switch (code) { case Sword: case Ssymbol: @@ -3123,7 +3123,7 @@ do { prev_from = from; \ if (SYNTAX_FLAGS_PREFIX (prev_from_syntax)) continue; - switch (SWITCH_ENUM_CAST (code)) + switch (code) { case Sescape: case Scharquote: diff --git a/src/xdisp.c b/src/xdisp.c index 83f0ae830f8..e9bf472696d 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -20414,7 +20414,7 @@ display_mode_element (struct it *it, int depth, int field_width, int precision, depth++; - switch (SWITCH_ENUM_CAST (XTYPE (elt))) + switch (XTYPE (elt)) { case Lisp_String: { From 1f45e27eb651f5d13d83b1916470fc32fc8769ab Mon Sep 17 00:00:00 2001 From: Stefan Merten Date: Mon, 30 Jul 2012 21:54:07 +0200 Subject: [PATCH 86/89] Silence `checkdoc-ispell'. (rst-cvs-header, rst-svn-rev, rst-svn-timestamp) (rst-official-version, rst-official-cvs-rev) (rst-package-emacs-version-alist): Update to upstream V1.3.1. (rst-mode-map): New key binding. --- lisp/ChangeLog | 8 ++++++++ lisp/textmodes/rst.el | 27 ++++++++++++++++++--------- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0af7ff9ad11..8401578abf4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2012-07-30 Stefan Merten + + * rst.el: Silence `checkdoc-ispell'. + (rst-cvs-header, rst-svn-rev, rst-svn-timestamp) + (rst-official-version, rst-official-cvs-rev) + (rst-package-emacs-version-alist): Update to upstream V1.3.1. + (rst-mode-map): New key binding. + 2012-07-30 Paul Eggert Update .PHONY listings in makefiles. diff --git a/lisp/textmodes/rst.el b/lisp/textmodes/rst.el index 6e0562f4a4b..77dc7cc29bb 100644 --- a/lisp/textmodes/rst.el +++ b/lisp/textmodes/rst.el @@ -103,6 +103,8 @@ ;;; Code: +;; FIXME: Add proper ";;;###autoload" comments. + ;; FIXME: When 24.1 is common place remove use of `lexical-let' and put "-*- ;; lexical-binding: t -*-" in the first line. @@ -123,7 +125,7 @@ (defun rst-some (seq &optional pred) "Return non-nil if any element of SEQ yields non-nil when PRED is applied. Apply PRED to each element of list SEQ until the first non-nil -result is yielded and return this result. PRED defaults to +result is yielded and return this result. PRED defaults to `identity'." (unless pred (setq pred 'identity)) @@ -171,7 +173,7 @@ and before TAIL-RE and DELIM-RE in VAR or DEFAULT for no match." ;; Use CVSHeader to really get information from CVS and not other version ;; control systems. (defconst rst-cvs-header - "$CVSHeader: sm/rst_el/rst.el,v 1.287 2012-06-16 09:41:47 stefan Exp $") + "$CVSHeader: sm/rst_el/rst.el,v 1.301 2012-07-30 19:29:46 stefan Exp $") (defconst rst-cvs-rev (rst-extract-version "\\$" "CVSHeader: \\S + " "[0-9]+\\(?:\\.[0-9]+\\)+" " .*" rst-cvs-header "0.0") @@ -185,22 +187,22 @@ and before TAIL-RE and DELIM-RE in VAR or DEFAULT for no match." ;; Use LastChanged... to really get information from SVN. (defconst rst-svn-rev (rst-extract-version "\\$" "LastChangedRevision: " "[0-9]+" " " - "$LastChangedRevision: 7444 $") + "$LastChangedRevision: 7490 $") "The SVN revision of this file. SVN revision is the upstream (docutils) revision.") (defconst rst-svn-timestamp (rst-extract-version "\\$" "LastChangedDate: " ".+?+" " " - "$LastChangedDate: 2012-06-16 11:41:40 +0200 (Sat, 16 Jun 2012) $") + "$LastChangedDate: 2012-07-30 21:29:33 +0200 (Mon, 30 Jul 2012) $") "The SVN time stamp of this file.") ;; Maintained by the release process. (defconst rst-official-version (rst-extract-version "%" "OfficialVersion: " "[0-9]+\\(?:\\.[0-9]+\\)+" " " - "%OfficialVersion: 1.3.0 %") + "%OfficialVersion: 1.3.1 %") "Official version of the package.") (defconst rst-official-cvs-rev (rst-extract-version "[%$]" "Revision: " "[0-9]+\\(?:\\.[0-9]+\\)+" " " - "%Revision: 1.287 %") + "%Revision: 1.301 %") "CVS revision of this file in the official version.") (defconst rst-version @@ -217,7 +219,9 @@ in parentheses follows the development revision and the time stamp.") ("1.1.0" . "24.2") ("1.2.0" . "24.2") ("1.2.1" . "24.2") - ("1.3.0" . "24.2"))) + ("1.3.0" . "24.2") + ("1.3.1" . "24.2") + )) (unless (assoc rst-official-version rst-package-emacs-version-alist) (error "Version %s not listed in `rst-package-emacs-version-alist'" @@ -580,10 +584,13 @@ well but give an additional message." ;; ;; The adjustment function that adorns or rotates a section title. (rst-define-key map [?\C-c ?\C-=] 'rst-adjust [?\C-c ?\C-a t]) - (rst-define-key map [?\C-=] 'rst-adjust) ; (Does not work on the Mac OSX.) + (rst-define-key map [?\C-=] 'rst-adjust) ; Does not work on the Mac OSX and + ; on consoles. ;; \C-c \C-a is the keymap for adornments. (rst-define-key map [?\C-c ?\C-a ?\C-h] 'describe-prefix-bindings) + ;; Another binding which works with all types of input. + (rst-define-key map [?\C-c ?\C-a ?\C-a] 'rst-adjust) ;; Display the hierarchy of adornments implied by the current document ;; contents. (rst-define-key map [?\C-c ?\C-a ?\C-d] 'rst-display-adornments-hierarchy) @@ -3954,7 +3961,9 @@ An association list of the tool-set to a list of the (command to use, extension of produced filename, options to the tool (nil or a string)) to be used for converting the document." ;; FIXME: These are not options but symbols which may be referenced by - ;; `rst-compile-*-toolset` below. + ;; `rst-compile-*-toolset` below. The `:validate' keyword of + ;; `defcustom' may help to define this properly in newer Emacs + ;; versions (> 23.1). :type '(alist :options (html latex newlatex pseudoxml xml pdf s5) :key-type symbol :value-type (list :tag "Specification" From adff3182ba51523423ce15cf26347c2b8b130826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dj=C3=A4rv?= Date: Mon, 30 Jul 2012 22:10:31 +0200 Subject: [PATCH 87/89] Don't open files from Cocoa-parsed command line. --eval '(whatever)' will open '(whatever)' if --eval is the last option. * src/nsterm.m (ns_do_open_file): New variable. (ns_term_init): Set ns_do_open_file to NO after run returns. (openFile, openTempFile, openFileWithoutUI, openFiles): Open files only if ns_do_open_file. --- src/ChangeLog | 7 +++++++ src/nsterm.m | 30 ++++++++++++++++++++---------- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 5354c6e29ba..a7e6cb52eae 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2012-07-30 Jan Djärv + + * nsterm.m (ns_do_open_file): New variable. + (ns_term_init): Set ns_do_open_file to NO after run returns. + (openFile, openTempFile, openFileWithoutUI, openFiles): Open + files only if ns_do_open_file. + 2012-07-30 Paul Eggert * lisp.h (SWITCH_ENUM_CAST): Remove. All uses removed. diff --git a/src/nsterm.m b/src/nsterm.m index 1f06d49c5b9..4e181e9d1d2 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -195,6 +195,7 @@ Updated by Christian Limpach (chris@nice.ch) static NSMutableArray *ns_pending_files, *ns_pending_service_names, *ns_pending_service_args; static BOOL inNsSelect = 0; +static BOOL ns_do_open_file = NO; /* Convert modifiers in a NeXTstep event to emacs style modifiers. */ #define NS_FUNCTION_KEY_MASK 0x800000 @@ -4025,7 +4026,7 @@ static Lisp_Object ns_string_to_lispmod (const char *s) ns_pending_service_names = [[NSMutableArray alloc] init]; ns_pending_service_args = [[NSMutableArray alloc] init]; - /* Start app and create the main menu, window, view. +/* Start app and create the main menu, window, view. Needs to be here because ns_initialize_display_info () uses AppKit classes. The view will then ask the NSApp to stop and return to Emacs. */ [EmacsApp sharedApplication]; @@ -4205,7 +4206,7 @@ Needs to be here because ns_initialize_display_info () uses AppKit classes. #endif /* MAC OS X menu setup */ [NSApp run]; - + ns_do_open_file = YES; return dpyinfo; } @@ -4446,7 +4447,8 @@ - (NSApplicationTerminateReply)applicationShouldTerminate: (id)sender /* Notification from the Workspace to open a file */ - (BOOL)application: sender openFile: (NSString *)file { - [ns_pending_files addObject: file]; + if (ns_do_open_file) + [ns_pending_files addObject: file]; return YES; } @@ -4454,7 +4456,8 @@ - (BOOL)application: sender openFile: (NSString *)file /* Open a file as a temporary file */ - (BOOL)application: sender openTempFile: (NSString *)file { - [ns_pending_files addObject: file]; + if (ns_do_open_file) + [ns_pending_files addObject: file]; return YES; } @@ -4462,7 +4465,8 @@ - (BOOL)application: sender openTempFile: (NSString *)file /* Notification from the Workspace to open a file noninteractively (?) */ - (BOOL)application: sender openFileWithoutUI: (NSString *)file { - [ns_pending_files addObject: file]; + if (ns_do_open_file) + [ns_pending_files addObject: file]; return YES; } @@ -4470,11 +4474,17 @@ - (BOOL)application: sender openFileWithoutUI: (NSString *)file /* Notification from the Workspace to open multiple files */ - (void)application: sender openFiles: (NSArray *)fileList { - NSEnumerator *files = [fileList objectEnumerator]; - NSString *file; - while ((file = [files nextObject]) != nil) - [ns_pending_files addObject: file]; - + /* Don't open files from the command line, Cocoa parses the command line + wrong anyway, --option value tries to open value if --option is the last + option. */ + if (ns_ignore_open_file) + { + NSEnumerator *files = [fileList objectEnumerator]; + NSString *file; + while ((file = [files nextObject]) != nil) + [ns_pending_files addObject: file]; + } + [self replyToOpenOrPrint: NSApplicationDelegateReplySuccess]; } From 8f25abd317c64e2a69e1839633382841c3848a2d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 30 Jul 2012 13:34:58 -0700 Subject: [PATCH 88/89] Do not overwrite config.status while executing it. * Makefile.in (MAKEFILE_NAME): New macro. ($(MAKEFILE_NAME)): Rename rule from Makefile. * configure.ac (epaths): Set MAKEFILE_NAME to a bogus value, so that GNU 'make' isn't tempted to make the Makefile and then regenerate config.status while config.status is running. Fixes: debbugs:11214 --- ChangeLog | 7 +++++++ Makefile.in | 7 ++++++- configure.ac | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index d3c52b6922d..14bf1f385cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2012-07-30 Paul Eggert + Do not overwrite config.status while executing it (Bug#11214). + * Makefile.in (MAKEFILE_NAME): New macro. + ($(MAKEFILE_NAME)): Rename rule from Makefile. + * configure.ac (epaths): Set MAKEFILE_NAME to a bogus value, + so that GNU 'make' isn't tempted to make the Makefile and then + regenerate config.status while config.status is running. + Update .PHONY listings in makefiles. * Makefile.in (.PHONY): Add all, ${SUBDIR}, blessmail, epath-force, FRC, install-arch-dep, install-arch-indep, install-doc, diff --git a/Makefile.in b/Makefile.in index 4b9364ac3f4..89c06cce16e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -350,7 +350,12 @@ blessmail: Makefile src FRC # We used to have one rule per */Makefile.in, but that leads to race # conditions with parallel makes, so let's assume that the time stamp on # ./Makefile is representative of the time stamp on all the other Makefiles. -Makefile: config.status $(srcdir)/src/config.in \ +# +# config.status overrides MAKEFILE_NAME with a bogus name when creating +# src/epaths.h, so that 'make epaths-force' does not recursively invoke +# config.status and overwrite config.status while executing it (Bug#11214). +MAKEFILE_NAME = Makefile +$(MAKEFILE_NAME): config.status $(srcdir)/src/config.in \ $(srcdir)/Makefile.in $(SUBDIR_MAKEFILES_IN) ./config.status diff --git a/configure.ac b/configure.ac index 23833f4913c..a68caca4072 100644 --- a/configure.ac +++ b/configure.ac @@ -4464,7 +4464,7 @@ dnl by configure. This also explains the `move-if-change' test and dnl the use of force in the `epaths-force' rule in Makefile.in. AC_CONFIG_COMMANDS([epaths], [ echo creating src/epaths.h -${MAKE-make} epaths-force +${MAKE-make} MAKEFILE_NAME=do-not-make-Makefile epaths-force ], [GCC="$GCC" CPPFLAGS="$CPPFLAGS"]) AC_CONFIG_COMMANDS([gdbinit], [ From b429a4eee4e09b1ba09e17ced5091d042955d84f Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 30 Jul 2012 17:20:43 -0400 Subject: [PATCH 89/89] Use an include file in configure.ac's AH_BOTTOM * configure.ac (AH_BOTTOM): Use an include file, so that the contents do not get processed by autoheader. Eg this prevents undefs being commented out, and is the recommended technique from the autoconf manual. * src/conf_post.h: New, split from configure.ac's AH_BOTTOM. * src/Makefile.in (config_h): Add conf_post.h. * src/makefile.w32-in (CONFIG_H): Add conf_post.h. --- ChangeLog | 5 ++ configure.ac | 103 +--------------------------------- src/ChangeLog | 6 ++ src/Makefile.in | 2 +- src/conf_post.h | 131 ++++++++++++++++++++++++++++++++++++++++++++ src/makefile.w32-in | 1 + 6 files changed, 145 insertions(+), 103 deletions(-) create mode 100644 src/conf_post.h diff --git a/ChangeLog b/ChangeLog index 14bf1f385cd..b0860362b1c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-07-30 Glenn Morris + + * configure.ac (AH_BOTTOM): Use an include file, so that the + contents do not get processed by autoheader. + 2012-07-30 Paul Eggert Do not overwrite config.status while executing it (Bug#11214). diff --git a/configure.ac b/configure.ac index a68caca4072..402524f436d 100644 --- a/configure.ac +++ b/configure.ac @@ -4198,108 +4198,7 @@ along with GNU Emacs. If not, see . */ #define EMACS_CONFIG_H ])dnl -dnl FIXME undefs in here get commented out by autoconf. :( -AH_BOTTOM([ -/* On AIX 3 this must be included before any other include file. */ -#include -#if ! HAVE_ALLOCA -# error "alloca not available on this machine" -#endif - -#ifdef SIGNAL_H_AHB -#undef SIGNAL_H_AHB -#include -#endif - -/* This silences a few compilation warnings on FreeBSD. */ -#ifdef BSD_SYSTEM_AHB -#undef BSD_SYSTEM_AHB -#undef BSD_SYSTEM -#if __FreeBSD__ == 1 -#define BSD_SYSTEM 199103 -#elif __FreeBSD__ == 2 -#define BSD_SYSTEM 199306 -#elif __FreeBSD__ >= 3 -#define BSD_SYSTEM 199506 -#endif -#endif - -/* Define AMPERSAND_FULL_NAME if you use the convention - that & in the full name stands for the login id. */ -/* Turned on June 1996 supposing nobody will mind it. */ -#define AMPERSAND_FULL_NAME - -/* `subprocesses' should be defined if you want to - have code for asynchronous subprocesses - (as used in M-x compile and M-x shell). - Only MSDOS does not support this (it overrides - this in its config_opsysfile below). */ - -#define subprocesses - -/* Include the os dependent file. */ -#ifdef config_opsysfile -# include config_opsysfile -#endif - -/* Mac OS X / GNUstep need a bit more pure memory. Of the existing knobs, - SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems. */ -#ifdef HAVE_NS -#if defined NS_IMPL_GNUSTEP -# define SYSTEM_PURESIZE_EXTRA 30000 -#elif defined DARWIN_OS -# define SYSTEM_PURESIZE_EXTRA 200000 -#endif -#endif - -#ifdef emacs /* Don't do this for lib-src. */ -/* Tell regex.c to use a type compatible with Emacs. */ -#define RE_TRANSLATE_TYPE Lisp_Object -#define RE_TRANSLATE(TBL, C) CHAR_TABLE_TRANSLATE (TBL, C) -#ifdef make_number -/* If make_number is a macro, use it. */ -#define RE_TRANSLATE_P(TBL) (!EQ (TBL, make_number (0))) -#else -/* If make_number is a function, avoid it. */ -#define RE_TRANSLATE_P(TBL) (!(INTEGERP (TBL) && XINT (TBL) == 0)) -#endif -#endif - -#include -#include - -#if __GNUC__ >= 3 /* On GCC 3.0 we might get a warning. */ -#define NO_INLINE __attribute__((noinline)) -#else -#define NO_INLINE -#endif - -#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) -#define EXTERNALLY_VISIBLE __attribute__((externally_visible)) -#else -#define EXTERNALLY_VISIBLE -#endif - -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) -# define ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) -#else -# define ATTRIBUTE_FORMAT(spec) /* empty */ -#endif - -#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) -# define ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \ - ATTRIBUTE_FORMAT ((__gnu_printf__, formatstring_parameter, first_argument)) -#else -# define ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \ - ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument)) -#endif - -#define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST - -/* Some versions of GNU/Linux define noinline in their headers. */ -#ifdef noinline -#undef noinline -#endif +AH_BOTTOM([#include #endif /* EMACS_CONFIG_H */ diff --git a/src/ChangeLog b/src/ChangeLog index a7e6cb52eae..f3e8b58e071 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2012-07-30 Glenn Morris + + * conf_post.h: New, split from configure.ac's AH_BOTTOM. + * Makefile.in (config_h): Add conf_post.h. + * makefile.w32-in (CONFIG_H): Add conf_post.h. + 2012-07-30 Jan Djärv * nsterm.m (ns_do_open_file): New variable. diff --git a/src/Makefile.in b/src/Makefile.in index 2f96affeb56..1ea7d162b14 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -57,7 +57,7 @@ lispdir = ../lisp # Configuration files for .o files to depend on. S_FILE = @S_FILE@ -config_h = config.h $(S_FILE) +config_h = config.h conf_post.h $(S_FILE) bootstrap_exe = $(abs_builddir)/bootstrap-emacs$(EXEEXT) diff --git a/src/conf_post.h b/src/conf_post.h new file mode 100644 index 00000000000..5efecfb8c05 --- /dev/null +++ b/src/conf_post.h @@ -0,0 +1,131 @@ +/* conf_post.h --- configure.ac includes this via AH_BOTTOM + +Copyright (C) 1988, 1993-1994, 1999-2002, 2004-2012 + Free Software Foundation, Inc. + +This file is part of GNU Emacs. + +GNU Emacs is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +GNU Emacs is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Emacs. If not, see . */ + +/* Commentary: + + Rather than writing this code directly in AH_BOTTOM, we include it + via this file. This is so that it does not get processed by + autoheader. Eg, any undefs here would otherwise be commented out. +*/ + +/* Code: */ + +/* On AIX 3 this must be included before any other include file. */ +#include +#if ! HAVE_ALLOCA +# error "alloca not available on this machine" +#endif + +#ifdef SIGNAL_H_AHB +#undef SIGNAL_H_AHB +#include +#endif + +/* This silences a few compilation warnings on FreeBSD. */ +#ifdef BSD_SYSTEM_AHB +#undef BSD_SYSTEM_AHB +#undef BSD_SYSTEM +#if __FreeBSD__ == 1 +#define BSD_SYSTEM 199103 +#elif __FreeBSD__ == 2 +#define BSD_SYSTEM 199306 +#elif __FreeBSD__ >= 3 +#define BSD_SYSTEM 199506 +#endif +#endif + +/* Define AMPERSAND_FULL_NAME if you use the convention + that & in the full name stands for the login id. */ +/* Turned on June 1996 supposing nobody will mind it. */ +#define AMPERSAND_FULL_NAME + +/* `subprocesses' should be defined if you want to + have code for asynchronous subprocesses + (as used in M-x compile and M-x shell). + Only MSDOS does not support this (it overrides + this in its config_opsysfile below). */ + +#define subprocesses + +/* Include the os dependent file. */ +#ifdef config_opsysfile +# include config_opsysfile +#endif + +/* Mac OS X / GNUstep need a bit more pure memory. Of the existing knobs, + SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems. */ +#ifdef HAVE_NS +#if defined NS_IMPL_GNUSTEP +# define SYSTEM_PURESIZE_EXTRA 30000 +#elif defined DARWIN_OS +# define SYSTEM_PURESIZE_EXTRA 200000 +#endif +#endif + +#ifdef emacs /* Don't do this for lib-src. */ +/* Tell regex.c to use a type compatible with Emacs. */ +#define RE_TRANSLATE_TYPE Lisp_Object +#define RE_TRANSLATE(TBL, C) CHAR_TABLE_TRANSLATE (TBL, C) +#ifdef make_number +/* If make_number is a macro, use it. */ +#define RE_TRANSLATE_P(TBL) (!EQ (TBL, make_number (0))) +#else +/* If make_number is a function, avoid it. */ +#define RE_TRANSLATE_P(TBL) (!(INTEGERP (TBL) && XINT (TBL) == 0)) +#endif +#endif + +#include +#include + +#if __GNUC__ >= 3 /* On GCC 3.0 we might get a warning. */ +#define NO_INLINE __attribute__((noinline)) +#else +#define NO_INLINE +#endif + +#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) +#define EXTERNALLY_VISIBLE __attribute__((externally_visible)) +#else +#define EXTERNALLY_VISIBLE +#endif + +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) +# define ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) +#else +# define ATTRIBUTE_FORMAT(spec) /* empty */ +#endif + +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) +# define ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \ + ATTRIBUTE_FORMAT ((__gnu_printf__, formatstring_parameter, first_argument)) +#else +# define ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \ + ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument)) +#endif + +#define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST + +/* Some versions of GNU/Linux define noinline in their headers. */ +#ifdef noinline +#undef noinline +#endif + +/* conf_post.h ends here */ diff --git a/src/makefile.w32-in b/src/makefile.w32-in index 45972db2cf4..10ab0619fb4 100644 --- a/src/makefile.w32-in +++ b/src/makefile.w32-in @@ -406,6 +406,7 @@ CODING_H = $(SRC)/coding.h \ MS_W32_H = $(SRC)/s/ms-w32.h \ $(NT_INC)/sys/stat.h CONFIG_H = $(SRC)/config.h \ + $(SRC)/conf_post.h \ $(MS_W32_H) DIR_H = $(NT_INC)/sys/dir.h \ $(SRC)/ndir.h