Now on revision 113366. ------------------------------------------------------------ revno: 113366 fixes bug: http://debbugs.gnu.org/11861 committer: Leo Liu branch nick: trunk timestamp: Thu 2013-07-11 10:59:54 +0800 message: * ido.el (ido-read-file-name): Conform to the requirements of read-file-name. (ido-read-directory-name): Conform to the requirements of read-directory-name. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-07-11 01:49:17 +0000 +++ lisp/ChangeLog 2013-07-11 02:59:54 +0000 @@ -1,3 +1,10 @@ +2013-07-11 Leo Liu + + * ido.el (ido-read-file-name): Conform to the requirements of + read-file-name. (Bug#11861) + (ido-read-directory-name): Conform to the requirements of + read-directory-name. + 2013-07-11 Juanma Barranquero * subr.el (delay-warning): New function. === modified file 'lisp/ido.el' --- lisp/ido.el 2013-07-09 05:09:45 +0000 +++ lisp/ido.el 2013-07-11 02:59:54 +0000 @@ -4780,7 +4780,14 @@ (ido-find-literal nil)) (setq ido-exit nil) (setq filename - (ido-read-internal 'file prompt 'ido-file-history default-filename mustmatch initial)) + (ido-read-internal 'file prompt 'ido-file-history + (cond ; Bug#11861. + ((stringp default-filename) default-filename) + ((consp default-filename) (car default-filename)) + ((and (not default-filename) initial) + (expand-file-name initial dir)) + (buffer-file-name buffer-file-name)) + mustmatch initial)) (setq dir ido-current-directory) ; See bug#1516. (cond ((eq ido-exit 'fallback) @@ -4813,8 +4820,13 @@ (ido-directory-too-big-p ido-current-directory))) (ido-work-directory-index -1) (ido-work-file-index -1)) - (setq filename - (ido-read-internal 'dir prompt 'ido-file-history default-dirname mustmatch initial)) + (setq filename (ido-read-internal + 'dir prompt 'ido-file-history + (or default-dirname ; Bug#11861. + (if initial + (expand-file-name initial ido-current-directory) + ido-current-directory)) + mustmatch initial)) (cond ((eq ido-exit 'fallback) (let ((read-file-name-function nil)) ------------------------------------------------------------ revno: 113365 committer: Paul Eggert branch nick: trunk timestamp: Wed 2013-07-10 19:17:47 -0700 message: * sysdep.c, term.c, termcap.c, terminal.c: Integer-related minor fixes. * sysdep.c (emacs_get_tty): Return void, since nobody uses the value. (emacs_set_tty): Now static. * sysdep.c (emacs_set_tty, tabs_safe_p, emacs_close): * term.c (tty_capable_p, tty_default_color_capabilities) (get_tty_terminal, term_mouse_movement) (handle_one_term_event, init_tty, maybe_fatal): * termcap.c (tgetst1, struct termcap_buffer, valid_filename_p) (tgetent, scan_file, name_match, compare_contin): * terminal.c (get_terminal): Use bool for boolean. * sysdep.c (init_system_name): Don't overflow stack on huge hostname. Prefer char to unsigned char if either will do. * term.c (OUTPUT, turn_on_face): Omit unnecessary casts to int. (tty_write_glyphs): Prefer int to unsigned. (produce_glyphless_glyph): Remove 2nd (unused) int arg. All callers changed. * termcap.c (tprint, main) [TEST]: Remove non-working test. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-07-10 23:23:57 +0000 +++ src/ChangeLog 2013-07-11 02:17:47 +0000 @@ -1,3 +1,24 @@ +2013-07-11 Paul Eggert + + * sysdep.c, term.c, termcap.c, terminal.c: Integer-related minor fixes. + * sysdep.c (emacs_get_tty): Return void, since nobody uses the value. + (emacs_set_tty): Now static. + * sysdep.c (emacs_set_tty, tabs_safe_p, emacs_close): + * term.c (tty_capable_p, tty_default_color_capabilities) + (get_tty_terminal, term_mouse_movement) + (handle_one_term_event, init_tty, maybe_fatal): + * termcap.c (tgetst1, struct termcap_buffer, valid_filename_p) + (tgetent, scan_file, name_match, compare_contin): + * terminal.c (get_terminal): + Use bool for boolean. + * sysdep.c (init_system_name): Don't overflow stack on huge hostname. + Prefer char to unsigned char if either will do. + * term.c (OUTPUT, turn_on_face): Omit unnecessary casts to int. + (tty_write_glyphs): Prefer int to unsigned. + (produce_glyphless_glyph): Remove 2nd (unused) int arg. + All callers changed. + * termcap.c (tprint, main) [TEST]: Remove non-working test. + 2013-07-10 Paul Eggert Port to C89. === modified file 'src/dispextern.h' --- src/dispextern.h 2013-07-06 10:41:38 +0000 +++ src/dispextern.h 2013-07-11 02:17:47 +0000 @@ -3298,7 +3298,7 @@ void get_tty_size (int, int *, int *); void request_sigio (void); void unrequest_sigio (void); -int tabs_safe_p (int); +bool tabs_safe_p (int); void init_baud_rate (int); void init_sigio (int); void ignore_sigio (void); @@ -3470,11 +3470,12 @@ extern int per_line_cost (const char *); extern void calculate_costs (struct frame *); extern void produce_glyphs (struct it *); -extern int tty_capable_p (struct tty_display_info *, unsigned, unsigned long, unsigned long); +extern bool tty_capable_p (struct tty_display_info *, unsigned, + unsigned long, unsigned long); extern void set_tty_color_mode (struct tty_display_info *, struct frame *); extern struct terminal *get_named_tty (const char *); extern void create_tty_output (struct frame *); -extern struct terminal *init_tty (const char *, const char *, int); +extern struct terminal *init_tty (const char *, const char *, bool); extern void tty_append_glyph (struct it *); === modified file 'src/sysdep.c' --- src/sysdep.c 2013-07-10 23:23:57 +0000 +++ src/sysdep.c 2013-07-11 02:17:47 +0000 @@ -102,8 +102,8 @@ #include "syssignal.h" #include "systime.h" -static int emacs_get_tty (int, struct emacs_tty *); -static int emacs_set_tty (int, struct emacs_tty *, int); +static void emacs_get_tty (int, struct emacs_tty *); +static int emacs_set_tty (int, struct emacs_tty *, bool); /* ULLONG_MAX is missing on Red Hat Linux 7.3; see Bug#11781. */ #ifndef ULLONG_MAX @@ -769,31 +769,26 @@ /* Getting and setting emacs_tty structures. */ -/* Set *TC to the parameters associated with the terminal FD. - Return zero if all's well, or -1 if we ran into an error we - couldn't deal with. */ -int +/* Set *TC to the parameters associated with the terminal FD, + or clear it if the parameters are not available. */ +static void emacs_get_tty (int fd, struct emacs_tty *settings) { /* Retrieve the primary parameters - baud rate, character size, etcetera. */ #ifndef DOS_NT /* We have those nifty POSIX tcmumbleattr functions. */ memset (&settings->main, 0, sizeof (settings->main)); - if (tcgetattr (fd, &settings->main) < 0) - return -1; + tcgetattr (fd, &settings->main); #endif - - /* We have survived the tempest. */ - return 0; } /* Set the parameters of the tty on FD according to the contents of - *SETTINGS. If FLUSHP is non-zero, we discard input. - Return 0 if all went well, and -1 if anything failed. */ + *SETTINGS. If FLUSHP, discard input. + Return 0 if all went well, and -1 (setting errno) if anything failed. */ -int -emacs_set_tty (int fd, struct emacs_tty *settings, int flushp) +static int +emacs_set_tty (int fd, struct emacs_tty *settings, bool flushp) { /* Set the primary parameters - baud rate, character size, etcetera. */ #ifndef DOS_NT @@ -1118,10 +1113,10 @@ tty_out->term_initted = 1; } -/* Return nonzero if safe to use tabs in output. +/* Return true if safe to use tabs in output. At the time this is called, init_sys_modes has not been done yet. */ -int +bool tabs_safe_p (int fd) { struct emacs_tty etty; @@ -1375,8 +1370,10 @@ uname (&uts); Vsystem_name = build_string (uts.nodename); #else /* HAVE_GETHOSTNAME */ - unsigned int hostname_size = 256; - char *hostname = alloca (hostname_size); + char *hostname_alloc = NULL; + char hostname_buf[256]; + ptrdiff_t hostname_size = sizeof hostname_buf; + char *hostname = hostname_buf; /* Try to get the host name; if the buffer is too short, try again. Apparently, the only indication gethostname gives of @@ -1391,8 +1388,8 @@ if (strlen (hostname) < hostname_size - 1) break; - hostname_size <<= 1; - hostname = alloca (hostname_size); + hostname = hostname_alloc = xpalloc (hostname_alloc, &hostname_size, 1, + min (PTRDIFF_MAX, SIZE_MAX), 1); } #ifdef HAVE_SOCKETS /* Turn the hostname into the official, fully-qualified hostname. @@ -1437,7 +1434,13 @@ } if (it) { - hostname = alloca (strlen (it->ai_canonname) + 1); + ptrdiff_t len = strlen (it->ai_canonname); + if (hostname_size <= len) + { + hostname_size = len + 1; + hostname = hostname_alloc = xrealloc (hostname_alloc, + hostname_size); + } strcpy (hostname, it->ai_canonname); } freeaddrinfo (res); @@ -1484,10 +1487,11 @@ } #endif /* HAVE_SOCKETS */ Vsystem_name = build_string (hostname); + xfree (hostname_alloc); #endif /* HAVE_GETHOSTNAME */ { - unsigned char *p; - for (p = SDATA (Vsystem_name); *p; p++) + char *p; + for (p = SSDATA (Vsystem_name); *p; p++) if (*p == ' ' || *p == '\t') *p = '-'; } @@ -2200,8 +2204,8 @@ int emacs_close (int fd) { - int did_retry = 0; - register int rtnval; + bool did_retry = 0; + int rtnval; while ((rtnval = close (fd)) == -1 && (errno == EINTR)) === modified file 'src/term.c' --- src/term.c 2013-07-06 02:40:50 +0000 +++ src/term.c 2013-07-11 02:17:47 +0000 @@ -71,13 +71,13 @@ static void tty_show_cursor (struct tty_display_info *); static void tty_hide_cursor (struct tty_display_info *); static void tty_background_highlight (struct tty_display_info *tty); -static struct terminal *get_tty_terminal (Lisp_Object, int); +static struct terminal *get_tty_terminal (Lisp_Object, bool); static void clear_tty_hooks (struct terminal *terminal); static void set_tty_hooks (struct terminal *terminal); static void dissociate_if_controlling_tty (int fd); static void delete_tty (struct terminal *); -static _Noreturn void maybe_fatal (int must_succeed, struct terminal *terminal, - const char *str1, const char *str2, ...) +static _Noreturn void maybe_fatal (bool, struct terminal *, + const char *, const char *, ...) ATTRIBUTE_FORMAT_PRINTF (3, 5) ATTRIBUTE_FORMAT_PRINTF (4, 5); static _Noreturn void vfatal (const char *str, va_list ap) ATTRIBUTE_FORMAT_PRINTF (1, 0); @@ -85,8 +85,7 @@ #define OUTPUT(tty, a) \ emacs_tputs ((tty), a, \ - (int) (FRAME_LINES (XFRAME (selected_frame)) \ - - curY (tty)), \ + FRAME_LINES (XFRAME (selected_frame)) - curY (tty), \ cmputc) #define OUTPUT1(tty, a) emacs_tputs ((tty), a, 1, cmputc) @@ -695,7 +694,7 @@ { unsigned char *conversion_buffer; struct coding_system *coding; - size_t n, stringlen; + int n, stringlen; struct tty_display_info *tty = FRAME_TTY (f); @@ -1431,7 +1430,7 @@ static void append_composite_glyph (struct it *); static void produce_composite_glyph (struct it *); static void append_glyphless_glyph (struct it *, int, const char *); -static void produce_glyphless_glyph (struct it *, int, Lisp_Object); +static void produce_glyphless_glyph (struct it *, Lisp_Object); /* Append glyphs to IT's glyph_row. Called from produce_glyphs for terminal frames if IT->glyph_row != NULL. IT->char_to_display is @@ -1551,7 +1550,7 @@ if (it->what == IT_GLYPHLESS) { - produce_glyphless_glyph (it, 0, Qnil); + produce_glyphless_glyph (it, Qnil); goto done; } @@ -1620,7 +1619,7 @@ Lisp_Object acronym = lookup_glyphless_char_display (-1, it); eassert (it->what == IT_GLYPHLESS); - produce_glyphless_glyph (it, 1, acronym); + produce_glyphless_glyph (it, acronym); } } @@ -1794,14 +1793,12 @@ the character. See the description of enum glyphless_display_method in dispextern.h for the details. - FOR_NO_FONT is nonzero if and only if this is for a character that - is not supported by the coding system of the terminal. ACRONYM, if - non-nil, is an acronym string for the character. + ACRONYM, if non-nil, is an acronym string for the character. The glyphs actually produced are of type CHAR_GLYPH. */ static void -produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) +produce_glyphless_glyph (struct it *it, Lisp_Object acronym) { int face_id; int len; @@ -1968,7 +1965,7 @@ ts = tty->standout_mode ? tty->TS_set_background : tty->TS_set_foreground; if (fg >= 0 && ts) { - p = tparam (ts, NULL, 0, (int) fg, 0, 0, 0); + p = tparam (ts, NULL, 0, fg, 0, 0, 0); OUTPUT (tty, p); xfree (p); } @@ -1976,7 +1973,7 @@ ts = tty->standout_mode ? tty->TS_set_foreground : tty->TS_set_background; if (bg >= 0 && ts) { - p = tparam (ts, NULL, 0, (int) bg, 0, 0, 0); + p = tparam (ts, NULL, 0, bg, 0, 0, 0); OUTPUT (tty, p); xfree (p); } @@ -2027,11 +2024,11 @@ } -/* Return non-zero if the terminal on frame F supports all of the +/* Return true if the terminal on frame F supports all of the capabilities in CAPS simultaneously, with foreground and background colors FG and BG. */ -int +bool tty_capable_p (struct tty_display_info *tty, unsigned int caps, unsigned long fg, unsigned long bg) { @@ -2099,7 +2096,7 @@ /* Save or restore the default color-related capabilities of this terminal. */ static void -tty_default_color_capabilities (struct tty_display_info *tty, int save) +tty_default_color_capabilities (struct tty_display_info *tty, bool save) { if (save) @@ -2209,7 +2206,7 @@ /* Return the tty display object specified by TERMINAL. */ static struct terminal * -get_tty_terminal (Lisp_Object terminal, int throw) +get_tty_terminal (Lisp_Object terminal, bool throw) { struct terminal *t = get_terminal (terminal, throw); @@ -2519,7 +2516,7 @@ cursor_to (f, save_y, save_x); } -static int +static bool term_mouse_movement (FRAME_PTR frame, Gpm_Event *event) { /* Has the mouse moved off the glyph it was on at the last sighting? */ @@ -2649,7 +2646,7 @@ { struct frame *f = XFRAME (tty->top_frame); struct input_event ie; - int do_help = 0; + bool do_help = 0; int count = 0; EVENT_INIT (ie); @@ -2934,7 +2931,7 @@ If MUST_SUCCEED is true, then all errors are fatal. */ struct terminal * -init_tty (const char *name, const char *terminal_type, int must_succeed) +init_tty (const char *name, const char *terminal_type, bool must_succeed) { char *area = NULL; char **address = &area; @@ -2942,7 +2939,7 @@ int status; struct tty_display_info *tty = NULL; struct terminal *terminal = NULL; - int ctty = 0; /* 1 if asked to open controlling tty. */ + bool ctty = 0; /* True if asked to open controlling tty. */ if (!terminal_type) maybe_fatal (must_succeed, 0, @@ -3412,10 +3409,10 @@ /* Auxiliary error-handling function for init_tty. Delete TERMINAL, then call error or fatal with str1 or str2, - respectively, according to whether MUST_SUCCEED is zero or not. */ + respectively, according to whether MUST_SUCCEED is true. */ static void -maybe_fatal (int must_succeed, struct terminal *terminal, +maybe_fatal (bool must_succeed, struct terminal *terminal, const char *str1, const char *str2, ...) { va_list ap; === modified file 'src/termcap.c' --- src/termcap.c 2013-07-06 02:40:50 +0000 +++ src/termcap.c 2013-07-11 02:17:47 +0000 @@ -213,8 +213,8 @@ abbreviation expansion makes that effort a little more hairy than its worth; this is cleaner. */ { - register int last_p_param = 0; - int remove_p_params = 1; + int last_p_param = 0; + bool remove_p_params = 1; struct { char *beg; int len; } cut[11]; for (cut[0].beg = p = ret; p < r - 3; p++) @@ -318,26 +318,26 @@ char *beg; ptrdiff_t size; char *ptr; - int ateof; + bool ateof; ptrdiff_t full; }; /* Forward declarations of static functions. */ -static int scan_file (char *str, int fd, register struct termcap_buffer *bufp); -static char *gobble_line (int fd, register struct termcap_buffer *bufp, char *append_end); -static int compare_contin (register char *str1, register char *str2); -static int name_match (char *line, char *name); +static bool scan_file (char *, int, struct termcap_buffer *); +static char *gobble_line (int, struct termcap_buffer *, char *); +static bool compare_contin (char *, char *); +static bool name_match (char *, char *); -#ifdef MSDOS /* MW, May 1993 */ -static int +static bool valid_filename_p (char *fn) { +#ifdef MSDOS return *fn == '/' || fn[1] == ':'; -} #else -#define valid_filename_p(fn) (*(fn) == '/') + return *fn == '/'; #endif +} /* Find the termcap entry data for terminal type NAME and store it in the block that BP points to. @@ -360,10 +360,10 @@ char *tc_search_point; char *term; ptrdiff_t malloc_size = 0; - register int c; + int c; char *tcenv = NULL; /* TERMCAP value, if it contains :tc=. */ char *indirect = NULL; /* Terminal type in :tc= in TERMCAP value. */ - int filep; + bool filep; #ifdef INTERNAL_TERMINAL /* For the internal terminal we don't want to read any termcap file, @@ -510,10 +510,10 @@ Return 1 if successful, with that line in BUFP, or 0 if no entry is found in the file. */ -static int -scan_file (char *str, int fd, register struct termcap_buffer *bufp) +static bool +scan_file (char *str, int fd, struct termcap_buffer *bufp) { - register char *end; + char *end; bufp->ptr = bufp->beg; bufp->full = 0; @@ -544,13 +544,13 @@ return 0; } -/* Return nonzero if NAME is one of the names specified +/* Return true if NAME is one of the names specified by termcap entry LINE. */ -static int +static bool name_match (char *line, char *name) { - register char *tem; + char *tem; if (!compare_contin (line, name)) return 1; @@ -562,18 +562,18 @@ return 0; } -static int -compare_contin (register char *str1, register char *str2) +static bool +compare_contin (char *str1, char *str2) { - register int c1, c2; while (1) { - c1 = *str1++; - c2 = *str2++; + int c1 = *str1++; + int c2 = *str2++; while (c1 == '\\' && *str1 == '\n') { str1++; - while ((c1 = *str1++) == ' ' || c1 == '\t'); + while ((c1 = *str1++) == ' ' || c1 == '\t') + continue; } if (c2 == '\0') { @@ -647,57 +647,3 @@ } return end + 1; } - -#ifdef TEST - -#include - -static void -tprint (char *cap) -{ - char *x = tgetstr (cap, 0); - register char *y; - - printf ("%s: ", cap); - if (x) - { - for (y = x; *y; y++) - if (*y <= ' ' || *y == 0177) - printf ("\\%0o", *y); - else - putchar (*y); - free (x); - } - else - printf ("none"); - putchar ('\n'); -} - -int -main (int argc, char **argv) -{ - char *term; - char *buf; - - term = argv[1]; - printf ("TERM: %s\n", term); - - buf = (char *) tgetent (0, term); - if ((int) buf <= 0) - { - printf ("No entry.\n"); - return 0; - } - - printf ("Entry: %s\n", buf); - - tprint ("cm"); - tprint ("AL"); - - printf ("co: %d\n", tgetnum ("co")); - printf ("am: %d\n", tgetflag ("am")); - - return 0; -} - -#endif /* TEST */ === modified file 'src/termhooks.h' --- src/termhooks.h 2013-06-03 13:03:05 +0000 +++ src/termhooks.h 2013-07-11 02:17:47 +0000 @@ -643,7 +643,7 @@ (((d)->type != output_termcap && (d)->type != output_msdos_raw) \ || (d)->display_info.tty->input) -extern struct terminal *get_terminal (Lisp_Object terminal, int); +extern struct terminal *get_terminal (Lisp_Object terminal, bool); extern struct terminal *create_terminal (void); extern void delete_terminal (struct terminal *); === modified file 'src/terminal.c' --- src/terminal.c 2013-03-11 01:17:40 +0000 +++ src/terminal.c 2013-07-11 02:17:47 +0000 @@ -199,11 +199,11 @@ /* Return the terminal object specified by TERMINAL. TERMINAL may be a terminal object, a frame, or nil for the terminal device of the - current frame. If THROW is zero, return NULL for failure, + current frame. If THROW is false, return NULL for failure, otherwise throw an error. */ struct terminal * -get_terminal (Lisp_Object terminal, int throw) +get_terminal (Lisp_Object terminal, bool throw) { struct terminal *result = NULL; ------------------------------------------------------------ revno: 113364 committer: Juanma Barranquero branch nick: trunk timestamp: Thu 2013-07-11 03:49:17 +0200 message: lisp/subr.el (delay-warning): New function. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-07-10 16:18:17 +0000 +++ lisp/ChangeLog 2013-07-11 01:49:17 +0000 @@ -1,3 +1,7 @@ +2013-07-11 Juanma Barranquero + + * subr.el (delay-warning): New function. + 2013-07-10 Eli Zaretskii * simple.el (default-line-height): New function. === modified file 'lisp/subr.el' --- lisp/subr.el 2013-07-07 22:50:34 +0000 +++ lisp/subr.el 2013-07-11 01:49:17 +0000 @@ -3853,6 +3853,7 @@ (declare (obsolete eval-after-load "23.2")) (eval-after-load file (read))) + (defun display-delayed-warnings () "Display delayed warnings from `delayed-warnings-list'. Used from `delayed-warnings-hook' (which see)." @@ -3886,6 +3887,12 @@ warnings listed in `delayed-warnings-list', display them, and set `delayed-warnings-list' back to nil.") +(defun delay-warning (type message &optional level buffer-name) + "Display a delayed warning. +Aside from going through `delayed-warnings-list', this is equivalent +to `display-warning'." + (push (list type message level buffer-name) delayed-warnings-list)) + ;;;; invisibility specs ------------------------------------------------------------ revno: 113363 committer: Paul Eggert branch nick: trunk timestamp: Wed 2013-07-10 16:23:57 -0700 message: Port to C89. * lib-src/ebrowse.c (USAGE): Remove macro with too-long string literal ... (usage_message): ... and replace it with this new static constant containing multiple literals. All uses changed. * lib-src/emacsclient.c (print_help_and_exit): Rewrite to avoid string literals longer than the C89 limits. (start_daemon_and_retry_set_socket): Rewrite to avoid non-constant array initializer. * lib-src/make-docfile.c (enum global_type): Omit trailing comma. * src/bytecode.c (BYTE_CODE_THREADED): Do not define if __STRICT_ANSI__. (B__dummy__): New dummy symbol, to pacify C89. * src/dbusbind.c (XD_DEBUG_MESSAGE): Omit debugging on C89 hosts, since they can't grok varargs macros. * src/dispnew.c (add_window_display_history) (add_frame_display_history): * src/print.c (print_object): * src/xdisp.c (debug_method_add): Use %p printf format only for void pointers. * src/emacs.c (usage_message): New constant, replacing ... (USAGE1, USAGE2, USAGE3): Remove; they were too long for C89. (main): Adjust to usage reorg. * src/fns.c (syms_of_fns): * src/profiler.c (syms_of_profiler): Don't use non-constant struct initializers. * src/gnutls.h (gnutls_initstage_t): * src/lisp.h (enum Lisp_Fwd_Type): * src/lread.c (lisp_file_lexically_bound_p): * src/xsettings.c (anonymous enum): Remove trailing comma. * src/xsettings.c (apply_xft_settings): Use %f, not %lf; %lf is a C99ism. * src/lisp.h (ENUM_BF): Use unsigned if pedantic. (DEFUN_FUNCTION_INIT): New macro, that falls back on a cast if pre-C99. (DEFUN): Use it. * src/regex.c (const_re_char): New type, to pacify strict C89. All uses of 'const re_char' replaced to use it. * src/regex.h (_Restrict_): Rename from __restrict, to avoid clash with glibc when strict C89. This change is imported from gnulib. All uses changed. (_Restrict_arr_): Rename from __restrict_arr, similarly. * src/sysdep.c (time_from_jiffies) [!HAVE_LONG_LONG_INT]: Omit GNU_LINUX implementation, since it requires long long. * src/xterm.c (x_draw_underwave): Do not assume the traditional order of struct's members. (x_term_init): Rewrite to avoid the need for non-constant structure initializers. diff: === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2013-07-07 23:05:52 +0000 +++ lib-src/ChangeLog 2013-07-10 23:23:57 +0000 @@ -1,3 +1,15 @@ +2013-07-10 Paul Eggert + + Port to C89. + * ebrowse.c (USAGE): Remove macro with too-long string literal ... + (usage_message): ... and replace it with this new static constant + containing multiple literals. All uses changed. + * emacsclient.c (print_help_and_exit): + Rewrite to avoid string literals longer than the C89 limits. + (start_daemon_and_retry_set_socket): + Rewrite to avoid non-constant array initializer. + * make-docfile.c (enum global_type): Omit trailing comma. + 2013-07-02 Paul Eggert Prefer plain 'static' to 'static inline' (Bug#12541). === modified file 'lib-src/ebrowse.c' --- lib-src/ebrowse.c 2013-07-02 00:33:04 +0000 +++ lib-src/ebrowse.c 2013-07-10 23:23:57 +0000 @@ -3481,7 +3481,9 @@ /* Display usage information and exit program. */ -#define USAGE "\ +static char const *const usage_message[] = + { + "\ Usage: ebrowse [options] {files}\n\ \n\ -a, --append append output to existing file\n\ @@ -3489,6 +3491,8 @@ -I, --search-path=LIST set search path for input files\n\ -m, --min-regexp-length=N set minimum regexp length to N\n\ -M, --max-regexp-length=N set maximum regexp length to N\n\ +", + "\ -n, --no-nested-classes exclude nested classes\n\ -o, --output-file=FILE set output file name to FILE\n\ -p, --position-info print info about position in file\n\ @@ -3498,12 +3502,16 @@ -x, --no-regexps don't record regular expressions\n\ --help display this help\n\ --version display version info\n\ +\n\ " + }; static _Noreturn void usage (int error) { - puts (USAGE); + int i; + for (i = 0; i < sizeof usage_message / sizeof *usage_message; i++) + fputs (usage_message[i], stdout); exit (error ? EXIT_FAILURE : EXIT_SUCCESS); } === modified file 'lib-src/emacsclient.c' --- lib-src/emacsclient.c 2013-03-13 18:42:22 +0000 +++ lib-src/emacsclient.c 2013-07-10 23:23:57 +0000 @@ -630,7 +630,7 @@ Please try to preserve them; otherwise the output is very hard to read when using emacsclientw. */ message (FALSE, - "Usage: %s [OPTIONS] FILE...\n\ + "Usage: %s [OPTIONS] FILE...\n%s%s%s", progname, "\ Tell the Emacs server to visit the specified files.\n\ Every FILE can be either just a FILENAME or [+LINE[:COLUMN]] FILENAME.\n\ \n\ @@ -640,6 +640,7 @@ -nw, -t, --tty Open a new Emacs frame on the current terminal\n\ -c, --create-frame Create a new frame instead of trying to\n\ use the current Emacs frame\n\ +", "\ -F ALIST, --frame-parameters=ALIST\n\ Set the parameters of a new frame\n\ -e, --eval Evaluate the FILE arguments as ELisp expressions\n\ @@ -647,6 +648,7 @@ -q, --quiet Don't display messages on success\n\ -d DISPLAY, --display=DISPLAY\n\ Visit the file in the given display\n\ +", "\ --parent-id=ID Open in parent window ID, via XEmbed\n" #ifndef NO_SOCKETS_IN_FILE_SYSTEM "-s SOCKET, --socket-name=SOCKET\n\ @@ -661,7 +663,7 @@ mode and try connecting again\n" #endif /* not WINDOWSNT */ "\n\ -Report bugs with M-x report-emacs-bug.\n", progname); +Report bugs with M-x report-emacs-bug.\n"); exit (EXIT_SUCCESS); } @@ -1509,7 +1511,10 @@ { char emacs[] = "emacs"; char daemon_option[] = "--daemon"; - char *d_argv[] = {emacs, daemon_option, 0 }; + char *d_argv[3]; + d_argv[0] = emacs; + d_argv[1] = daemon_option; + d_argv[2] = 0; if (socket_name != NULL) { /* Pass --daemon=socket_name as argument. */ === modified file 'lib-src/make-docfile.c' --- lib-src/make-docfile.c 2013-07-02 00:33:04 +0000 +++ lib-src/make-docfile.c 2013-07-10 23:23:57 +0000 @@ -555,7 +555,7 @@ LISP_OBJECT, EMACS_INTEGER, BOOLEAN, - FUNCTION, + FUNCTION }; /* A single global. */ === modified file 'src/ChangeLog' --- src/ChangeLog 2013-07-10 16:11:09 +0000 +++ src/ChangeLog 2013-07-10 23:23:57 +0000 @@ -1,5 +1,43 @@ 2013-07-10 Paul Eggert + Port to C89. + * bytecode.c (BYTE_CODE_THREADED): Do not define if __STRICT_ANSI__. + (B__dummy__): New dummy symbol, to pacify C89. + * dbusbind.c (XD_DEBUG_MESSAGE): Omit debugging on C89 hosts, since + they can't grok varargs macros. + * dispnew.c (add_window_display_history) + (add_frame_display_history): + * print.c (print_object): + * xdisp.c (debug_method_add): + Use %p printf format only for void pointers. + * emacs.c (usage_message): New constant, replacing ... + (USAGE1, USAGE2, USAGE3): Remove; they were too long for C89. + (main): Adjust to usage reorg. + * fns.c (syms_of_fns): + * profiler.c (syms_of_profiler): + Don't use non-constant struct initializers. + * gnutls.h (gnutls_initstage_t): + * lisp.h (enum Lisp_Fwd_Type): + * lread.c (lisp_file_lexically_bound_p): + * xsettings.c (anonymous enum): + Remove trailing comma. + * xsettings.c (apply_xft_settings): Use %f, not %lf; %lf is a C99ism. + * lisp.h (ENUM_BF): Use unsigned if pedantic. + (DEFUN_FUNCTION_INIT): New macro, that falls back on a cast if pre-C99. + (DEFUN): Use it. + * regex.c (const_re_char): New type, to pacify strict C89. + All uses of 'const re_char' replaced to use it. + * regex.h (_Restrict_): Rename from __restrict, to avoid clash + with glibc when strict C89. This change is imported from gnulib. + All uses changed. + (_Restrict_arr_): Rename from __restrict_arr, similarly. + * sysdep.c (time_from_jiffies) [!HAVE_LONG_LONG_INT]: + Omit GNU_LINUX implementation, since it requires long long. + * xterm.c (x_draw_underwave): + Do not assume the traditional order of struct's members. + (x_term_init): Rewrite to avoid the need for non-constant structure + initializers. + Syntax cleanup, mostly replacing macros with functions. ` This removes the need for the syntax_temp hack. * search.c: Include syntax.h after buffer.h, since syntax.h uses BVAR. === modified file 'src/bytecode.c' --- src/bytecode.c 2013-06-20 18:59:08 +0000 +++ src/bytecode.c 2013-07-10 23:23:57 +0000 @@ -59,7 +59,8 @@ indirect threaded, using GCC's computed goto extension. This code, as currently implemented, is incompatible with BYTE_CODE_SAFE and BYTE_CODE_METER. */ -#if defined (__GNUC__) && !defined (BYTE_CODE_SAFE) && !defined (BYTE_CODE_METER) +#if (defined __GNUC__ && !defined __STRICT_ANSI__ \ + && !defined BYTE_CODE_SAFE && !defined BYTE_CODE_METER) #define BYTE_CODE_THREADED #endif @@ -285,8 +286,10 @@ #ifdef BYTE_CODE_SAFE Bscan_buffer = 0153, /* No longer generated as of v18. */ - Bset_mark = 0163 /* this loser is no longer generated as of v18 */ + Bset_mark = 0163, /* this loser is no longer generated as of v18 */ #endif + + B__dummy__ = 0 /* Pacify C89. */ }; /* Whether to maintain a `top' and `bottom' field in the stack frame. */ === modified file 'src/dbusbind.c' --- src/dbusbind.c 2013-05-18 05:32:17 +0000 +++ src/dbusbind.c 2013-07-10 23:23:57 +0000 @@ -142,7 +142,10 @@ } while (0) #else /* !DBUS_DEBUG */ -#define XD_DEBUG_MESSAGE(...) \ +# if __STDC_VERSION__ < 199901 +# define XD_DEBUG_MESSAGE (void) /* Pre-C99 compilers cannot debug. */ +# else +# define XD_DEBUG_MESSAGE(...) \ do { \ if (!NILP (Vdbus_debug)) \ { \ @@ -151,7 +154,8 @@ message ("%s: %s", __func__, s); \ } \ } while (0) -#define XD_DEBUG_VALID_LISP_OBJECT_P(object) +# endif +# define XD_DEBUG_VALID_LISP_OBJECT_P(object) #endif /* Check whether TYPE is a basic DBusType. */ === modified file 'src/dispnew.c' --- src/dispnew.c 2013-07-06 02:40:50 +0000 +++ src/dispnew.c 2013-07-10 23:23:57 +0000 @@ -213,6 +213,7 @@ add_window_display_history (struct window *w, const char *msg, bool paused_p) { char *buf; + void *ptr = w; if (history_idx >= REDISPLAY_HISTORY_SIZE) history_idx = 0; @@ -222,7 +223,7 @@ snprintf (buf, sizeof redisplay_history[0].trace, "%"pMu": window %p (`%s')%s\n%s", history_tick++, - w, + ptr, ((BUFFERP (w->contents) && STRINGP (BVAR (XBUFFER (w->contents), name))) ? SSDATA (BVAR (XBUFFER (w->contents), name)) @@ -240,6 +241,7 @@ add_frame_display_history (struct frame *f, bool paused_p) { char *buf; + void *ptr = f; if (history_idx >= REDISPLAY_HISTORY_SIZE) history_idx = 0; @@ -248,7 +250,7 @@ sprintf (buf, "%"pMu": update frame %p%s", history_tick++, - f, paused_p ? " ***paused***" : ""); + ptr, paused_p ? " ***paused***" : ""); } === modified file 'src/emacs.c' --- src/emacs.c 2013-07-10 11:27:15 +0000 +++ src/emacs.c 2013-07-10 23:23:57 +0000 @@ -201,10 +201,10 @@ static void sort_args (int argc, char **argv); static void syms_of_emacs (void); -/* MSVC needs each string be shorter than 2048 bytes, so the usage +/* C89 needs each string be at most 509 characters, so the usage strings below are split to not overflow this limit. */ -#define USAGE1 "\ -Usage: %s [OPTION-OR-FILENAME]...\n\ +static char const *const usage_message[] = + { "\ \n\ Run Emacs, the extensible, customizable, self-documenting real-time\n\ display editor. The recommended way to start Emacs for normal editing\n\ @@ -215,11 +215,15 @@ \n\ Initialization options:\n\ \n\ +", + "\ --batch do not do interactive display; implies -q\n\ --chdir DIR change to directory DIR\n\ --daemon start a server in the background\n\ --debug-init enable Emacs Lisp debugger for init file\n\ --display, -d DISPLAY use X server DISPLAY\n\ +", + "\ --no-desktop do not load a saved desktop\n\ --no-init-file, -q load neither ~/.emacs nor default.el\n\ --no-shared-memory, -nl do not use shared memory\n\ @@ -227,14 +231,16 @@ --no-site-lisp, -nsl do not add site-lisp directories to load-path\n\ --no-splash do not display a splash screen on startup\n\ --no-window-system, -nw do not communicate with X, ignoring $DISPLAY\n\ +", + "\ --quick, -Q equivalent to:\n\ -q --no-site-file --no-site-lisp --no-splash\n\ --script FILE run FILE as an Emacs Lisp script\n\ --terminal, -t DEVICE use DEVICE for terminal I/O\n\ --user, -u USER load ~USER/.emacs instead of your own\n\ -\n%s" - -#define USAGE2 "\ +\n\ +", + "\ Action options:\n\ \n\ FILE visit FILE using find-file\n\ @@ -243,6 +249,8 @@ --directory, -L DIR add DIR to variable load-path\n\ --eval EXPR evaluate Emacs Lisp expression EXPR\n\ --execute EXPR evaluate Emacs Lisp expression EXPR\n\ +", + "\ --file FILE visit FILE using find-file\n\ --find-file FILE visit FILE using find-file\n\ --funcall, -f FUNC call Emacs Lisp function FUNC with no arguments\n\ @@ -250,9 +258,9 @@ --kill exit without asking for confirmation\n\ --load, -l FILE load Emacs Lisp FILE using the load function\n\ --visit FILE visit FILE using find-file\n\ -\n" - -#define USAGE3 "\ +\n\ +", + "\ Display options:\n\ \n\ --background-color, -bg COLOR window background color\n\ @@ -260,6 +268,8 @@ used for debugging Emacs\n\ --border-color, -bd COLOR main border color\n\ --border-width, -bw WIDTH width of main border\n\ +", + "\ --color, --color=MODE override color mode for character terminals;\n\ MODE defaults to `auto', and\n\ can also be `never', `always',\n\ @@ -267,17 +277,23 @@ --cursor-color, -cr COLOR color of the Emacs cursor indicating point\n\ --font, -fn FONT default font; must be fixed-width\n\ --foreground-color, -fg COLOR window foreground color\n\ +", + "\ --fullheight, -fh make the first frame high as the screen\n\ --fullscreen, -fs make the first frame fullscreen\n\ --fullwidth, -fw make the first frame wide as the screen\n\ --maximized, -mm make the first frame maximized\n\ --geometry, -g GEOMETRY window geometry\n\ +", + "\ --no-bitmap-icon, -nbi do not use picture of gnu for Emacs icon\n\ --iconic start Emacs in iconified state\n\ --internal-border, -ib WIDTH width between text and main border\n\ --line-spacing, -lsp PIXELS additional space to put between lines\n\ --mouse-color, -ms COLOR mouse cursor color in Emacs window\n\ --name NAME title for initial Emacs frame\n\ +", + "\ --no-blinking-cursor, -nbc disable blinking cursor\n\ --reverse-video, -r, -rv switch foreground and background\n\ --title, -T TITLE title for initial Emacs frame\n\ @@ -286,9 +302,9 @@ --parent-id XID set parent window\n\ --help display this help and exit\n\ --version output version information and exit\n\ -\n" - -#define USAGE4 "\ +\n\ +", + "\ You can generally also specify long option names with a single -; for\n\ example, -batch as well as --batch. You can use any unambiguous\n\ abbreviation for a --option.\n\ @@ -298,6 +314,7 @@ \n\ Report bugs to bug-gnu-emacs@gnu.org. First, please see the Bugs\n\ section of the Emacs manual or the file BUGS.\n" + }; /* True if handling a fatal error already. */ @@ -934,9 +951,10 @@ /* Handle the --help option, which gives a usage message. */ if (argmatch (argv, argc, "-help", "--help", 3, NULL, &skip_args)) { - printf (USAGE1, argv[0], USAGE2); - printf (USAGE3); - printf (USAGE4); + int i; + printf ("Usage: %s [OPTION-OR-FILENAME]...\n", argv[0]); + for (i = 0; i < sizeof usage_message / sizeof *usage_message; i++) + fputs (usage_message[i], stdout); exit (0); } === modified file 'src/fns.c' --- src/fns.c 2013-06-17 06:03:19 +0000 +++ src/fns.c 2013-07-10 23:23:57 +0000 @@ -5011,13 +5011,21 @@ defsubr (&Ssecure_hash); defsubr (&Slocale_info); - { - struct hash_table_test - eq = { Qeq, Qnil, Qnil, NULL, hashfn_eq }, - eql = { Qeql, Qnil, Qnil, cmpfn_eql, hashfn_eql }, - equal = { Qequal, Qnil, Qnil, cmpfn_equal, hashfn_equal }; - hashtest_eq = eq; - hashtest_eql = eql; - hashtest_equal = equal; - } + hashtest_eq.name = Qeq; + hashtest_eq.user_hash_function = Qnil; + hashtest_eq.user_cmp_function = Qnil; + hashtest_eq.cmpfn = 0; + hashtest_eq.hashfn = hashfn_eq; + + hashtest_eql.name = Qeql; + hashtest_eql.user_hash_function = Qnil; + hashtest_eql.user_cmp_function = Qnil; + hashtest_eql.cmpfn = cmpfn_eql; + hashtest_eql.hashfn = hashfn_eql; + + hashtest_equal.name = Qequal; + hashtest_equal.user_hash_function = Qnil; + hashtest_equal.user_cmp_function = Qnil; + hashtest_equal.cmpfn = cmpfn_equal; + hashtest_equal.hashfn = hashfn_equal; } === modified file 'src/gnutls.h' --- src/gnutls.h 2013-01-01 09:11:05 +0000 +++ src/gnutls.h 2013-07-10 23:23:57 +0000 @@ -42,7 +42,7 @@ GNUTLS_STAGE_TRANSPORT_POINTERS_SET, GNUTLS_STAGE_HANDSHAKE_TRIED, - GNUTLS_STAGE_READY, + GNUTLS_STAGE_READY } gnutls_initstage_t; #define GNUTLS_EMACS_ERROR_NOT_LOADED GNUTLS_E_APPLICATION_ERROR_MIN + 1 === modified file 'src/lisp.h' --- src/lisp.h 2013-07-09 07:04:48 +0000 +++ src/lisp.h 2013-07-10 23:23:57 +0000 @@ -363,9 +363,9 @@ #define INTMASK (EMACS_INT_MAX >> (INTTYPEBITS - 1)) #define case_Lisp_Int case Lisp_Int0: case Lisp_Int1 -/* Idea stolen from GDB. MSVC doesn't support enums in bitfields, - and xlc complains vociferously about them. */ -#if defined _MSC_VER || defined __IBMC__ +/* Idea stolen from GDB. Pedantic GCC complains about enum bitfields, + MSVC doesn't support them, and xlc complains vociferously about them. */ +#if defined __STRICT_ANSI__ || defined _MSC_VER || defined __IBMC__ #define ENUM_BF(TYPE) unsigned int #else #define ENUM_BF(TYPE) enum TYPE @@ -398,7 +398,7 @@ /* Cons. XCONS (object) points to a struct Lisp_Cons. */ Lisp_Cons = 6, - Lisp_Float = 7, + Lisp_Float = 7 }; /* This is the set of data types that share a common structure. @@ -428,7 +428,7 @@ Lisp_Fwd_Bool, /* Fwd to a C boolean var. */ Lisp_Fwd_Obj, /* Fwd to a C Lisp_Object variable. */ Lisp_Fwd_Buffer_Obj, /* Fwd to a Lisp_Object field of buffers. */ - Lisp_Fwd_Kboard_Obj, /* Fwd to a Lisp_Object field of kboards. */ + Lisp_Fwd_Kboard_Obj /* Fwd to a Lisp_Object field of kboards. */ }; /* If you want to define a new Lisp data type, here are some @@ -2540,11 +2540,16 @@ minargs, maxargs, lname, intspec, 0}; \ Lisp_Object fnname #else /* not _MSC_VER */ +# if __STDC_VERSION__ < 199901 +# define DEFUN_FUNCTION_INIT(fnname, maxargs) (Lisp_Object (*) (void)) fnname +# else +# define DEFUN_FUNCTION_INIT(fnname, maxargs) .a ## maxargs = fnname +# endif #define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \ Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \ static struct Lisp_Subr alignas (GCALIGNMENT) sname = \ { { PVEC_SUBR << PSEUDOVECTOR_AREA_BITS }, \ - { .a ## maxargs = fnname }, \ + { DEFUN_FUNCTION_INIT (fnname, maxargs) }, \ minargs, maxargs, lname, intspec, 0}; \ Lisp_Object fnname #endif === modified file 'src/lread.c' --- src/lread.c 2013-07-07 18:00:14 +0000 +++ src/lread.c 2013-07-10 23:23:57 +0000 @@ -823,7 +823,7 @@ { bool rv = 0; enum { - NOMINAL, AFTER_FIRST_DASH, AFTER_ASTERIX, + NOMINAL, AFTER_FIRST_DASH, AFTER_ASTERIX } beg_end_state = NOMINAL; bool in_file_vars = 0; === modified file 'src/print.c' --- src/print.c 2013-07-06 02:40:50 +0000 +++ src/print.c 2013-07-10 23:23:57 +0000 @@ -1765,9 +1765,8 @@ } else if (WINDOWP (obj)) { - int len; - strout ("#contents)) { @@ -1798,6 +1797,7 @@ ptrdiff_t real_size, size; int len; #if 0 + void *ptr = h; strout ("#test)) { @@ -1810,9 +1810,8 @@ len = sprintf (buf, "%"pD"d/%"pD"d", h->count, ASIZE (h->next)); strout (buf, len, len, printcharfun); } - len = sprintf (buf, " %p", h); + len = sprintf (buf, " %p>", ptr); strout (buf, len, len, printcharfun); - PRINTCHAR ('>'); #endif /* Implement a readable output, e.g.: #s(hash-table size 2 test equal data (k1 v1 k2 v2)) */ @@ -1892,6 +1891,7 @@ else if (FRAMEP (obj)) { int len; + void *ptr = XFRAME (obj); Lisp_Object frame_name = XFRAME (obj)->name; strout ((FRAME_LIVE_P (XFRAME (obj)) @@ -1907,9 +1907,8 @@ frame_name = build_string ("*INVALID*FRAME*NAME*"); } print_string (frame_name, printcharfun); - len = sprintf (buf, " %p", XFRAME (obj)); + len = sprintf (buf, " %p>", ptr); strout (buf, len, len, printcharfun); - PRINTCHAR ('>'); } else if (FONTP (obj)) { === modified file 'src/profiler.c' --- src/profiler.c 2013-06-03 09:01:53 +0000 +++ src/profiler.c 2013-07-10 23:23:57 +0000 @@ -568,12 +568,12 @@ profiler_log_size = 10000; DEFSYM (Qprofiler_backtrace_equal, "profiler-backtrace-equal"); - { - struct hash_table_test test - = { Qprofiler_backtrace_equal, Qnil, Qnil, - cmpfn_profiler, hashfn_profiler }; - hashtest_profiler = test; - } + + hashtest_profiler.name = Qprofiler_backtrace_equal; + hashtest_profiler.user_hash_function = Qnil; + hashtest_profiler.user_cmp_function = Qnil; + hashtest_profiler.cmpfn = cmpfn_profiler; + hashtest_profiler.hashfn = hashfn_profiler; defsubr (&Sfunction_equal); === modified file 'src/regex.c' --- src/regex.c 2013-05-18 05:32:17 +0000 +++ src/regex.c 2013-07-10 23:23:57 +0000 @@ -531,8 +531,10 @@ /* Type of source-pattern and string chars. */ #ifdef _MSC_VER typedef unsigned char re_char; +typedef const re_char const_re_char; #else typedef const unsigned char re_char; +typedef re_char const_re_char; #endif typedef char boolean; @@ -2015,7 +2017,7 @@ /* Map a string to the char class it names (if any). */ re_wctype_t -re_wctype (const re_char *str) +re_wctype (const_re_char *str) { const char *string = (const char *) str; if (STREQ (string, "alnum")) return RECC_ALNUM; @@ -2409,7 +2411,8 @@ } while (0) static reg_errcode_t -regex_compile (const re_char *pattern, size_t size, reg_syntax_t syntax, struct re_pattern_buffer *bufp) +regex_compile (const_re_char *pattern, size_t size, reg_syntax_t syntax, + struct re_pattern_buffer *bufp) { /* We fetch characters from PATTERN here. */ register re_wchar_t c, c1; @@ -3765,7 +3768,7 @@ least one character before the ^. */ static boolean -at_begline_loc_p (const re_char *pattern, const re_char *p, reg_syntax_t syntax) +at_begline_loc_p (const_re_char *pattern, const_re_char *p, reg_syntax_t syntax) { re_char *prev = p - 2; boolean odd_backslashes; @@ -3806,7 +3809,7 @@ at least one character after the $, i.e., `P < PEND'. */ static boolean -at_endline_loc_p (const re_char *p, const re_char *pend, reg_syntax_t syntax) +at_endline_loc_p (const_re_char *p, const_re_char *pend, reg_syntax_t syntax) { re_char *next = p; boolean next_backslash = *next == '\\'; @@ -3850,7 +3853,8 @@ Return -1 if fastmap was not updated accurately. */ static int -analyse_first (const re_char *p, const re_char *pend, char *fastmap, const int multibyte) +analyse_first (const_re_char *p, const_re_char *pend, char *fastmap, + const int multibyte) { int j, k; boolean not; @@ -4594,7 +4598,7 @@ /* If the operation is a match against one or more chars, return a pointer to the next operation, else return NULL. */ static re_char * -skip_one_char (const re_char *p) +skip_one_char (const_re_char *p) { switch (*p++) { @@ -4636,7 +4640,7 @@ /* Jump over non-matching operations. */ static re_char * -skip_noops (const re_char *p, const re_char *pend) +skip_noops (const_re_char *p, const_re_char *pend) { int mcnt; while (p < pend) @@ -4663,7 +4667,8 @@ /* Non-zero if "p1 matches something" implies "p2 fails". */ static int -mutually_exclusive_p (struct re_pattern_buffer *bufp, const re_char *p1, const re_char *p2) +mutually_exclusive_p (struct re_pattern_buffer *bufp, const_re_char *p1, + const_re_char *p2) { re_opcode_t op2; const boolean multibyte = RE_MULTIBYTE_P (bufp); @@ -4922,8 +4927,8 @@ /* This is a separate function so that we can force an alloca cleanup afterwards. */ static regoff_t -re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, - size_t size1, const re_char *string2, size_t size2, +re_match_2_internal (struct re_pattern_buffer *bufp, const_re_char *string1, + size_t size1, const_re_char *string2, size_t size2, ssize_t pos, struct re_registers *regs, ssize_t stop) { /* General temporaries. */ @@ -6265,7 +6270,7 @@ bytes; nonzero otherwise. */ static int -bcmp_translate (const re_char *s1, const re_char *s2, register ssize_t len, +bcmp_translate (const_re_char *s1, const_re_char *s2, register ssize_t len, RE_TRANSLATE_TYPE translate, const int target_multibyte) { register re_char *p1 = s1, *p2 = s2; @@ -6434,7 +6439,7 @@ the return codes and their meanings.) */ reg_errcode_t -regcomp (regex_t *__restrict preg, const char *__restrict pattern, +regcomp (regex_t *_Restrict_ preg, const char *_Restrict_ pattern, int cflags) { reg_errcode_t ret; @@ -6515,8 +6520,8 @@ We return 0 if we find a match and REG_NOMATCH if not. */ reg_errcode_t -regexec (const regex_t *__restrict preg, const char *__restrict string, - size_t nmatch, regmatch_t pmatch[__restrict_arr], int eflags) +regexec (const regex_t *_Restrict_ preg, const char *_Restrict_ string, + size_t nmatch, regmatch_t pmatch[_Restrict_arr_], int eflags) { regoff_t ret; struct re_registers regs; === modified file 'src/regex.h' --- src/regex.h 2013-03-24 12:59:45 +0000 +++ src/regex.h 2013-07-10 23:23:57 +0000 @@ -528,31 +528,41 @@ #endif /* GCC 2.95 and later have "__restrict"; C99 compilers have - "restrict", and "configure" may have defined "restrict". */ -#ifndef __restrict -# if ! (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)) -# if defined restrict || 199901L <= __STDC_VERSION__ -# define __restrict restrict -# else -# define __restrict -# endif + "restrict", and "configure" may have defined "restrict". + Other compilers use __restrict, __restrict__, and _Restrict, and + 'configure' might #define 'restrict' to those words, so pick a + different name. */ +#ifndef _Restrict_ +# if 199901L <= __STDC_VERSION__ +# define _Restrict_ restrict +# elif 2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__) +# define _Restrict_ __restrict +# else +# define _Restrict_ # endif #endif -/* For now conditionally define __restrict_arr to expand to nothing. - Ideally we would have a test for the compiler which allows defining - it to restrict. */ -#ifndef __restrict_arr -# define __restrict_arr +/* gcc 3.1 and up support the [restrict] syntax. Don't trust + sys/cdefs.h's definition of __restrict_arr, though, as it + mishandles gcc -ansi -pedantic. */ +#ifndef _Restrict_arr_ +# if ((199901L <= __STDC_VERSION__ \ + || ((3 < __GNUC__ || (3 == __GNUC__ && 1 <= __GNUC_MINOR__)) \ + && !defined __STRICT_ANSI__)) \ + && !defined __GNUG__) +# define _Restrict_arr_ _Restrict_ +# else +# define _Restrict_arr_ +# endif #endif /* POSIX compatibility. */ -extern reg_errcode_t regcomp (regex_t *__restrict __preg, - const char *__restrict __pattern, +extern reg_errcode_t regcomp (regex_t *_Restrict_ __preg, + const char *_Restrict_ __pattern, int __cflags); -extern reg_errcode_t regexec (const regex_t *__restrict __preg, - const char *__restrict __string, size_t __nmatch, - regmatch_t __pmatch[__restrict_arr], +extern reg_errcode_t regexec (const regex_t *_Restrict_ __preg, + const char *_Restrict_ __string, size_t __nmatch, + regmatch_t __pmatch[_Restrict_arr_], int __eflags); extern size_t regerror (int __errcode, const regex_t * __preg, === modified file 'src/sysdep.c' --- src/sysdep.c 2013-07-09 07:04:48 +0000 +++ src/sysdep.c 2013-07-10 23:23:57 +0000 @@ -2676,7 +2676,7 @@ #endif /* !defined (WINDOWSNT) */ -#ifdef GNU_LINUX +#if defined GNU_LINUX && defined HAVE_LONG_LONG_INT static EMACS_TIME time_from_jiffies (unsigned long long tval, long hz) { === modified file 'src/xdisp.c' --- src/xdisp.c 2013-07-06 10:41:38 +0000 +++ src/xdisp.c 2013-07-10 23:23:57 +0000 @@ -12589,6 +12589,7 @@ static void debug_method_add (struct window *w, char const *fmt, ...) { + void *ptr = w; char *method = w->desired_matrix->method; int len = strlen (method); int size = sizeof w->desired_matrix->method; @@ -12607,7 +12608,7 @@ if (trace_redisplay_p) fprintf (stderr, "%p (%s): %s\n", - w, + ptr, ((BUFFERP (w->contents) && STRINGP (BVAR (XBUFFER (w->contents), name))) ? SSDATA (BVAR (XBUFFER (w->contents), name)) === modified file 'src/xsettings.c' --- src/xsettings.c 2013-03-20 09:56:19 +0000 +++ src/xsettings.c 2013-07-10 23:23:57 +0000 @@ -170,7 +170,7 @@ SEEN_HINTSTYLE = 0x10, SEEN_DPI = 0x20, SEEN_FONT = 0x40, - SEEN_TB_STYLE = 0x80, + SEEN_TB_STYLE = 0x80 }; struct xsettings { @@ -687,7 +687,7 @@ { static char const format[] = "Antialias: %d, Hinting: %d, RGBA: %d, LCDFilter: %d, " - "Hintstyle: %d, DPI: %lf"; + "Hintstyle: %d, DPI: %f"; enum { d_formats = 5, @@ -696,7 +696,7 @@ max_f_integer_digits = DBL_MAX_10_EXP + 1, f_precision = 6, lf_growth = (sizeof "-." + max_f_integer_digits + f_precision - - sizeof "%lf") + - sizeof "%f") }; char buf[sizeof format + d_formats * d_growth + lf_formats * lf_growth]; === modified file 'src/xterm.c' --- src/xterm.c 2013-07-05 16:58:01 +0000 +++ src/xterm.c 2013-07-10 23:23:57 +0000 @@ -2647,7 +2647,10 @@ /* Find and set clipping rectangle */ - wave_clip = (XRectangle){ x0, y0, width, wave_height }; + wave_clip.x = x0; + wave_clip.y = y0; + wave_clip.width = width; + wave_clip.height = wave_height; get_glyph_string_clip_rect (s, &string_clip); if (!x_intersect_rectangles (&wave_clip, &string_clip, &final_clip)) @@ -10191,71 +10194,73 @@ } { - const struct + static const struct { const char *name; - Atom *atom; + int offset; } atom_refs[] = { - { "WM_PROTOCOLS", &dpyinfo->Xatom_wm_protocols }, - { "WM_TAKE_FOCUS", &dpyinfo->Xatom_wm_take_focus }, - { "WM_SAVE_YOURSELF", &dpyinfo->Xatom_wm_save_yourself }, - { "WM_DELETE_WINDOW", &dpyinfo->Xatom_wm_delete_window }, - { "WM_CHANGE_STATE", &dpyinfo->Xatom_wm_change_state }, - { "WM_CONFIGURE_DENIED", &dpyinfo->Xatom_wm_configure_denied }, - { "WM_MOVED", &dpyinfo->Xatom_wm_window_moved }, - { "WM_CLIENT_LEADER", &dpyinfo->Xatom_wm_client_leader }, - { "Editres", &dpyinfo->Xatom_editres }, - { "CLIPBOARD", &dpyinfo->Xatom_CLIPBOARD }, - { "TIMESTAMP", &dpyinfo->Xatom_TIMESTAMP }, - { "TEXT", &dpyinfo->Xatom_TEXT }, - { "COMPOUND_TEXT", &dpyinfo->Xatom_COMPOUND_TEXT }, - { "UTF8_STRING", &dpyinfo->Xatom_UTF8_STRING }, - { "DELETE", &dpyinfo->Xatom_DELETE }, - { "MULTIPLE", &dpyinfo->Xatom_MULTIPLE }, - { "INCR", &dpyinfo->Xatom_INCR }, - { "_EMACS_TMP_", &dpyinfo->Xatom_EMACS_TMP }, - { "TARGETS", &dpyinfo->Xatom_TARGETS }, - { "NULL", &dpyinfo->Xatom_NULL }, - { "ATOM", &dpyinfo->Xatom_ATOM }, - { "ATOM_PAIR", &dpyinfo->Xatom_ATOM_PAIR }, - { "CLIPBOARD_MANAGER", &dpyinfo->Xatom_CLIPBOARD_MANAGER }, - { "_XEMBED_INFO", &dpyinfo->Xatom_XEMBED_INFO }, +#define ATOM_REFS_INIT(string, member) \ + { string, offsetof (struct x_display_info, member) }, + ATOM_REFS_INIT ("WM_PROTOCOLS", Xatom_wm_protocols) + ATOM_REFS_INIT ("WM_TAKE_FOCUS", Xatom_wm_take_focus) + ATOM_REFS_INIT ("WM_SAVE_YOURSELF", Xatom_wm_save_yourself) + ATOM_REFS_INIT ("WM_DELETE_WINDOW", Xatom_wm_delete_window) + ATOM_REFS_INIT ("WM_CHANGE_STATE", Xatom_wm_change_state) + ATOM_REFS_INIT ("WM_CONFIGURE_DENIED", Xatom_wm_configure_denied) + ATOM_REFS_INIT ("WM_MOVED", Xatom_wm_window_moved) + ATOM_REFS_INIT ("WM_CLIENT_LEADER", Xatom_wm_client_leader) + ATOM_REFS_INIT ("Editres", Xatom_editres) + ATOM_REFS_INIT ("CLIPBOARD", Xatom_CLIPBOARD) + ATOM_REFS_INIT ("TIMESTAMP", Xatom_TIMESTAMP) + ATOM_REFS_INIT ("TEXT", Xatom_TEXT) + ATOM_REFS_INIT ("COMPOUND_TEXT", Xatom_COMPOUND_TEXT) + ATOM_REFS_INIT ("UTF8_STRING", Xatom_UTF8_STRING) + ATOM_REFS_INIT ("DELETE", Xatom_DELETE) + ATOM_REFS_INIT ("MULTIPLE", Xatom_MULTIPLE) + ATOM_REFS_INIT ("INCR", Xatom_INCR) + ATOM_REFS_INIT ("_EMACS_TMP_", Xatom_EMACS_TMP) + ATOM_REFS_INIT ("TARGETS", Xatom_TARGETS) + ATOM_REFS_INIT ("NULL", Xatom_NULL) + ATOM_REFS_INIT ("ATOM", Xatom_ATOM) + ATOM_REFS_INIT ("ATOM_PAIR", Xatom_ATOM_PAIR) + ATOM_REFS_INIT ("CLIPBOARD_MANAGER", Xatom_CLIPBOARD_MANAGER) + ATOM_REFS_INIT ("_XEMBED_INFO", Xatom_XEMBED_INFO) /* For properties of font. */ - { "PIXEL_SIZE", &dpyinfo->Xatom_PIXEL_SIZE }, - { "AVERAGE_WIDTH", &dpyinfo->Xatom_AVERAGE_WIDTH }, - { "_MULE_BASELINE_OFFSET", &dpyinfo->Xatom_MULE_BASELINE_OFFSET }, - { "_MULE_RELATIVE_COMPOSE", &dpyinfo->Xatom_MULE_RELATIVE_COMPOSE }, - { "_MULE_DEFAULT_ASCENT", &dpyinfo->Xatom_MULE_DEFAULT_ASCENT }, + ATOM_REFS_INIT ("PIXEL_SIZE", Xatom_PIXEL_SIZE) + ATOM_REFS_INIT ("AVERAGE_WIDTH", Xatom_AVERAGE_WIDTH) + ATOM_REFS_INIT ("_MULE_BASELINE_OFFSET", Xatom_MULE_BASELINE_OFFSET) + ATOM_REFS_INIT ("_MULE_RELATIVE_COMPOSE", Xatom_MULE_RELATIVE_COMPOSE) + ATOM_REFS_INIT ("_MULE_DEFAULT_ASCENT", Xatom_MULE_DEFAULT_ASCENT) /* Ghostscript support. */ - { "DONE", &dpyinfo->Xatom_DONE }, - { "PAGE", &dpyinfo->Xatom_PAGE }, - { "SCROLLBAR", &dpyinfo->Xatom_Scrollbar }, - { "_XEMBED", &dpyinfo->Xatom_XEMBED }, + ATOM_REFS_INIT ("DONE", Xatom_DONE) + ATOM_REFS_INIT ("PAGE", Xatom_PAGE) + ATOM_REFS_INIT ("SCROLLBAR", Xatom_Scrollbar) + ATOM_REFS_INIT ("_XEMBED", Xatom_XEMBED) /* EWMH */ - { "_NET_WM_STATE", &dpyinfo->Xatom_net_wm_state }, - { "_NET_WM_STATE_FULLSCREEN", &dpyinfo->Xatom_net_wm_state_fullscreen }, - { "_NET_WM_STATE_MAXIMIZED_HORZ", - &dpyinfo->Xatom_net_wm_state_maximized_horz }, - { "_NET_WM_STATE_MAXIMIZED_VERT", - &dpyinfo->Xatom_net_wm_state_maximized_vert }, - { "_NET_WM_STATE_STICKY", &dpyinfo->Xatom_net_wm_state_sticky }, - { "_NET_WM_STATE_HIDDEN", &dpyinfo->Xatom_net_wm_state_hidden }, - { "_NET_WM_WINDOW_TYPE", &dpyinfo->Xatom_net_window_type }, - { "_NET_WM_WINDOW_TYPE_TOOLTIP", - &dpyinfo->Xatom_net_window_type_tooltip }, - { "_NET_WM_ICON_NAME", &dpyinfo->Xatom_net_wm_icon_name }, - { "_NET_WM_NAME", &dpyinfo->Xatom_net_wm_name }, - { "_NET_SUPPORTED", &dpyinfo->Xatom_net_supported }, - { "_NET_SUPPORTING_WM_CHECK", &dpyinfo->Xatom_net_supporting_wm_check }, - { "_NET_WM_WINDOW_OPACITY", &dpyinfo->Xatom_net_wm_window_opacity }, - { "_NET_ACTIVE_WINDOW", &dpyinfo->Xatom_net_active_window }, - { "_NET_FRAME_EXTENTS", &dpyinfo->Xatom_net_frame_extents }, - { "_NET_CURRENT_DESKTOP", &dpyinfo->Xatom_net_current_desktop }, - { "_NET_WORKAREA", &dpyinfo->Xatom_net_workarea }, + ATOM_REFS_INIT ("_NET_WM_STATE", Xatom_net_wm_state) + ATOM_REFS_INIT ("_NET_WM_STATE_FULLSCREEN", Xatom_net_wm_state_fullscreen) + ATOM_REFS_INIT ("_NET_WM_STATE_MAXIMIZED_HORZ", + Xatom_net_wm_state_maximized_horz) + ATOM_REFS_INIT ("_NET_WM_STATE_MAXIMIZED_VERT", + Xatom_net_wm_state_maximized_vert) + ATOM_REFS_INIT ("_NET_WM_STATE_STICKY", Xatom_net_wm_state_sticky) + ATOM_REFS_INIT ("_NET_WM_STATE_HIDDEN", Xatom_net_wm_state_hidden) + ATOM_REFS_INIT ("_NET_WM_WINDOW_TYPE", Xatom_net_window_type) + ATOM_REFS_INIT ("_NET_WM_WINDOW_TYPE_TOOLTIP", + Xatom_net_window_type_tooltip) + ATOM_REFS_INIT ("_NET_WM_ICON_NAME", Xatom_net_wm_icon_name) + ATOM_REFS_INIT ("_NET_WM_NAME", Xatom_net_wm_name) + ATOM_REFS_INIT ("_NET_SUPPORTED", Xatom_net_supported) + ATOM_REFS_INIT ("_NET_SUPPORTING_WM_CHECK", Xatom_net_supporting_wm_check) + ATOM_REFS_INIT ("_NET_WM_WINDOW_OPACITY", Xatom_net_wm_window_opacity) + ATOM_REFS_INIT ("_NET_ACTIVE_WINDOW", Xatom_net_active_window) + ATOM_REFS_INIT ("_NET_FRAME_EXTENTS", Xatom_net_frame_extents) + ATOM_REFS_INIT ("_NET_CURRENT_DESKTOP", Xatom_net_current_desktop) + ATOM_REFS_INIT ("_NET_WORKAREA", Xatom_net_workarea) /* Session management */ - { "SM_CLIENT_ID", &dpyinfo->Xatom_SM_CLIENT_ID }, - { "_XSETTINGS_SETTINGS", &dpyinfo->Xatom_xsettings_prop }, - { "MANAGER", &dpyinfo->Xatom_xsettings_mgr }, + ATOM_REFS_INIT ("SM_CLIENT_ID", Xatom_SM_CLIENT_ID) + ATOM_REFS_INIT ("_XSETTINGS_SETTINGS", Xatom_xsettings_prop) + ATOM_REFS_INIT ("MANAGER", Xatom_xsettings_mgr) }; int i; @@ -10280,7 +10285,7 @@ False, atoms_return); for (i = 0; i < atom_count; i++) - *atom_refs[i].atom = atoms_return[i]; + *(Atom *) ((char *) dpyinfo + atom_refs[i].offset) = atoms_return[i]; /* Manual copy of last atom */ dpyinfo->Xatom_xsettings_sel = atoms_return[i]; ------------------------------------------------------------ revno: 113362 author: David Engster committer: Katsumi Yamaoka branch nick: trunk timestamp: Wed 2013-07-10 22:17:07 +0000 message: gnus-start.el (gnus-clean-old-newsrc): Always remove 'unexist' marks if `gnus-newsrc-file-version' does not match `gnus-version'. This fixes a bug in Emacs trunk where the 'unexist' marks were always removed at startup because "Gnus v5.13" was considered smaller than "Ma Gnus v0.03". diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2013-07-10 22:16:03 +0000 +++ lisp/gnus/ChangeLog 2013-07-10 22:17:07 +0000 @@ -1,3 +1,11 @@ +2013-07-10 David Engster + + * gnus-start.el (gnus-clean-old-newsrc): Always remove 'unexist' marks + if `gnus-newsrc-file-version' does not match `gnus-version'. This + fixes a bug in Emacs trunk where the 'unexist' marks were always + removed at startup because "Gnus v5.13" was considered smaller than "Ma + Gnus v0.03". + 2013-07-10 Tassilo Horn * gnus.el (gnus-summary-line-format): Reference === modified file 'lisp/gnus/gnus-start.el' --- lisp/gnus/gnus-start.el 2013-07-02 10:38:58 +0000 +++ lisp/gnus/gnus-start.el 2013-07-10 22:17:07 +0000 @@ -2314,8 +2314,9 @@ (gnus-info-set-marks info (delete exist (gnus-info-marks info)))))) (when (or force - (< (gnus-continuum-version gnus-newsrc-file-version) - (gnus-continuum-version "Ma Gnus v0.03"))) + (not (string= gnus-newsrc-file-version gnus-version))) + (message (concat "Removing unexist marks because newsrc " + "version does not match Gnus version.")) ;; Remove old `exist' marks from old nnimap groups. (dolist (info (cdr gnus-newsrc-alist)) (let ((exist (assoc 'unexist (gnus-info-marks info)))) ------------------------------------------------------------ revno: 113361 author: Tassilo Horn committer: Katsumi Yamaoka branch nick: trunk timestamp: Wed 2013-07-10 22:16:03 +0000 message: gnus.el (gnus-summary-line-format): Docfix diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2013-07-08 23:51:26 +0000 +++ lisp/gnus/ChangeLog 2013-07-10 22:16:03 +0000 @@ -1,3 +1,9 @@ +2013-07-10 Tassilo Horn + + * gnus.el (gnus-summary-line-format): Reference + `gnus-user-date-format-alist' for the &user-date; format, not + `gnus-summary-user-date-format-alist'. + 2013-07-08 Lars Magne Ingebrigtsen * nnml.el (nnml-request-compact-group): Don't bug out if we can't === modified file 'lisp/gnus/gnus.el' --- lisp/gnus/gnus.el 2013-07-06 23:40:56 +0000 +++ lisp/gnus/gnus.el 2013-07-10 22:16:03 +0000 @@ -3007,7 +3007,7 @@ summary just like information from any other summary specifier. &user-date; Age sensitive date format. Various date format is - defined in `gnus-summary-user-date-format-alist'. + defined in `gnus-user-date-format-alist'. The %U (status), %R (replied) and %z (zcore) specs have to be handled ------------------------------------------------------------ revno: 113360 committer: Eli Zaretskii branch nick: trunk timestamp: Wed 2013-07-10 19:18:17 +0300 message: Improve scrolling when line-spacing != 0 and scroll-step = 1. lisp/simple.el (default-line-height): New function. (line-move-partial, line-move): Use it instead of computing the line height inline. (line-move-partial): Always compute ROWH. If the last line is partially-visible, but its text is completely visible, allow cursor to enter such a partially-visible line. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-07-10 14:58:26 +0000 +++ lisp/ChangeLog 2013-07-10 16:18:17 +0000 @@ -1,3 +1,12 @@ +2013-07-10 Eli Zaretskii + + * simple.el (default-line-height): New function. + (line-move-partial, line-move): Use it instead of computing the + line height inline. + (line-move-partial): Always compute ROWH. If the last line is + partially-visible, but its text is completely visible, allow + cursor to enter such a partially-visible line. + 2013-07-10 Michael Albinus Improve error messages. (Bug#14808) === modified file 'lisp/simple.el' --- lisp/simple.el 2013-07-08 17:30:50 +0000 +++ lisp/simple.el 2013-07-10 16:18:17 +0000 @@ -4732,18 +4732,35 @@ (aref (font-info (face-font 'default)) 3)) (t (frame-char-height)))) +(defun default-line-height () + "Return the pixel height of current buffer's default-face text line. + +The value includes `line-spacing', if any, defined for the buffer +or the frame." + (let ((dfh (default-font-height)) + (lsp (if (display-graphic-p) + (or line-spacing + (default-value 'line-spacing) + (frame-parameter nil 'line-spacing) + 0) + 0))) + (if (floatp lsp) + (setq lsp (* dfh lsp))) + (+ dfh lsp))) + (defun window-screen-lines () "Return the number of screen lines in the text area of the selected window. This is different from `window-text-height' in that this function counts lines in units of the height of the font used by the default face displayed -in the window, not in units of the frame's default font. +in the window, not in units of the frame's default font, and also accounts +for `line-spacing', if any, defined for the window's buffer or frame. The value is a floating-point number." (let ((canonical (window-text-height)) (fch (frame-char-height)) - (dfh (default-font-height))) - (/ (* (float canonical) fch) dfh))) + (dlh (default-line-height))) + (/ (* (float canonical) fch) dlh))) ;; Returns non-nil if partial move was done. (defun line-move-partial (arg noerror to-end) @@ -4751,31 +4768,24 @@ ;; Move backward (up). ;; If already vscrolled, reduce vscroll (let ((vs (window-vscroll nil t)) - (dfh (default-font-height))) - (when (> vs dfh) - (set-window-vscroll nil (- vs dfh) t))) + (dlh (default-line-height))) + (when (> vs dlh) + (set-window-vscroll nil (- vs dlh) t))) ;; Move forward (down). (let* ((lh (window-line-height -1)) + (rowh (car lh)) (vpos (nth 1 lh)) (ypos (nth 2 lh)) (rbot (nth 3 lh)) (this-lh (window-line-height)) - (this-height (nth 0 this-lh)) + (this-height (car this-lh)) (this-ypos (nth 2 this-lh)) - (dfh (default-font-height)) - (lsp (if (display-graphic-p) - (or line-spacing - (default-value 'line-spacing) - (frame-parameter nil 'line-spacing) - 0) - 0)) - py vs rowh dlh) - (if (floatp lsp) - (setq lsp (* dfh lsp))) - ;; Default height of a text line, accounting for the default - ;; face's font and line-spacing, if any. - (setq dlh (+ dfh lsp)) + (dlh (default-line-height)) + (wslines (window-screen-lines)) + py vs last-line) + (if (> (mod wslines 1.0) 0.0) + (setq wslines (round (+ wslines 0.5)))) (when (or (null lh) (>= rbot dlh) (<= ypos (- dlh)) @@ -4798,6 +4808,19 @@ (if col-row (- (cdr col-row) (window-vscroll)) (cdr (posn-col-row ppos)))))) + ;; VPOS > 0 means the last line is only partially visible. + ;; But if the part that is visible is at least as tall as the + ;; default font, that means the line is actually fully + ;; readable, and something like line-spacing is hidden. So in + ;; that case we accept the last line in the window as still + ;; visible, and consider the margin as starting one line + ;; later. + (if (and vpos (> vpos 0)) + (if (and rowh + (>= rowh (default-font-height)) + (< rowh dlh)) + (setq last-line (min (- wslines scroll-margin) vpos)) + (setq last-line (min (- wslines scroll-margin 1) (1- vpos))))) (cond ;; If last line of window is fully visible, and vscrolling ;; more would make this line invisible, move forward. @@ -4811,8 +4834,7 @@ ((and (or (null this-height) (<= this-height dlh)) vpos (> vpos 0) - (< py - (min (- (window-screen-lines) scroll-margin 1) (1- vpos)))) + (< py last-line)) nil) ;; When already vscrolled, we vscroll some more if we can, ;; or clear vscroll and move forward at end of tall image. @@ -4824,8 +4846,7 @@ ;; but also optionally vscroll one line so redisplay won't recenter. ((and vpos (> vpos 0) - (= py (min (- (window-screen-lines) scroll-margin 1) - (1- vpos)))) + (= py last-line)) ;; Don't vscroll if the partially-visible line at window ;; bottom has the default height (a.k.a. "just one more text ;; line"): in that case, we do want redisplay to behave @@ -4880,19 +4901,7 @@ ;; If we moved into a tall line, set vscroll to make ;; scrolling through tall images more smooth. (let ((lh (line-pixel-height)) - (dfh (default-font-height)) - (lsp (if (display-graphic-p) - (or line-spacing - (default-value 'line-spacing) - (frame-parameter nil 'line-spacing) - 0) - 0)) - dlh) - ;; DLH is the default height of a text line, accounting - ;; for the default face's font and line-spacing, if any. - (if (floatp lsp) - (setq lsp (* dfh lsp))) - (setq dlh (+ dfh lsp)) + (dlh (default-line-height))) (if (and (< arg 0) (< (point) (window-start)) (> lh dlh)) ------------------------------------------------------------ revno: 113359 committer: Paul Eggert branch nick: trunk timestamp: Wed 2013-07-10 09:11:09 -0700 message: Syntax cleanup, mostly replacing macros with functions. This removes the need for the syntax_temp hack. * search.c: Include syntax.h after buffer.h, since syntax.h uses BVAR. * syntax.c (SYNTAX_INLINE): New macro. (SYNTAX_FLAGS_COMSTART_FIRST, SYNTAX_FLAGS_COMSTART_SECOND) (SYNTAX_FLAGS_COMEND_FIRST, SYNTAX_FLAGS_COMEND_SECOND) (SYNTAX_FLAGS_PREFIX, SYNTAX_FLAGS_COMMENT_STYLEB) (SYNTAX_FLAGS_COMMENT_STYLEC, SYNTAX_FLAGS_COMMENT_STYLEC2) (SYNTAX_FLAGS_COMMENT_NESTED, SYNTAX_FLAGS_COMMENT_STYLE) (SYNTAX_COMEND_FIRST): Now functions, not macros. (ST_COMMENT_STYLE, ST_STRING_STYLE, INTERVALS_AT_ONCE): Now constants, not macros. (syntax_temp) [!__GNUC__]: Remove. (SYNTAX_PREFIX): Remove; all uses replaced by syntax_prefix_flag_p. (syntax_prefix_flag_p): Move implementation of SYNTAX_PREFIX here. (SET_RAW_SYNTAX_ENTRY, SET_RAW_SYNTAX_ENTRY_RANGE, SYNTAX_MATCH) (SETUP_SYNTAX_TABLE, SETUP_SYNTAX_TABLE_FOR_OBJECT): Move here from syntax.h; now functions, not macros. Except for the last function, these are static since only syntax.c uses them. (syntax_multibyte): Rename from SYNTAX_WITH_MULTIBYTE_CHECK. All uses changed. Now a function, not a macro; use this fact to simplify the code. (scan_lists, scan_sexps_forward): Remove workarounds for ancient compiler bugs; no longer relevant. * syntax.h: Use INLINE_HEADER_BEGIN, INLINE_HEADER_END. (SYNTAX_INLINE): New macro. (struct gl_state_s, gl_state): Move earlier, so that it's in scope for the new functions. Use bool for boolean member. (SYNTAX_ENTRY, SYNTAX, SYNTAX_WITH_FLAGS, SYNTAX_MATCH) (SYNTAX_TABLE_BYTE_TO_CHAR, UPDATE_SYNTAX_TABLE_FORWARD) (UPDATE_SYNTAX_TABLE_BACKWARD, UPDATE_SYNTAX_TABLE) (SETUP_BUFFER_SYNTAX_TABLE): Now extern inline functions, not macros. (CURRENT_SYNTAX_TABLE, SYNTAX_ENTRY_INT): Remove; all uses replaced by implementation. (syntax_temp) [!__GNUC__]: Remove decl. (SETUP_SYNTAX_TABLE_FOR_OBJECT): New decl. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-07-10 11:27:15 +0000 +++ src/ChangeLog 2013-07-10 16:11:09 +0000 @@ -1,3 +1,43 @@ +2013-07-10 Paul Eggert + + Syntax cleanup, mostly replacing macros with functions. +` This removes the need for the syntax_temp hack. + * search.c: Include syntax.h after buffer.h, since syntax.h uses BVAR. + * syntax.c (SYNTAX_INLINE): New macro. + (SYNTAX_FLAGS_COMSTART_FIRST, SYNTAX_FLAGS_COMSTART_SECOND) + (SYNTAX_FLAGS_COMEND_FIRST, SYNTAX_FLAGS_COMEND_SECOND) + (SYNTAX_FLAGS_PREFIX, SYNTAX_FLAGS_COMMENT_STYLEB) + (SYNTAX_FLAGS_COMMENT_STYLEC, SYNTAX_FLAGS_COMMENT_STYLEC2) + (SYNTAX_FLAGS_COMMENT_NESTED, SYNTAX_FLAGS_COMMENT_STYLE) + (SYNTAX_COMEND_FIRST): Now functions, not macros. + (ST_COMMENT_STYLE, ST_STRING_STYLE, INTERVALS_AT_ONCE): + Now constants, not macros. + (syntax_temp) [!__GNUC__]: Remove. + (SYNTAX_PREFIX): Remove; all uses replaced by syntax_prefix_flag_p. + (syntax_prefix_flag_p): Move implementation of SYNTAX_PREFIX here. + (SET_RAW_SYNTAX_ENTRY, SET_RAW_SYNTAX_ENTRY_RANGE, SYNTAX_MATCH) + (SETUP_SYNTAX_TABLE, SETUP_SYNTAX_TABLE_FOR_OBJECT): + Move here from syntax.h; now functions, not macros. Except for the + last function, these are static since only syntax.c uses them. + (syntax_multibyte): Rename from SYNTAX_WITH_MULTIBYTE_CHECK. + All uses changed. Now a function, not a macro; use this fact + to simplify the code. + (scan_lists, scan_sexps_forward): Remove workarounds for ancient + compiler bugs; no longer relevant. + * syntax.h: Use INLINE_HEADER_BEGIN, INLINE_HEADER_END. + (SYNTAX_INLINE): New macro. + (struct gl_state_s, gl_state): Move earlier, so that it's in scope + for the new functions. Use bool for boolean member. + (SYNTAX_ENTRY, SYNTAX, SYNTAX_WITH_FLAGS, SYNTAX_MATCH) + (SYNTAX_TABLE_BYTE_TO_CHAR, UPDATE_SYNTAX_TABLE_FORWARD) + (UPDATE_SYNTAX_TABLE_BACKWARD, UPDATE_SYNTAX_TABLE) + (SETUP_BUFFER_SYNTAX_TABLE): + Now extern inline functions, not macros. + (CURRENT_SYNTAX_TABLE, SYNTAX_ENTRY_INT): + Remove; all uses replaced by implementation. + (syntax_temp) [!__GNUC__]: Remove decl. + (SETUP_SYNTAX_TABLE_FOR_OBJECT): New decl. + 2013-07-10 Jan Djärv * emacs.c (main): Fix syntax error. === modified file 'src/search.c' --- src/search.c 2013-05-21 21:48:52 +0000 +++ src/search.c 2013-07-10 16:11:09 +0000 @@ -22,10 +22,10 @@ #include #include "lisp.h" -#include "syntax.h" #include "category.h" #include "character.h" #include "buffer.h" +#include "syntax.h" #include "charset.h" #include "region-cache.h" #include "commands.h" === modified file 'src/syntax.c' --- src/syntax.c 2013-06-20 18:59:08 +0000 +++ src/syntax.c 2013-07-10 16:11:09 +0000 @@ -20,6 +20,8 @@ #include +#define SYNTAX_INLINE EXTERN_INLINE + #include #include "lisp.h" @@ -58,54 +60,86 @@ For style c (like the nested flag), the flag can be placed on any of the chars. */ -/* These macros extract specific flags from an integer +/* These functions extract specific flags from an integer that holds the syntax code and the flags. */ -#define SYNTAX_FLAGS_COMSTART_FIRST(flags) (((flags) >> 16) & 1) - -#define SYNTAX_FLAGS_COMSTART_SECOND(flags) (((flags) >> 17) & 1) - -#define SYNTAX_FLAGS_COMEND_FIRST(flags) (((flags) >> 18) & 1) - -#define SYNTAX_FLAGS_COMEND_SECOND(flags) (((flags) >> 19) & 1) - -#define SYNTAX_FLAGS_PREFIX(flags) (((flags) >> 20) & 1) - -#define SYNTAX_FLAGS_COMMENT_STYLEB(flags) (((flags) >> 21) & 1) -#define SYNTAX_FLAGS_COMMENT_STYLEC(flags) (((flags) >> 23) & 1) -#define SYNTAX_FLAGS_COMMENT_STYLEC2(flags) (((flags) >> 22) & 2) /* C * 2 */ +static bool +SYNTAX_FLAGS_COMSTART_FIRST (int flags) +{ + return (flags >> 16) & 1; +} +static bool +SYNTAX_FLAGS_COMSTART_SECOND (int flags) +{ + return (flags >> 17) & 1; +} +static bool +SYNTAX_FLAGS_COMEND_FIRST (int flags) +{ + return (flags >> 18) & 1; +} +static bool +SYNTAX_FLAGS_COMEND_SECOND (int flags) +{ + return (flags >> 19) & 1; +} +static bool +SYNTAX_FLAGS_PREFIX (int flags) +{ + return (flags >> 20) & 1; +} +static bool +SYNTAX_FLAGS_COMMENT_STYLEB (int flags) +{ + return (flags >> 21) & 1; +} +static bool +SYNTAX_FLAGS_COMMENT_STYLEC (int flags) +{ + return (flags >> 23) & 1; +} +static int +SYNTAX_FLAGS_COMMENT_STYLEC2 (int flags) +{ + return (flags >> 22) & 2; /* SYNTAX_FLAGS_COMMENT_STYLEC (flags) * 2 */ +} +static bool +SYNTAX_FLAGS_COMMENT_NESTED (int flags) +{ + return (flags >> 22) & 1; +} + /* FLAGS should be the flags of the main char of the comment marker, e.g. the second for comstart and the first for comend. */ -#define SYNTAX_FLAGS_COMMENT_STYLE(flags, other_flags) \ - (SYNTAX_FLAGS_COMMENT_STYLEB (flags) \ - | SYNTAX_FLAGS_COMMENT_STYLEC2 (flags) \ - | SYNTAX_FLAGS_COMMENT_STYLEC2 (other_flags)) - -#define SYNTAX_FLAGS_COMMENT_NESTED(flags) (((flags) >> 22) & 1) - -/* These macros extract a particular flag for a given character. */ - -#define SYNTAX_COMEND_FIRST(c) \ - (SYNTAX_FLAGS_COMEND_FIRST (SYNTAX_WITH_FLAGS (c))) -#define SYNTAX_PREFIX(c) (SYNTAX_FLAGS_PREFIX (SYNTAX_WITH_FLAGS (c))) +static int +SYNTAX_FLAGS_COMMENT_STYLE (int flags, int other_flags) +{ + return (SYNTAX_FLAGS_COMMENT_STYLEB (flags) + | SYNTAX_FLAGS_COMMENT_STYLEC2 (flags) + | SYNTAX_FLAGS_COMMENT_STYLEC2 (other_flags)); +} + +/* Extract a particular flag for a given character. */ + +static bool +SYNTAX_COMEND_FIRST (int c) +{ + return SYNTAX_FLAGS_COMEND_FIRST (SYNTAX_WITH_FLAGS (c)); +} /* We use these constants in place for comment-style and - string-ender-char to distinguish comments/strings started by + string-ender-char to distinguish comments/strings started by comment_fence and string_fence codes. */ -#define ST_COMMENT_STYLE (256 + 1) -#define ST_STRING_STYLE (256 + 2) +enum + { + ST_COMMENT_STYLE = 256 + 1, + ST_STRING_STYLE = 256 + 2 + }; static Lisp_Object Qsyntax_table_p; static Lisp_Object Qsyntax_table, Qscan_error; -#ifndef __GNUC__ -/* Used as a temporary in SYNTAX_ENTRY and other macros in syntax.h, - if not compiled with GCC. No need to mark it, since it is used - only very temporarily. */ -Lisp_Object syntax_temp; -#endif - /* This is the internal form of the parse state used in parse-partial-sexp. */ struct lisp_parse_state @@ -162,14 +196,107 @@ bool syntax_prefix_flag_p (int c) { - return SYNTAX_PREFIX (c); + return SYNTAX_FLAGS_PREFIX (SYNTAX_WITH_FLAGS (c)); } struct gl_state_s gl_state; /* Global state of syntax parser. */ -#define INTERVALS_AT_ONCE 10 /* 1 + max-number of intervals +enum { INTERVALS_AT_ONCE = 10 }; /* 1 + max-number of intervals to scan to property-change. */ +/* Set the syntax entry VAL for char C in table TABLE. */ + +static void +SET_RAW_SYNTAX_ENTRY (Lisp_Object table, int c, Lisp_Object val) +{ + CHAR_TABLE_SET (table, c, val); +} + +/* Set the syntax entry VAL for char-range RANGE in table TABLE. + RANGE is a cons (FROM . TO) specifying the range of characters. */ + +static void +SET_RAW_SYNTAX_ENTRY_RANGE (Lisp_Object table, Lisp_Object range, + Lisp_Object val) +{ + Fset_char_table_range (table, range, val); +} + +/* Extract the information from the entry for character C + in the current syntax table. */ + +static Lisp_Object +SYNTAX_MATCH (int c) +{ + Lisp_Object ent = SYNTAX_ENTRY (c); + return CONSP (ent) ? XCDR (ent) : Qnil; +} + +/* This should be called with FROM at the start of forward + search, or after the last position of the backward search. It + makes sure that the first char is picked up with correct table, so + one does not need to call UPDATE_SYNTAX_TABLE immediately after the + call. + Sign of COUNT gives the direction of the search. + */ + +static void +SETUP_SYNTAX_TABLE (ptrdiff_t from, ptrdiff_t count) +{ + SETUP_BUFFER_SYNTAX_TABLE (); + gl_state.b_property = BEGV; + gl_state.e_property = ZV + 1; + gl_state.object = Qnil; + gl_state.offset = 0; + if (parse_sexp_lookup_properties) + if (count > 0 || from > BEGV) + update_syntax_table (count > 0 ? from : from - 1, count, 1, Qnil); +} + +/* Same as above, but in OBJECT. If OBJECT is nil, use current buffer. + If it is t (which is only used in fast_c_string_match_ignore_case), + ignore properties altogether. + + This is meant for regex.c to use. For buffers, regex.c passes arguments + to the UPDATE_SYNTAX_TABLE functions which are relative to BEGV. + So if it is a buffer, we set the offset field to BEGV. */ + +void +SETUP_SYNTAX_TABLE_FOR_OBJECT (Lisp_Object object, + ptrdiff_t from, ptrdiff_t count) +{ + SETUP_BUFFER_SYNTAX_TABLE (); + gl_state.object = object; + if (BUFFERP (gl_state.object)) + { + struct buffer *buf = XBUFFER (gl_state.object); + gl_state.b_property = 1; + gl_state.e_property = BUF_ZV (buf) - BUF_BEGV (buf) + 1; + gl_state.offset = BUF_BEGV (buf) - 1; + } + else if (NILP (gl_state.object)) + { + gl_state.b_property = 1; + gl_state.e_property = ZV - BEGV + 1; + gl_state.offset = BEGV - 1; + } + else if (EQ (gl_state.object, Qt)) + { + gl_state.b_property = 0; + gl_state.e_property = PTRDIFF_MAX; + gl_state.offset = 0; + } + else + { + gl_state.b_property = 0; + gl_state.e_property = 1 + SCHARS (gl_state.object); + gl_state.offset = 0; + } + if (parse_sexp_lookup_properties) + update_syntax_table (from + gl_state.offset - (count <= 0), + count, 1, gl_state.object); +} + /* Update gl_state to an appropriate interval which contains CHARPOS. The sign of COUNT give the relative position of CHARPOS wrt the previously valid interval. If INIT, only [be]_property fields of gl_state are @@ -1751,7 +1878,7 @@ } immediate_quit = 1; - /* This code may look up syntax tables using macros that rely on the + /* This code may look up syntax tables using functions that rely on the gl_state object. To make sure this object is not out of date, let's initialize it manually. We ignore syntax-table text-properties for now, since that's @@ -2426,11 +2553,13 @@ } /* Return syntax code of character C if C is an ASCII character - or `multibyte_symbol_p' is zero. Otherwise, return Ssymbol. */ + or if MULTIBYTE_SYMBOL_P is false. Otherwise, return Ssymbol. */ -#define SYNTAX_WITH_MULTIBYTE_CHECK(c) \ - ((ASCII_CHAR_P (c) || !multibyte_symbol_p) \ - ? SYNTAX (c) : Ssymbol) +static enum syntaxcode +syntax_multibyte (int c, bool multibyte_symbol_p) +{ + return ASCII_CHAR_P (c) || !multibyte_symbol_p ? SYNTAX (c) : Ssymbol; +} static Lisp_Object scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag) @@ -2441,7 +2570,7 @@ int stringterm; bool quoted; bool mathexit = 0; - enum syntaxcode code, temp_code, c_code; + enum syntaxcode code; EMACS_INT min_depth = depth; /* Err out if depth gets less than this. */ int comstyle = 0; /* style of comment encountered */ bool comnested = 0; /* whether the comment is nestable or not */ @@ -2473,7 +2602,7 @@ UPDATE_SYNTAX_TABLE_FORWARD (from); c = FETCH_CHAR_AS_MULTIBYTE (from_byte); syntax = SYNTAX_WITH_FLAGS (c); - code = SYNTAX_WITH_MULTIBYTE_CHECK (c); + code = syntax_multibyte (c, multibyte_symbol_p); comstart_first = SYNTAX_FLAGS_COMSTART_FIRST (syntax); comnested = SYNTAX_FLAGS_COMMENT_NESTED (syntax); comstyle = SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0); @@ -2519,10 +2648,8 @@ { UPDATE_SYNTAX_TABLE_FORWARD (from); - /* Some compilers can't handle this inside the switch. */ c = FETCH_CHAR_AS_MULTIBYTE (from_byte); - c_code = SYNTAX_WITH_MULTIBYTE_CHECK (c); - switch (c_code) + switch (syntax_multibyte (c, multibyte_symbol_p)) { case Scharquote: case Sescape: @@ -2594,18 +2721,17 @@ stringterm = FETCH_CHAR_AS_MULTIBYTE (temp_pos); while (1) { + enum syntaxcode c_code; if (from >= stop) goto lose; UPDATE_SYNTAX_TABLE_FORWARD (from); c = FETCH_CHAR_AS_MULTIBYTE (from_byte); + c_code = syntax_multibyte (c, multibyte_symbol_p); if (code == Sstring - ? (c == stringterm - && SYNTAX_WITH_MULTIBYTE_CHECK (c) == Sstring) - : SYNTAX_WITH_MULTIBYTE_CHECK (c) == Sstring_fence) + ? c == stringterm && c_code == Sstring + : c_code == Sstring_fence) break; - /* Some compilers can't handle this inside the switch. */ - c_code = SYNTAX_WITH_MULTIBYTE_CHECK (c); switch (c_code) { case Scharquote: @@ -2644,7 +2770,7 @@ UPDATE_SYNTAX_TABLE_BACKWARD (from); c = FETCH_CHAR_AS_MULTIBYTE (from_byte); syntax= SYNTAX_WITH_FLAGS (c); - code = SYNTAX_WITH_MULTIBYTE_CHECK (c); + code = syntax_multibyte (c, multibyte_symbol_p); if (depth == min_depth) last_good = from; comstyle = 0; @@ -2697,9 +2823,8 @@ temp_pos--; UPDATE_SYNTAX_TABLE_BACKWARD (from - 1); c1 = FETCH_CHAR_AS_MULTIBYTE (temp_pos); - temp_code = SYNTAX_WITH_MULTIBYTE_CHECK (c1); /* Don't allow comment-end to be quoted. */ - if (temp_code == Sendcomment) + if (syntax_multibyte (c1, multibyte_symbol_p) == Sendcomment) goto done2; quoted = char_quoted (from - 1, temp_pos); if (quoted) @@ -2709,11 +2834,12 @@ UPDATE_SYNTAX_TABLE_BACKWARD (from - 1); } c1 = FETCH_CHAR_AS_MULTIBYTE (temp_pos); - temp_code = SYNTAX_WITH_MULTIBYTE_CHECK (c1); - if (! (quoted || temp_code == Sword - || temp_code == Ssymbol - || temp_code == Squote)) - goto done2; + if (! quoted) + switch (syntax_multibyte (c1, multibyte_symbol_p)) + { + case Sword: case Ssymbol: case Squote: break; + default: goto done2; + } DEC_BOTH (from, from_byte); } goto done2; @@ -2768,10 +2894,12 @@ goto lose; DEC_BOTH (from, from_byte); UPDATE_SYNTAX_TABLE_BACKWARD (from); - if (!char_quoted (from, from_byte) - && (c = FETCH_CHAR_AS_MULTIBYTE (from_byte), - SYNTAX_WITH_MULTIBYTE_CHECK (c) == code)) - break; + if (!char_quoted (from, from_byte)) + { + c = FETCH_CHAR_AS_MULTIBYTE (from_byte); + if (syntax_multibyte (c, multibyte_symbol_p) == code) + break; + } } if (code == Sstring_fence && !depth && sexpflag) goto done2; break; @@ -2784,11 +2912,14 @@ goto lose; DEC_BOTH (from, from_byte); UPDATE_SYNTAX_TABLE_BACKWARD (from); - if (!char_quoted (from, from_byte) - && (stringterm - == (c = FETCH_CHAR_AS_MULTIBYTE (from_byte))) - && SYNTAX_WITH_MULTIBYTE_CHECK (c) == Sstring) - break; + if (!char_quoted (from, from_byte)) + { + c = FETCH_CHAR_AS_MULTIBYTE (from_byte); + if (c == stringterm + && (syntax_multibyte (c, multibyte_symbol_p) + == Sstring)) + break; + } } if (!depth && sexpflag) goto done2; break; @@ -2894,7 +3025,7 @@ while (!char_quoted (pos, pos_byte) /* Previous statement updates syntax table. */ && ((c = FETCH_CHAR_AS_MULTIBYTE (pos_byte), SYNTAX (c) == Squote) - || SYNTAX_PREFIX (c))) + || syntax_prefix_flag_p (c))) { opoint = pos; opoint_byte = pos_byte; @@ -3117,10 +3248,8 @@ symstarted: while (from < end) { - /* Some compilers can't handle this inside the switch. */ int symchar = FETCH_CHAR_AS_MULTIBYTE (from_byte); - enum syntaxcode symcharcode = SYNTAX (symchar); - switch (symcharcode) + switch (SYNTAX (symchar)) { case Scharquote: case Sescape: @@ -3206,7 +3335,6 @@ if (from >= end) goto done; c = FETCH_CHAR_AS_MULTIBYTE (from_byte); - /* Some compilers can't handle this inside the switch. */ c_code = SYNTAX (c); /* Check C_CODE here so that if the char has === modified file 'src/syntax.h' --- src/syntax.h 2013-06-20 18:59:08 +0000 +++ src/syntax.h 2013-07-10 16:11:09 +0000 @@ -18,6 +18,10 @@ You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ +INLINE_HEADER_BEGIN +#ifndef SYNTAX_INLINE +# define SYNTAX_INLINE INLINE +#endif extern void update_syntax_table (ptrdiff_t, EMACS_INT, bool, Lisp_Object); @@ -54,232 +58,13 @@ Smax /* Upper bound on codes that are meaningful */ }; -/* Set the syntax entry VAL for char C in table TABLE. */ - -#define SET_RAW_SYNTAX_ENTRY(table, c, val) \ - CHAR_TABLE_SET ((table), c, (val)) - -/* Set the syntax entry VAL for char-range RANGE in table TABLE. - RANGE is a cons (FROM . TO) specifying the range of characters. */ - -#define SET_RAW_SYNTAX_ENTRY_RANGE(table, range, val) \ - Fset_char_table_range ((table), (range), (val)) - -/* SYNTAX_ENTRY fetches the information from the entry for character C - in syntax table TABLE, or from globally kept data (gl_state). - Does inheritance. */ -/* CURRENT_SYNTAX_TABLE gives the syntax table valid for current - position, it is either the buffer's syntax table, or syntax table - found in text properties. */ - -#ifdef SYNTAX_ENTRY_VIA_PROPERTY -# define SYNTAX_ENTRY(c) \ - (gl_state.use_global ? gl_state.global_code : SYNTAX_ENTRY_INT (c)) -# define CURRENT_SYNTAX_TABLE gl_state.current_syntax_table -#else -# define SYNTAX_ENTRY SYNTAX_ENTRY_INT -# define CURRENT_SYNTAX_TABLE BVAR (current_buffer, syntax_table) -#endif - -#define SYNTAX_ENTRY_INT(c) CHAR_TABLE_REF (CURRENT_SYNTAX_TABLE, (c)) - -/* Extract the information from the entry for character C - in the current syntax table. */ - -#ifdef __GNUC__ -#define SYNTAX(c) \ - ({ Lisp_Object _syntax_temp; \ - _syntax_temp = SYNTAX_ENTRY (c); \ - (CONSP (_syntax_temp) \ - ? (enum syntaxcode) (XINT (XCAR (_syntax_temp)) & 0xff) \ - : Swhitespace); }) - -#define SYNTAX_WITH_FLAGS(c) \ - ({ Lisp_Object _syntax_temp; \ - _syntax_temp = SYNTAX_ENTRY (c); \ - (CONSP (_syntax_temp) \ - ? XINT (XCAR (_syntax_temp)) \ - : Swhitespace); }) - -#define SYNTAX_MATCH(c) \ - ({ Lisp_Object _syntax_temp; \ - _syntax_temp = SYNTAX_ENTRY (c); \ - (CONSP (_syntax_temp) \ - ? XCDR (_syntax_temp) \ - : Qnil); }) -#else -extern Lisp_Object syntax_temp; -#define SYNTAX(c) \ - (syntax_temp = SYNTAX_ENTRY ((c)), \ - (CONSP (syntax_temp) \ - ? (enum syntaxcode) (XINT (XCAR (syntax_temp)) & 0xff) \ - : Swhitespace)) - -#define SYNTAX_WITH_FLAGS(c) \ - (syntax_temp = SYNTAX_ENTRY ((c)), \ - (CONSP (syntax_temp) \ - ? XINT (XCAR (syntax_temp)) \ - : Swhitespace)) - -#define SYNTAX_MATCH(c) \ - (syntax_temp = SYNTAX_ENTRY ((c)), \ - (CONSP (syntax_temp) \ - ? XCDR (syntax_temp) \ - : Qnil)) -#endif - - -/* Whether the syntax of the character C has the prefix flag set. */ -extern bool syntax_prefix_flag_p (int c); - -/* This array, indexed by a character less than 256, contains the - syntax code which that character signifies (as an unsigned char). - For example, syntax_spec_code['w'] == Sword. */ - -extern unsigned char const syntax_spec_code[0400]; - -/* Indexed by syntax code, give the letter that describes it. */ - -extern char const syntax_code_spec[16]; - -/* Convert the byte offset BYTEPOS into a character position, - for the object recorded in gl_state with SETUP_SYNTAX_TABLE_FOR_OBJECT. - - The value is meant for use in the UPDATE_SYNTAX_TABLE... macros. - These macros do nothing when parse_sexp_lookup_properties is 0, - so we return 0 in that case, for speed. */ - -#define SYNTAX_TABLE_BYTE_TO_CHAR(bytepos) \ - (! parse_sexp_lookup_properties \ - ? 0 \ - : STRINGP (gl_state.object) \ - ? string_byte_to_char (gl_state.object, (bytepos)) \ - : BUFFERP (gl_state.object) \ - ? buf_bytepos_to_charpos (XBUFFER (gl_state.object), \ - (bytepos) + BUF_BEGV_BYTE (XBUFFER (gl_state.object)) - 1) - BUF_BEGV (XBUFFER (gl_state.object)) + 1 \ - : NILP (gl_state.object) \ - ? BYTE_TO_CHAR ((bytepos) + BEGV_BYTE - 1) - BEGV + 1 \ - : (bytepos)) - -/* Make syntax table state (gl_state) good for CHARPOS, assuming it is - currently good for a position before CHARPOS. */ - -#define UPDATE_SYNTAX_TABLE_FORWARD(charpos) \ - (parse_sexp_lookup_properties \ - && (charpos) >= gl_state.e_property \ - ? (update_syntax_table ((charpos) + gl_state.offset, 1, 0, \ - gl_state.object), \ - 1) \ - : 0) - -/* Make syntax table state (gl_state) good for CHARPOS, assuming it is - currently good for a position after CHARPOS. */ - -#define UPDATE_SYNTAX_TABLE_BACKWARD(charpos) \ - (parse_sexp_lookup_properties \ - && (charpos) < gl_state.b_property \ - ? (update_syntax_table ((charpos) + gl_state.offset, -1, 0, \ - gl_state.object), \ - 1) \ - : 0) - -/* Make syntax table good for CHARPOS. */ - -#define UPDATE_SYNTAX_TABLE(charpos) \ - (parse_sexp_lookup_properties \ - && (charpos) < gl_state.b_property \ - ? (update_syntax_table ((charpos) + gl_state.offset, -1, 0, \ - gl_state.object), \ - 1) \ - : (parse_sexp_lookup_properties \ - && (charpos) >= gl_state.e_property \ - ? (update_syntax_table ((charpos) + gl_state.offset, 1, 0,\ - gl_state.object), \ - 1) \ - : 0)) - -/* This macro sets up the buffer-global syntax table. */ -#define SETUP_BUFFER_SYNTAX_TABLE() \ -do \ - { \ - gl_state.use_global = 0; \ - gl_state.current_syntax_table = BVAR (current_buffer, syntax_table);\ - } while (0) - -/* This macro should be called with FROM at the start of forward - search, or after the last position of the backward search. It - makes sure that the first char is picked up with correct table, so - one does not need to call UPDATE_SYNTAX_TABLE immediately after the - call. - Sign of COUNT gives the direction of the search. - */ - -#define SETUP_SYNTAX_TABLE(FROM, COUNT) \ -do \ - { \ - SETUP_BUFFER_SYNTAX_TABLE (); \ - gl_state.b_property = BEGV; \ - gl_state.e_property = ZV + 1; \ - gl_state.object = Qnil; \ - gl_state.offset = 0; \ - if (parse_sexp_lookup_properties) \ - if ((COUNT) > 0 || (FROM) > BEGV) \ - update_syntax_table ((COUNT) > 0 ? (FROM) : (FROM) - 1, (COUNT),\ - 1, Qnil); \ - } \ -while (0) - -/* Same as above, but in OBJECT. If OBJECT is nil, use current buffer. - If it is t (which is only used in fast_c_string_match_ignore_case), - ignore properties altogether. - - This is meant for regex.c to use. For buffers, regex.c passes arguments - to the UPDATE_SYNTAX_TABLE macros which are relative to BEGV. - So if it is a buffer, we set the offset field to BEGV. */ - -#define SETUP_SYNTAX_TABLE_FOR_OBJECT(OBJECT, FROM, COUNT) \ -do \ - { \ - SETUP_BUFFER_SYNTAX_TABLE (); \ - gl_state.object = (OBJECT); \ - if (BUFFERP (gl_state.object)) \ - { \ - struct buffer *buf = XBUFFER (gl_state.object); \ - gl_state.b_property = 1; \ - gl_state.e_property = BUF_ZV (buf) - BUF_BEGV (buf) + 1; \ - gl_state.offset = BUF_BEGV (buf) - 1; \ - } \ - else if (NILP (gl_state.object)) \ - { \ - gl_state.b_property = 1; \ - gl_state.e_property = ZV - BEGV + 1; \ - gl_state.offset = BEGV - 1; \ - } \ - else if (EQ (gl_state.object, Qt)) \ - { \ - gl_state.b_property = 0; \ - gl_state.e_property = PTRDIFF_MAX; \ - gl_state.offset = 0; \ - } \ - else \ - { \ - gl_state.b_property = 0; \ - gl_state.e_property = 1 + SCHARS (gl_state.object); \ - gl_state.offset = 0; \ - } \ - if (parse_sexp_lookup_properties) \ - update_syntax_table (((FROM) + gl_state.offset \ - + (COUNT > 0 ? 0 : -1)), \ - COUNT, 1, gl_state.object); \ - } \ -while (0) struct gl_state_s { Lisp_Object object; /* The object we are scanning. */ ptrdiff_t start; /* Where to stop. */ ptrdiff_t stop; /* Where to stop. */ - int use_global; /* Whether to use global_code + bool use_global; /* Whether to use global_code or c_s_t. */ Lisp_Object global_code; /* Syntax code of current char. */ Lisp_Object current_syntax_table; /* Syntax table for current pos. */ @@ -299,4 +84,115 @@ }; extern struct gl_state_s gl_state; + +/* Fetch the information from the entry for character C + in syntax table TABLE, or from globally kept data (gl_state). + Does inheritance. */ + +SYNTAX_INLINE Lisp_Object +SYNTAX_ENTRY (int c) +{ +#ifdef SYNTAX_ENTRY_VIA_PROPERTY + return (gl_state.use_global + ? gl_state.global_code + : CHAR_TABLE_REF (gl_state.current_syntax_table, c)); +#else + return CHAR_TABLE_REF (BVAR (current_buffer, syntax_table), c); +#endif +} + +/* Extract the information from the entry for character C + in the current syntax table. */ + +SYNTAX_INLINE int +SYNTAX_WITH_FLAGS (int c) +{ + Lisp_Object ent = SYNTAX_ENTRY (c); + return CONSP (ent) ? XINT (XCAR (ent)) : Swhitespace; +} + +SYNTAX_INLINE enum syntaxcode +SYNTAX (int c) +{ + return SYNTAX_WITH_FLAGS (c) & 0xff; +} + + +/* Whether the syntax of the character C has the prefix flag set. */ +extern bool syntax_prefix_flag_p (int c); + +/* This array, indexed by a character less than 256, contains the + syntax code which that character signifies (as an unsigned char). + For example, syntax_spec_code['w'] == Sword. */ + +extern unsigned char const syntax_spec_code[0400]; + +/* Indexed by syntax code, give the letter that describes it. */ + +extern char const syntax_code_spec[16]; + +/* Convert the byte offset BYTEPOS into a character position, + for the object recorded in gl_state with SETUP_SYNTAX_TABLE_FOR_OBJECT. + + The value is meant for use in code that does nothing when + parse_sexp_lookup_properties is 0, so return 0 in that case, for speed. */ + +SYNTAX_INLINE ptrdiff_t +SYNTAX_TABLE_BYTE_TO_CHAR (ptrdiff_t bytepos) +{ + return (! parse_sexp_lookup_properties + ? 0 + : STRINGP (gl_state.object) + ? string_byte_to_char (gl_state.object, bytepos) + : BUFFERP (gl_state.object) + ? ((buf_bytepos_to_charpos + (XBUFFER (gl_state.object), + (bytepos + BUF_BEGV_BYTE (XBUFFER (gl_state.object)) - 1))) + - BUF_BEGV (XBUFFER (gl_state.object)) + 1) + : NILP (gl_state.object) + ? BYTE_TO_CHAR (bytepos + BEGV_BYTE - 1) - BEGV + 1 + : bytepos); +} + +/* Make syntax table state (gl_state) good for CHARPOS, assuming it is + currently good for a position before CHARPOS. */ + +SYNTAX_INLINE void +UPDATE_SYNTAX_TABLE_FORWARD (ptrdiff_t charpos) +{ + if (parse_sexp_lookup_properties && charpos >= gl_state.e_property) + update_syntax_table (charpos + gl_state.offset, 1, 0, gl_state.object); +} + +/* Make syntax table state (gl_state) good for CHARPOS, assuming it is + currently good for a position after CHARPOS. */ + +SYNTAX_INLINE void +UPDATE_SYNTAX_TABLE_BACKWARD (ptrdiff_t charpos) +{ + if (parse_sexp_lookup_properties && charpos < gl_state.b_property) + update_syntax_table (charpos + gl_state.offset, -1, 0, gl_state.object); +} + +/* Make syntax table good for CHARPOS. */ + +SYNTAX_INLINE void +UPDATE_SYNTAX_TABLE (ptrdiff_t charpos) +{ + UPDATE_SYNTAX_TABLE_BACKWARD (charpos); + UPDATE_SYNTAX_TABLE_FORWARD (charpos); +} + +/* Set up the buffer-global syntax table. */ + +SYNTAX_INLINE void +SETUP_BUFFER_SYNTAX_TABLE (void) +{ + gl_state.use_global = 0; + gl_state.current_syntax_table = BVAR (current_buffer, syntax_table); +} + extern ptrdiff_t scan_words (ptrdiff_t, EMACS_INT); +extern void SETUP_SYNTAX_TABLE_FOR_OBJECT (Lisp_Object, ptrdiff_t, ptrdiff_t); + +INLINE_HEADER_END ------------------------------------------------------------ revno: 113358 committer: Michael Albinus branch nick: trunk timestamp: Wed 2013-07-10 17:18:39 +0200 message: Fix last patch. diff: === modified file 'lisp/net/tramp.el' --- lisp/net/tramp.el 2013-07-10 14:58:26 +0000 +++ lisp/net/tramp.el 2013-07-10 15:18:39 +0000 @@ -1600,7 +1600,7 @@ nested call of the macro, there are only traces without a visible progress reporter." (declare (indent 3) (debug t)) - `(let (pr tm) + `(let (pr tm result) (tramp-message ,vec ,level "%s..." ,message) ;; We start a pulsing progress reporter after 3 seconds. Feature ;; introduced in Emacs 24.1. @@ -1614,7 +1614,7 @@ (condition-case err (unwind-protect ;; Execute the body. - (progn ,@body) + (setq result (progn ,@body)) ;; Stop progress reporter. (if tm (tramp-compat-funcall 'cancel-timer tm))) @@ -1624,7 +1624,8 @@ (signal (car err) (cdr err)))) ;; Exit. - (tramp-message ,vec ,level "%s...done" ,message))) + (tramp-message ,vec ,level "%s...done" ,message) + result)) (tramp-compat-font-lock-add-keywords 'emacs-lisp-mode '("\\")) ------------------------------------------------------------ revno: 113357 committer: Michael Albinus branch nick: trunk timestamp: Wed 2013-07-10 16:58:26 +0200 message: Improve error messages. (Bug#14808) * net/tramp.el (tramp-current-connection): New defvar, moved from tramp-sh.el. (tramp-message-show-progress-reporter-message): Removed, not needed anymore. (tramp-error-with-buffer): Show message in minibuffer. Discard input before waiting. Reset connection timestamp. (with-tramp-progress-reporter): Improve messages. (tramp-process-actions): Use progress reporter. Delete process in case of error. Improve messages. * net/tramp-sh.el (tramp-barf-if-no-shell-prompt): Use condition-case. Call `tramp-error-with-buffer' with vector and buffer. (tramp-current-connection): Removed. (tramp-maybe-open-connection): The car of `tramp-current-connection' are the first 3 slots of the vector. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-07-10 14:34:13 +0000 +++ lisp/ChangeLog 2013-07-10 14:58:26 +0000 @@ -1,3 +1,23 @@ +2013-07-10 Michael Albinus + + Improve error messages. (Bug#14808) + + * net/tramp.el (tramp-current-connection): New defvar, moved from + tramp-sh.el. + (tramp-message-show-progress-reporter-message): Removed, not + needed anymore. + (tramp-error-with-buffer): Show message in minibuffer. Discard + input before waiting. Reset connection timestamp. + (with-tramp-progress-reporter): Improve messages. + (tramp-process-actions): Use progress reporter. Delete process in + case of error. Improve messages. + + * net/tramp-sh.el (tramp-barf-if-no-shell-prompt): Use + condition-case. Call `tramp-error-with-buffer' with vector and buffer. + (tramp-current-connection): Removed. + (tramp-maybe-open-connection): The car of + `tramp-current-connection' are the first 3 slots of the vector. + 2013-07-10 Teodor Zlatanov * progmodes/cfengine.el (cfengine3-indent-line): Do not indent === modified file 'lisp/net/tramp-sh.el' --- lisp/net/tramp-sh.el 2013-07-06 16:17:16 +0000 +++ lisp/net/tramp-sh.el 2013-07-10 14:58:26 +0000 @@ -3752,12 +3752,16 @@ "Wait for shell prompt and barf if none appears. Looks at process PROC to see if a shell prompt appears in TIMEOUT seconds. If not, it produces an error message with the given ERROR-ARGS." - (unless - (tramp-wait-for-regexp - proc timeout - (format - "\\(%s\\|%s\\)\\'" shell-prompt-pattern tramp-shell-prompt-pattern)) - (apply 'tramp-error-with-buffer nil proc 'file-error error-args))) + (let ((vec (tramp-get-connection-property proc "vector" nil))) + (condition-case err + (tramp-wait-for-regexp + proc timeout + (format + "\\(%s\\|%s\\)\\'" shell-prompt-pattern tramp-shell-prompt-pattern)) + (error + (delete-process proc) + (apply 'tramp-error-with-buffer + (tramp-get-connection-buffer vec) vec 'file-error error-args))))) (defun tramp-open-connection-setup-interactive-shell (proc vec) "Set up an interactive shell. @@ -4332,9 +4336,6 @@ ;; Result. target-alist)) -(defvar tramp-current-connection nil - "Last connection timestamp.") - (defun tramp-maybe-open-connection (vec) "Maybe open a connection VEC. Does not do anything if a connection is already open, but re-opens the @@ -4348,7 +4349,7 @@ ;; If Tramp opens the same connection within a short time frame, ;; there is a problem. We shall signal this. (unless (or (and p (processp p) (memq (process-status p) '(run open))) - (not (equal (butlast (append vec nil)) + (not (equal (butlast (append vec nil) 2) (car tramp-current-connection))) (> (tramp-time-diff (current-time) (cdr tramp-current-connection)) @@ -4433,7 +4434,7 @@ (set-process-sentinel p 'tramp-process-sentinel) (tramp-compat-set-process-query-on-exit-flag p nil) (setq tramp-current-connection - (cons (butlast (append vec nil)) (current-time)) + (cons (butlast (append vec nil) 2) (current-time)) tramp-current-host (system-name)) (tramp-message @@ -4442,7 +4443,7 @@ ;; Check whether process is alive. (tramp-barf-if-no-shell-prompt p 60 - "Couldn't find local shell prompt %s" tramp-encoding-shell) + "Couldn't find local shell prompt for %s" tramp-encoding-shell) ;; Now do all the connections as specified. (while target-alist === modified file 'lisp/net/tramp.el' --- lisp/net/tramp.el 2013-07-06 16:12:04 +0000 +++ lisp/net/tramp.el 2013-07-10 14:58:26 +0000 @@ -1071,6 +1071,9 @@ (defvar tramp-current-host nil "Remote host for this *tramp* buffer.") +(defvar tramp-current-connection nil + "Last connection timestamp.") + ;;;###autoload (defconst tramp-completion-file-name-handler-alist '((file-name-all-completions . tramp-completion-handle-file-name-all-completions) @@ -1464,10 +1467,6 @@ This variable is used to disable messages from `tramp-error'. The messages are visible anyway, because an error is raised.") -(defvar tramp-message-show-progress-reporter-message t - "Show Tramp progress reporter message in the minibuffer. -This variable is used to disable recursive progress reporter messages.") - (defsubst tramp-message (vec-or-proc level fmt-string &rest args) "Emit a message depending on verbosity level. VEC-OR-PROC identifies the Tramp buffer to use. It can be either a @@ -1547,12 +1546,13 @@ (or (and (bufferp buffer) buffer) (and (processp vec-or-proc) (process-buffer vec-or-proc)) (tramp-get-connection-buffer vec-or-proc))) - (when (string-equal fmt-string "Process died") - (message - "%s\n %s" - "Tramp failed to connect. If this happens repeatedly, try" - "`M-x tramp-cleanup-this-connection'")) - (sit-for 30)))))) + ;; `tramp-error' does not show messages. So we must do it ourselves. + (message fmt-string args) + (discard-input) + (sit-for 30))) + ;; Reset timestamp. It would be wrong after waiting for a while. + (when tramp-current-connection + (setcdr tramp-current-connection (current-time)))))) (defmacro with-parsed-tramp-file-name (filename var &rest body) "Parse a Tramp filename and make components available in the body. @@ -1604,23 +1604,27 @@ (tramp-message ,vec ,level "%s..." ,message) ;; We start a pulsing progress reporter after 3 seconds. Feature ;; introduced in Emacs 24.1. - (when (and tramp-message-show-progress-reporter-message - tramp-message-show-message + (when (and tramp-message-show-message ;; Display only when there is a minimum level. (<= ,level (min tramp-verbose 3))) (ignore-errors (setq pr (tramp-compat-funcall 'make-progress-reporter ,message) tm (when pr (run-at-time 3 0.1 'tramp-progress-reporter-update pr))))) - (unwind-protect - ;; Execute the body. Suppress concurrent progress reporter - ;; messages. - (let ((tramp-message-show-progress-reporter-message - (and tramp-message-show-progress-reporter-message (not tm)))) - ,@body) - ;; Stop progress reporter. - (if tm (tramp-compat-funcall 'cancel-timer tm)) - (tramp-message ,vec ,level "%s...done" ,message)))) + (condition-case err + (unwind-protect + ;; Execute the body. + (progn ,@body) + ;; Stop progress reporter. + (if tm (tramp-compat-funcall 'cancel-timer tm))) + + ;; Error handling. + ((error quit) + (tramp-message ,vec ,level "%s...failed" ,message) + (signal (car err) (cdr err)))) + + ;; Exit. + (tramp-message ,vec ,level "%s...done" ,message))) (tramp-compat-font-lock-add-keywords 'emacs-lisp-mode '("\\")) @@ -3393,39 +3397,47 @@ PROC and VEC indicate the remote connection to be used. POS, if set, is the starting point of the region to be deleted in the connection buffer." - ;; Preserve message for `progress-reporter'. - (tramp-compat-with-temp-message "" - ;; Enable `auth-source' and `password-cache'. We must use - ;; tramp-current-* variables in case we have several hops. - (tramp-set-connection-property - (tramp-dissect-file-name - (tramp-make-tramp-file-name - tramp-current-method tramp-current-user tramp-current-host "")) - "first-password-request" t) - (save-restriction + ;; Enable `auth-source' and `password-cache'. We must use + ;; tramp-current-* variables in case we have several hops. + (tramp-set-connection-property + (tramp-dissect-file-name + (tramp-make-tramp-file-name + tramp-current-method tramp-current-user tramp-current-host "")) + "first-password-request" t) + (save-restriction + (with-tramp-progress-reporter + proc 3 "Waiting for prompts from remote shell" (let (exit) - (while (not exit) - (tramp-message proc 3 "Waiting for prompts from remote shell") - (setq exit - (catch 'tramp-action - (if timeout - (with-timeout (timeout) - (tramp-process-one-action proc vec actions)) + (if timeout + (with-timeout (timeout (setq exit 'timeout)) + (while (not exit) + (setq exit + (catch 'tramp-action + (tramp-process-one-action proc vec actions))))) + (while (not exit) + (setq exit + (catch 'tramp-action (tramp-process-one-action proc vec actions))))) (with-current-buffer (tramp-get-connection-buffer vec) (widen) (tramp-message vec 6 "\n%s" (buffer-string))) (unless (eq exit 'ok) (tramp-clear-passwd vec) + (delete-process proc) (tramp-error-with-buffer - nil vec 'file-error + (tramp-get-connection-buffer vec) vec 'file-error (cond ((eq exit 'permission-denied) "Permission denied") - ((eq exit 'process-died) "Process died") - (t "Login failed")))) - (when (numberp pos) - (with-current-buffer (tramp-get-connection-buffer vec) - (let (buffer-read-only) (delete-region pos (point))))))))) + ((eq exit 'process-died) + (concat + "Tramp failed to connect. If this happens repeatedly, try\n" + " `M-x tramp-cleanup-this-connection'")) + ((eq exit 'timeout) + "Timeout reached. Check the buffer for the error reason") + (t "Login failed"))))) + (when (numberp pos) + (with-current-buffer (tramp-get-connection-buffer vec) + (let (buffer-read-only) (delete-region pos (point)))))))) :;; Utility functions: ------------------------------------------------------------ revno: 113356 committer: Ted Zlatanov branch nick: quickfixes timestamp: Wed 2013-07-10 10:34:13 -0400 message: * progmodes/cfengine.el: Do not indent inside continued strings. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-07-10 06:26:23 +0000 +++ lisp/ChangeLog 2013-07-10 14:34:13 +0000 @@ -1,3 +1,8 @@ +2013-07-10 Teodor Zlatanov + + * progmodes/cfengine.el (cfengine3-indent-line): Do not indent + inside continued strings. + 2013-07-10 Paul Eggert Timestamp fixes for undo (Bug#14824). === modified file 'lisp/progmodes/cfengine.el' --- lisp/progmodes/cfengine.el 2013-06-18 22:13:25 +0000 +++ lisp/progmodes/cfengine.el 2013-07-10 14:34:13 +0000 @@ -387,10 +387,10 @@ (skip-chars-forward " \t") (current-column))) (error nil))) - ;; Inside a string and it starts before this line. + ;; Inside a string and it starts before this line: do nothing. ((and (nth 3 parse) (< (nth 8 parse) (save-excursion (beginning-of-line) (point)))) - (indent-line-to 0)) + ) ;; Inside a defun, but not a nested list (depth is 1). This is ;; a promise, usually. ------------------------------------------------------------ revno: 113355 committer: Michael Albinus branch nick: trunk timestamp: Wed 2013-07-10 16:07:17 +0200 message: Add comment. diff: === modified file 'lisp/net/tramp-cache.el' --- lisp/net/tramp-cache.el 2013-06-18 14:16:12 +0000 +++ lisp/net/tramp-cache.el 2013-07-10 14:07:17 +0000 @@ -38,9 +38,11 @@ ;; ;; - localname is a string. This are temporary properties, which are ;; related to the file localname is referring to. Examples: -;; "file-exists-p" is t or nile, depending on the file existence, or +;; "file-exists-p" is t or nil, depending on the file existence, or ;; "file-attributes" caches the result of the function -;; `file-attributes'. +;; `file-attributes'. These entries have a timestamp, and they +;; expire after `remote-file-name-inhibit-cache' seconds if this +;; variable is set. ;; ;; - The key is a process. This are temporary properties related to ;; an open connection. Examples: "scripts" keeps shell script ------------------------------------------------------------ revno: 113354 committer: Jan D. branch nick: trunk timestamp: Wed 2013-07-10 13:27:15 +0200 message: * emacs.c (main): Fix syntax error. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-07-10 06:26:23 +0000 +++ src/ChangeLog 2013-07-10 11:27:15 +0000 @@ -1,3 +1,7 @@ +2013-07-10 Jan Djärv + + * emacs.c (main): Fix syntax error. + 2013-07-10 Paul Eggert Timestamp fixes for undo (Bug#14824). === modified file 'src/emacs.c' --- src/emacs.c 2013-07-09 07:04:48 +0000 +++ src/emacs.c 2013-07-10 11:27:15 +0000 @@ -1042,7 +1042,7 @@ execvp (argv[0], argv); emacs_perror (argv[0]); - exit (errno == ENOENT : EXIT_ENOENT : EXIT_CANNOT_INVOKE); + exit (errno == ENOENT ? EXIT_ENOENT : EXIT_CANNOT_INVOKE); } /* In exec'd: parse special dname into pipe and name info. */ ------------------------------------------------------------ revno: 113353 committer: Glenn Morris branch nick: trunk timestamp: Wed 2013-07-10 06:17:38 -0400 message: Auto-commit of generated files. diff: === modified file 'autogen/Makefile.in' --- autogen/Makefile.in 2013-07-09 10:17:37 +0000 +++ autogen/Makefile.in 2013-07-10 10:17:38 +0000 @@ -59,7 +59,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=binary-io --avoid=close --avoid=dup --avoid=fchdir --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=open --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --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-ctype c-strcase careadlinkat close-stream crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl fcntl-h fdatasync fdopendir filemode fstatat fsync getloadavg getopt-gnu gettime gettimeofday intprops largefile lstat manywarnings memrchr mktime pipe2 pselect pthread_sigmask putenv qacl readlink readlinkat sig2str socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timer-time timespec-add timespec-sub unsetenv 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=close --avoid=dup --avoid=fchdir --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=open --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --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-ctype c-strcase careadlinkat close-stream crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl fcntl-h fdatasync fdopendir filemode fstatat fsync getloadavg getopt-gnu gettime gettimeofday intprops largefile lstat manywarnings memrchr mktime pipe2 pselect pthread_sigmask putenv qacl readlink readlinkat sig2str socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timer-time timespec-add timespec-sub unsetenv utimens warnings VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ @@ -291,10 +291,10 @@ LIBRARIES = $(noinst_LIBRARIES) libgnu_a_AR = $(AR) $(ARFLAGS) am__DEPENDENCIES_1 = -am__libgnu_a_SOURCES_DIST = allocator.c c-ctype.h c-ctype.c \ - c-strcase.h c-strcasecmp.c c-strncasecmp.c careadlinkat.c \ - close-stream.c md5.c sha1.c sha256.c sha512.c dtoastr.c \ - dtotimespec.c filemode.c gettext.h gettime.c pipe2.c \ +am__libgnu_a_SOURCES_DIST = allocator.c binary-io.h binary-io.c \ + c-ctype.h c-ctype.c c-strcase.h c-strcasecmp.c c-strncasecmp.c \ + careadlinkat.c close-stream.c md5.c sha1.c sha256.c sha512.c \ + dtoastr.c dtotimespec.c filemode.c gettext.h gettime.c pipe2.c \ acl-errno-valid.c file-has-acl.c qcopy-acl.c qset-acl.c \ stat-time.c strftime.c timespec.c timespec-add.c \ timespec-sub.c u64.c unistd.c utimens.c openat-die.c \ @@ -302,6 +302,7 @@ am__objects_1 = @BUILDING_FOR_WINDOWSNT_FALSE@am_libgnu_a_OBJECTS = \ @BUILDING_FOR_WINDOWSNT_FALSE@ allocator.$(OBJEXT) \ +@BUILDING_FOR_WINDOWSNT_FALSE@ binary-io.$(OBJEXT) \ @BUILDING_FOR_WINDOWSNT_FALSE@ c-ctype.$(OBJEXT) \ @BUILDING_FOR_WINDOWSNT_FALSE@ c-strcasecmp.$(OBJEXT) \ @BUILDING_FOR_WINDOWSNT_FALSE@ c-strncasecmp.$(OBJEXT) \ @@ -1235,8 +1236,9 @@ SUFFIXES = AM_CFLAGS = $(PROFILING_CFLAGS) $(GNULIB_WARN_CFLAGS) $(WERROR_CFLAGS) DEFAULT_INCLUDES = -I. -I$(top_srcdir)/lib -I../src -I$(top_srcdir)/src -@BUILDING_FOR_WINDOWSNT_FALSE@libgnu_a_SOURCES = allocator.c c-ctype.h \ -@BUILDING_FOR_WINDOWSNT_FALSE@ c-ctype.c c-strcase.h \ +@BUILDING_FOR_WINDOWSNT_FALSE@libgnu_a_SOURCES = allocator.c \ +@BUILDING_FOR_WINDOWSNT_FALSE@ binary-io.h binary-io.c \ +@BUILDING_FOR_WINDOWSNT_FALSE@ c-ctype.h c-ctype.c c-strcase.h \ @BUILDING_FOR_WINDOWSNT_FALSE@ c-strcasecmp.c c-strncasecmp.c \ @BUILDING_FOR_WINDOWSNT_FALSE@ careadlinkat.c close-stream.c \ @BUILDING_FOR_WINDOWSNT_FALSE@ md5.c sha1.c sha256.c sha512.c \ @@ -1368,6 +1370,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/acl_entries.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/allocator.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/at-func.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/binary-io.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c-ctype.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c-strcasecmp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c-strncasecmp.Po@am__quote@ === modified file 'autogen/configure' --- autogen/configure 2013-07-09 10:17:37 +0000 +++ autogen/configure 2013-07-10 10:17:38 +0000 @@ -7228,6 +7228,7 @@ # Code from module alloca-opt: # Code from module allocator: # Code from module at-internal: + # Code from module binary-io: # Code from module c-ctype: # Code from module c-strcase: # Code from module careadlinkat: @@ -10084,8 +10085,8 @@ int main () { -void test(PIMAGE_NT_HEADERS pHeader) - {PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader);} +PIMAGE_NT_HEADERS pHeader; + PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader) ; return 0; } ------------------------------------------------------------ revno: 113352 fixes bug: http://debbugs.gnu.org/14835 committer: Paul Eggert branch nick: trunk timestamp: Tue 2013-07-09 23:41:37 -0700 message: * Makefile.in (removenullpaths): Remove adjacent null paths. diff: === modified file 'ChangeLog' --- ChangeLog 2013-07-09 18:06:25 +0000 +++ ChangeLog 2013-07-10 06:41:37 +0000 @@ -1,3 +1,7 @@ +2013-07-10 Paul Eggert + + * Makefile.in (removenullpaths): Remove adjacent null paths (Bug#14835). + 2013-07-09 Peter Rosin (tiny change> * configure.ac (HAVE_W32): Avoid nested functions (the second === modified file 'Makefile.in' --- Makefile.in 2013-06-27 01:40:46 +0000 +++ Makefile.in 2013-07-10 06:41:37 +0000 @@ -293,7 +293,7 @@ .PHONY: all ${SUBDIR} blessmail epaths-force epaths-force-w32 FRC -removenullpaths=sed -e 's/^://g' -e 's/:$$//g' -e 's/::/:/g' +removenullpaths=sed -e 's/^:*//' -e 's/:*$$//g' -e 's/::*/:/g' # Generate epaths.h from epaths.in. This target is invoked by `configure'. # See comments in configure.ac for why it is done this way, as opposed