Now on revision 108989. ------------------------------------------------------------ revno: 108989 committer: Dmitry Antipov branch nick: trunk timestamp: Tue 2012-07-10 10:23:45 +0400 message: Avoid calls to strlen in path processing functions. * fileio.c (file_name_as_directory): Add comment. Change to add srclen argument and return the length of result. Adjust users accordingly. (directory_file_name): Fix comment. Change to add srclen argument, swap 1nd and 2st arguments to obey the common convention. Adjust users accordingly. * filelock.c (fill_in_lock_file_name): Avoid calls to strlen. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-10 01:49:46 +0000 +++ src/ChangeLog 2012-07-10 06:23:45 +0000 @@ -1,3 +1,14 @@ +2012-07-10 Dmitry Antipov + + Avoid calls to strlen in path processing functions. + * fileio.c (file_name_as_directory): Add comment. Change to add + srclen argument and return the length of result. Adjust users + accordingly. + (directory_file_name): Fix comment. Change to add srclen argument, + swap 1nd and 2st arguments to obey the common convention. Adjust + users accordingly. + * filelock.c (fill_in_lock_file_name): Avoid calls to strlen. + 2012-07-10 Glenn Morris * s/irix6-5.h (SETUP_SLAVE_PTY, PTY_NAME_SPRINTF): Drop ifdef guards. === modified file 'src/fileio.c' --- src/fileio.c 2012-07-07 01:57:42 +0000 +++ src/fileio.c 2012-07-10 06:23:45 +0000 @@ -453,32 +453,33 @@ return Ffile_name_directory (filename); } - -static char * -file_name_as_directory (char *out, const char *in) +/* Convert from file name SRC of length SRCLEN to directory name + in DST. On UNIX, just make sure there is a terminating /. + Return the length of DST. */ + +static ptrdiff_t +file_name_as_directory (char *dst, const char *src, ptrdiff_t srclen) { - ptrdiff_t len = strlen (in); - - if (len == 0) + if (srclen == 0) { - out[0] = '.'; - out[1] = '/'; - out[2] = 0; - return out; + dst[0] = '.'; + dst[1] = '/'; + dst[2] = '\0'; + return 2; } - strcpy (out, in); + strcpy (dst, src); - /* For Unix syntax, Append a slash if necessary */ - if (!IS_DIRECTORY_SEP (out[len - 1])) + if (!IS_DIRECTORY_SEP (dst[srclen - 1])) { - out[len] = DIRECTORY_SEP; - out[len + 1] = '\0'; + dst[srclen] = DIRECTORY_SEP; + dst[srclen + 1] = '\0'; + srclen++; } #ifdef DOS_NT - dostounix_filename (out); + dostounix_filename (dst); #endif - return out; + return srclen; } DEFUN ("file-name-as-directory", Ffile_name_as_directory, @@ -492,6 +493,7 @@ (Lisp_Object file) { char *buf; + ptrdiff_t length; Lisp_Object handler; CHECK_STRING (file); @@ -511,39 +513,34 @@ } buf = alloca (SBYTES (file) + 10); - file_name_as_directory (buf, SSDATA (file)); - return make_specified_string (buf, -1, strlen (buf), - STRING_MULTIBYTE (file)); + length = file_name_as_directory (buf, SSDATA (file), SBYTES (file)); + return make_specified_string (buf, -1, length, STRING_MULTIBYTE (file)); } -/* - * Convert from directory name to filename. - * On UNIX, it's simple: just make sure there isn't a terminating / - - * Value is nonzero if the string output is different from the input. - */ - -static int -directory_file_name (char *src, char *dst) +/* Convert from directory name SRC of length SRCLEN to + file name in DST. On UNIX, just make sure there isn't + a terminating /. Return the length of DST. */ + +static ptrdiff_t +directory_file_name (char *dst, char *src, ptrdiff_t srclen) { - ptrdiff_t slen; - - slen = strlen (src); - /* Process as Unix format: just remove any final slash. But leave "/" unchanged; do not change it to "". */ strcpy (dst, src); - if (slen > 1 - && IS_DIRECTORY_SEP (dst[slen - 1]) + if (srclen > 1 + && IS_DIRECTORY_SEP (dst[srclen - 1]) #ifdef DOS_NT - && !IS_ANY_SEP (dst[slen - 2]) + && !IS_ANY_SEP (dst[srclen - 2]) #endif ) - dst[slen - 1] = 0; + { + dst[srclen - 1] = 0; + srclen--; + } #ifdef DOS_NT dostounix_filename (dst); #endif - return 1; + return srclen; } DEFUN ("directory-file-name", Fdirectory_file_name, Sdirectory_file_name, @@ -556,6 +553,7 @@ (Lisp_Object directory) { char *buf; + ptrdiff_t length; Lisp_Object handler; CHECK_STRING (directory); @@ -576,9 +574,8 @@ } buf = alloca (SBYTES (directory) + 20); - directory_file_name (SSDATA (directory), buf); - return make_specified_string (buf, -1, strlen (buf), - STRING_MULTIBYTE (directory)); + length = directory_file_name (buf, SSDATA (directory), SBYTES (directory)); + return make_specified_string (buf, -1, length, STRING_MULTIBYTE (directory)); } static const char make_temp_name_tbl[64] = @@ -1130,8 +1127,9 @@ } if (!IS_DIRECTORY_SEP (nm[0])) { - char * tmp = alloca (strlen (newdir) + strlen (nm) + 2); - file_name_as_directory (tmp, newdir); + ptrdiff_t newlen = strlen (newdir); + char *tmp = alloca (newlen + strlen (nm) + 2); + file_name_as_directory (tmp, newdir, newlen); strcat (tmp, nm); nm = tmp; } @@ -1180,6 +1178,7 @@ /* Get rid of any slash at the end of newdir, unless newdir is just / or // (an incomplete UNC name). */ length = strlen (newdir); + tlen = length + 1; if (length > 1 && IS_DIRECTORY_SEP (newdir[length - 1]) #ifdef WINDOWSNT && !(length == 2 && IS_DIRECTORY_SEP (newdir[0])) @@ -1189,12 +1188,15 @@ char *temp = alloca (length); memcpy (temp, newdir, length - 1); temp[length - 1] = 0; + length--; newdir = temp; } - tlen = length + 1; } else - tlen = 0; + { + length = 0; + tlen = 0; + } /* Now concatenate the directory and name to new space in the stack frame. */ tlen += strlen (nm) + 1; @@ -1225,7 +1227,7 @@ strcpy (target, newdir); } else - file_name_as_directory (target, newdir); + file_name_as_directory (target, newdir, length); } strcat (target, nm); === modified file 'src/filelock.c' --- src/filelock.c 2012-07-09 12:02:27 +0000 +++ src/filelock.c 2012-07-10 06:23:45 +0000 @@ -300,6 +300,7 @@ static void fill_in_lock_file_name (register char *lockfile, register Lisp_Object fn) { + ptrdiff_t length = SBYTES (fn); register char *p; struct stat st; int count = 0; @@ -309,14 +310,14 @@ /* Shift the nondirectory part of the file name (including the null) right two characters. Here is one of the places where we'd have to do something to support 14-character-max file names. */ - for (p = lockfile + strlen (lockfile); p != lockfile && *p != '/'; p--) + for (p = lockfile + length; p != lockfile && *p != '/'; p--) p[2] = *p; /* Insert the `.#'. */ p[1] = '.'; p[2] = '#'; - p = p + strlen (p); + p = p + length + 2; while (lstat (lockfile, &st) == 0 && !S_ISLNK (st.st_mode)) { ------------------------------------------------------------ revno: 108988 committer: Glenn Morris branch nick: trunk timestamp: Mon 2012-07-09 21:49:46 -0400 message: * src/s/irix6-5.h (SETUP_SLAVE_PTY, PTY_NAME_SPRINTF): Drop ifdef guards. We include usg5-4-common.h, which defines them both. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-10 01:33:53 +0000 +++ src/ChangeLog 2012-07-10 01:49:46 +0000 @@ -1,5 +1,8 @@ 2012-07-10 Glenn Morris + * s/irix6-5.h (SETUP_SLAVE_PTY, PTY_NAME_SPRINTF): Drop ifdef guards. + We include usg5-4-common.h, which defines them both. + * s/gnu.h: Don't include fcntl.h (every file in Emacs that uses O_RDONLY already includes it). === modified file 'src/s/irix6-5.h' --- src/s/irix6-5.h 2012-07-07 18:16:15 +0000 +++ src/s/irix6-5.h 2012-07-10 01:49:46 +0000 @@ -26,9 +26,7 @@ #define SETPGRP_RELEASES_CTTY -#ifdef SETUP_SLAVE_PTY #undef SETUP_SLAVE_PTY -#endif /* thomas@mathematik.uni-bremen.de says this is needed. */ /* Make process_send_signal work by "typing" a signal character on the pty. */ @@ -42,9 +40,7 @@ /* No need to use sprintf to get the tty name--we get that from _getpty. */ #define PTY_TTY_NAME_SPRINTF /* No need to get the pty name at all. */ -#ifdef PTY_NAME_SPRINTF #undef PTY_NAME_SPRINTF -#endif #define PTY_NAME_SPRINTF #ifdef emacs char *_getpty(); ------------------------------------------------------------ revno: 108987 committer: Glenn Morris branch nick: trunk timestamp: Mon 2012-07-09 21:33:53 -0400 message: * src/s/gnu.h: Don't include fcntl.h (every file in Emacs that uses O_RDONLY already includes it; and this does not seem like the problem a src/s file should be trying to solve). diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-10 01:04:28 +0000 +++ src/ChangeLog 2012-07-10 01:33:53 +0000 @@ -1,5 +1,8 @@ 2012-07-10 Glenn Morris + * s/gnu.h: Don't include fcntl.h (every file in Emacs that uses + O_RDONLY already includes it). + Stop ns builds setting the EMACSLOADPATH environment variable. * nsterm.m (ns_load_path): Rename from ns_init_paths. Now it does not set EMACSLOADPATH, just returns the load-path string. === modified file 'src/s/gnu.h' --- src/s/gnu.h 2012-07-09 23:23:59 +0000 +++ src/s/gnu.h 2012-07-10 01:33:53 +0000 @@ -24,10 +24,7 @@ /* libc defines data_start. */ #define DATA_START ({ extern int data_start; (char *) &data_start; }) -/* Some losing code fails to include this and then assumes - that because it is braindead that O_RDONLY==0. */ -#include - +/* It would be harmless to drop the ifdef emacs test. */ #ifdef emacs #include /* Get the definition of _IO_STDIO_H. */ #if defined (_IO_STDIO_H) || defined (_STDIO_USES_IOSTREAM) ------------------------------------------------------------ revno: 108986 committer: Glenn Morris branch nick: trunk timestamp: Mon 2012-07-09 21:25:07 -0400 message: * src/nsterm.m (ns_exec_path): Fix typo in previous diff: === modified file 'src/nsterm.m' --- src/nsterm.m 2012-07-10 01:04:28 +0000 +++ src/nsterm.m 2012-07-10 01:25:07 +0000 @@ -335,10 +335,9 @@ range = [resourceDir rangeOfString: @"Contents"]; if (range.location != NSNotFound) { + binDir = [binDir stringByAppendingPathComponent: @"Contents"]; #ifdef NS_IMPL_COCOA binDir = [binDir stringByAppendingPathComponent: @"MacOS"]; -#else - binDir = [binDir stringByAppendingPathComponent: @"Contents"]; #endif } ------------------------------------------------------------ revno: 108985 committer: Glenn Morris branch nick: trunk timestamp: Mon 2012-07-09 21:11:08 -0400 message: authors.el update for configure.ac renaming * lisp/emacs-lisp/authors.el (authors-fixed-entries): (authors-renamed-files-alist): Update for configure.in -> configure.ac. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-07-09 04:52:49 +0000 +++ lisp/ChangeLog 2012-07-10 01:11:08 +0000 @@ -1,3 +1,8 @@ +2012-07-10 Glenn Morris + + * emacs-lisp/authors.el (authors-fixed-entries): + (authors-renamed-files-alist): Update for configure.in -> configure.ac. + 2012-07-09 Paul Eggert Rename configure.in to configure.ac (Bug#11603). === modified file 'lisp/emacs-lisp/authors.el' --- lisp/emacs-lisp/authors.el 2012-07-09 04:52:49 +0000 +++ lisp/emacs-lisp/authors.el 2012-07-10 01:11:08 +0000 @@ -427,7 +427,7 @@ ;; No longer distributed. ;;; ("Ishikawa Chiaki" :changed "aviion.h" "dgux.h") ;; ymakefile no longer distributed. - ("Michael K. Johnson" :changed "configure.in" "emacs.c" "intel386.h" + ("Michael K. Johnson" :changed "configure.ac" "emacs.c" "intel386.h" "mem-limits.h" "process.c" "template.h" "sysdep.c" "syssignal.h" "systty.h" "unexcoff.c" "linux.h") ;; No longer distributed. @@ -580,6 +580,7 @@ ("s/windowsnt.h" . "s/ms-w32.h") ("winnt.el" . "w32-fns.el") ("config.emacs" . "configure") + ("configure.in" . "configure.ac") ("config.h.dist" . "config.in") ("config.h-dist" . "config.in") ("config.h.in" . "config.in") ------------------------------------------------------------ revno: 108984 committer: Glenn Morris branch nick: trunk timestamp: Mon 2012-07-09 21:04:28 -0400 message: Stop ns builds setting the EMACSLOADPATH environment variable Ref bugs 4309, 6401, etc. This is the last environment variable (ab)used by the ns port in this way. * src/nsterm.m (ns_load_path): Rename from ns_init_paths. Now it does not set EMACSLOADPATH, just returns the load-path string. * src/nsterm.h: Update accordingly. * src/lread.c [HAVE_NS]: Include nsterm.h. (init_lread) [HAVE_NS]: Use ns_load_path. * src/emacs.c (main) [HAVE_NS]: No longer call ns_init_paths. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-09 23:23:59 +0000 +++ src/ChangeLog 2012-07-10 01:04:28 +0000 @@ -1,3 +1,13 @@ +2012-07-10 Glenn Morris + + Stop ns builds setting the EMACSLOADPATH environment variable. + * nsterm.m (ns_load_path): Rename from ns_init_paths. + Now it does not set EMACSLOADPATH, just returns the load-path string. + * nsterm.h: Update accordingly. + * lread.c [HAVE_NS]: Include nsterm.h. + (init_lread) [HAVE_NS]: Use ns_load_path. + * emacs.c (main) [HAVE_NS]: No longer call ns_init_paths. + 2012-07-09 Glenn Morris * s/gnu.h (SIGNALS_VIA_CHARACTERS): No need to define it here, === modified file 'src/emacs.c' --- src/emacs.c 2012-07-09 16:38:45 +0000 +++ src/emacs.c 2012-07-10 01:04:28 +0000 @@ -1426,13 +1426,6 @@ init_ntproc (); /* must precede init_editfns. */ #endif -#ifdef HAVE_NS -#ifndef CANNOT_DUMP - if (initialized) -#endif - ns_init_paths (); -#endif - /* Initialize and GC-protect Vinitial_environment and Vprocess_environment before set_initial_environment fills them in. */ === modified file 'src/lread.c' --- src/lread.c 2012-07-07 19:33:28 +0000 +++ src/lread.c 2012-07-10 01:04:28 +0000 @@ -45,6 +45,10 @@ #include "msdos.h" #endif +#ifdef HAVE_NS +#include "nsterm.h" +#endif + #include #include @@ -4125,8 +4129,16 @@ const char *normal; #ifdef CANNOT_DUMP +#ifdef HAVE_NS + const char *loadpath = ns_load_path (); +#endif + normal = PATH_LOADSEARCH; +#ifdef HAVE_NS + Vload_path = decode_env_path ("EMACSLOADPATH", loadpath ? loadpath : normal); +#else Vload_path = decode_env_path ("EMACSLOADPATH", normal); +#endif load_path_check (); @@ -4135,7 +4147,12 @@ difference between initialized and !initialized in this case, so we'll have to do it unconditionally when Vinstallation_directory is non-nil. */ +#ifdef HAVE_NS + /* loadpath already includes the app-bundle's site-lisp. */ + if (!no_site_lisp && !egetenv ("EMACSLOADPATH") && !loadpath) +#else if (!no_site_lisp && !egetenv ("EMACSLOADPATH")) +#endif { Lisp_Object sitelisp; sitelisp = decode_env_path (0, PATH_SITELOADSEARCH); @@ -4171,7 +4188,12 @@ } else { +#ifdef HAVE_NS + const char *loadpath = ns_load_path (); + Vload_path = decode_env_path (0, loadpath ? loadpath : normal); +#else Vload_path = decode_env_path (0, normal); +#endif if (!NILP (Vinstallation_directory)) { Lisp_Object tem, tem1; @@ -4274,7 +4296,12 @@ load_path_check (); /* Add the site-lisp directories at the front. */ +#ifdef HAVE_NS + /* loadpath already includes the app-bundle's site-lisp. */ + if (!no_site_lisp && !loadpath) +#else if (!no_site_lisp) +#endif { Lisp_Object sitelisp; sitelisp = decode_env_path (0, PATH_SITELOADSEARCH); === modified file 'src/nsterm.h' --- src/nsterm.h 2012-07-09 21:28:39 +0000 +++ src/nsterm.h 2012-07-10 01:04:28 +0000 @@ -800,7 +800,7 @@ extern const char *ns_etc_directory (void); extern const char *ns_exec_path (void); -extern void ns_init_paths (void); +extern const char *ns_load_path (void); extern void syms_of_nsterm (void); extern void syms_of_nsfns (void); extern void syms_of_nsmenu (void); === modified file 'src/nsterm.m' --- src/nsterm.m 2012-07-09 21:28:39 +0000 +++ src/nsterm.m 2012-07-10 01:04:28 +0000 @@ -365,12 +365,11 @@ } -void -ns_init_paths (void) -/* -------------------------------------------------------------------------- - Used to allow emacs to find its resources under Emacs.app - Called from emacs.c at startup. - -------------------------------------------------------------------------- */ +const char * +ns_load_path (void) +/* If running as a self-contained app bundle, return as a path string + the filenames of the site-lisp, lisp and leim directories. + Ie, site-lisp:lisp:leim. Otherwise, return nil. */ { NSBundle *bundle = [NSBundle mainBundle]; NSString *resourceDir = [bundle resourcePath]; @@ -379,34 +378,30 @@ NSString *pathSeparator = onWindows ? @";" : @":"; NSFileManager *fileManager = [NSFileManager defaultManager]; BOOL isDir; -/*NSLog (@"ns_init_paths: '%@'\n%@\n", [[NSBundle mainBundle] bundlePath], [[NSBundle mainBundle] resourcePath]); */ - - /* the following based on Andrew Choi's init_mac_osx_environment () */ - if (!getenv ("EMACSLOADPATH")) - { - NSArray *paths = [resourceDir stringsByAppendingPaths: - [NSArray arrayWithObjects: + NSArray *paths = [resourceDir stringsByAppendingPaths: + [NSArray arrayWithObjects: @"site-lisp", @"lisp", @"leim", nil]]; - NSEnumerator *pathEnum = [paths objectEnumerator]; - resourcePaths = @""; - /* Hack to skip site-lisp. */ - if (no_site_lisp) resourcePath = [pathEnum nextObject]; - while (resourcePath = [pathEnum nextObject]) - { - if ([fileManager fileExistsAtPath: resourcePath isDirectory: &isDir]) - if (isDir) - { - if ([resourcePaths length] > 0) - resourcePaths - = [resourcePaths stringByAppendingString: pathSeparator]; - resourcePaths - = [resourcePaths stringByAppendingString: resourcePath]; - } - } - if ([resourcePaths length] > 0) - setenv ("EMACSLOADPATH", [resourcePaths UTF8String], 1); -/*NSLog (@"loadPath: '%@'\n", resourcePaths); */ + NSEnumerator *pathEnum = [paths objectEnumerator]; + resourcePaths = @""; + + /* Hack to skip site-lisp. */ + if (no_site_lisp) resourcePath = [pathEnum nextObject]; + + while (resourcePath = [pathEnum nextObject]) + { + if ([fileManager fileExistsAtPath: resourcePath isDirectory: &isDir]) + if (isDir) + { + if ([resourcePaths length] > 0) + resourcePaths + = [resourcePaths stringByAppendingString: pathSeparator]; + resourcePaths + = [resourcePaths stringByAppendingString: resourcePath]; + } } + if ([resourcePaths length] > 0) return [resourcePaths UTF8String]; + + return NULL; } static void ------------------------------------------------------------ revno: 108983 committer: Glenn Morris branch nick: trunk timestamp: Mon 2012-07-09 20:57:55 -0400 message: Tiny NEWS edit diff: === modified file 'etc/NEWS' --- etc/NEWS 2012-07-02 08:00:05 +0000 +++ etc/NEWS 2012-07-10 00:57:55 +0000 @@ -61,6 +61,9 @@ lisp/ directory. There should not be any there anyway. If you have been adding them there, put them somewhere else, eg site-lisp. +--- +** The `--no-site-lisp' command line option now works for Nextstep builds. + * Changes in Emacs 24.2 ------------------------------------------------------------ revno: 108982 committer: Glenn Morris branch nick: trunk timestamp: Mon 2012-07-09 19:23:59 -0400 message: * src/s/gnu.h (SIGNALS_VIA_CHARACTERS): No need to define it here (the included bsd-common.h does so) diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-09 21:28:39 +0000 +++ src/ChangeLog 2012-07-09 23:23:59 +0000 @@ -1,5 +1,8 @@ 2012-07-09 Glenn Morris + * s/gnu.h (SIGNALS_VIA_CHARACTERS): No need to define it here, + since the included bsd-common.h does so. + Stop ns builds setting the EMACSPATH environment variable. * nsterm.m (ns_exec_path): New function, split from ns_init_paths. (ns_init_paths): Do not set EMACSPATH. === modified file 'src/s/gnu.h' --- src/s/gnu.h 2012-06-13 02:32:49 +0000 +++ src/s/gnu.h 2012-07-09 23:23:59 +0000 @@ -21,8 +21,6 @@ /* Get most of the stuff from bsd-common */ #include "bsd-common.h" -#define SIGNALS_VIA_CHARACTERS - /* libc defines data_start. */ #define DATA_START ({ extern int data_start; (char *) &data_start; }) ------------------------------------------------------------ revno: 108981 committer: Andreas Schwab branch nick: emacs timestamp: Tue 2012-07-10 00:30:01 +0200 message: * ede/project-am.el: Fix typo. diff: === modified file 'lisp/cedet/ChangeLog' --- lisp/cedet/ChangeLog 2012-07-09 04:52:49 +0000 +++ lisp/cedet/ChangeLog 2012-07-09 22:30:01 +0000 @@ -1,3 +1,7 @@ +2012-07-09 Andreas Schwab + + * ede/project-am.el: Fix typo. + 2012-07-09 Paul Eggert Rename configure.in to configure.ac (Bug#11603). === modified file 'lisp/cedet/ede/project-am.el' --- lisp/cedet/ede/project-am.el 2012-07-09 04:52:49 +0000 +++ lisp/cedet/ede/project-am.el 2012-07-09 22:30:01 +0000 @@ -896,7 +896,7 @@ out)) -;;; Configure.am queries. +;;; Configure.ac queries. ;; (defvar project-am-autoconf-file-options '("configure.ac" "configure.in") ------------------------------------------------------------ revno: 108980 author: Gnus developers committer: Katsumi Yamaoka branch nick: trunk timestamp: Mon 2012-07-09 22:12:19 +0000 message: gnus-sum.el: Merge changes made in Gnus master 2012-07-09 Tassilo Horn * gnus-sum.el (gnus-summary-limit-to-author): Use default value instead of initial input when reading the author to restrict the summary to. 2012-04-12 Lars Magne Ingebrigtsen * gnus-sum.el (gnus-select-newsgroup): Don't assume that the group buffer exists, which it doesn't if we haven't started Gnus. diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2012-07-09 02:13:07 +0000 +++ lisp/gnus/ChangeLog 2012-07-09 22:12:19 +0000 @@ -1,3 +1,13 @@ +2012-07-09 Tassilo Horn + + * gnus-sum.el (gnus-summary-limit-to-author): Use default value instead + of initial input when reading the author to restrict the summary to. + +2012-07-09 Lars Magne Ingebrigtsen + + * gnus-sum.el (gnus-select-newsgroup): Don't assume that the group + buffer exists, which it doesn't if we haven't started Gnus. + 2012-07-09 Katsumi Yamaoka * mm-decode.el (mm-shr): === modified file 'lisp/gnus/gnus-sum.el' --- lisp/gnus/gnus-sum.el 2012-06-26 22:52:31 +0000 +++ lisp/gnus/gnus-sum.el 2012-07-09 22:12:19 +0000 @@ -5679,7 +5679,9 @@ ;; Init the dependencies hash table. (setq gnus-newsgroup-dependencies (gnus-make-hashtable (length articles))) - (gnus-set-global-variables) + (if (gnus-buffer-live-p gnus-group-buffer) + (gnus-set-global-variables) + (set-default 'gnus-newsgroup-name gnus-newsgroup-name)) ;; Retrieve the headers and read them in. (setq gnus-newsgroup-headers (gnus-fetch-headers articles)) @@ -5961,7 +5963,6 @@ (setq mark (car marks) mark-type (gnus-article-mark-to-type mark) var (intern (format "gnus-newsgroup-%s" (car (rassq mark types))))) - ;; We set the variable according to the type of the marks list, ;; and then adjust the marks to a subset of the active articles. (cond @@ -8230,14 +8231,17 @@ "Limit the summary buffer to articles that have authors that match a regexp. If NOT-MATCHING, excluding articles that have authors that match a regexp." (interactive - (list (read-string (if current-prefix-arg - "Exclude author (regexp): " - "Limit to author (regexp): ") - (let ((header (gnus-summary-article-header))) - (if (not header) - "" - (car (mail-header-parse-address - (mail-header-from header)))))) + (list (let* ((header (gnus-summary-article-header)) + (default (and header (car (mail-header-parse-address + (mail-header-from header)))))) + (read-string (concat (if current-prefix-arg + "Exclude author (regexp" + "Limit to author (regexp") + (if default + (concat ", default \"" default "\"): ") + "): ")) + nil nil + default)) current-prefix-arg)) (gnus-summary-limit-to-subject from "from" not-matching)) ------------------------------------------------------------ revno: 108979 committer: Andreas Schwab branch nick: emacs timestamp: Tue 2012-07-10 00:06:31 +0200 message: * configure.ac (PNG_DEPSTRUCT): Define this instead of PNG_DEPRECATED. diff: === modified file 'ChangeLog' --- ChangeLog 2012-07-09 16:38:45 +0000 +++ ChangeLog 2012-07-09 22:06:31 +0000 @@ -1,3 +1,8 @@ +2012-07-09 Andreas Schwab + + * configure.ac (PNG_DEPSTRUCT): Define this instead of + PNG_DEPRECATED. + 2012-07-09 Paul Eggert Add GCC-style 'const' attribute to functions that can use it. === modified file 'configure.ac' --- configure.ac 2012-07-09 16:38:45 +0000 +++ configure.ac 2012-07-09 22:06:31 +0000 @@ -2461,7 +2461,7 @@ AC_CHECK_DECL(png_longjmp, [], - [AC_DEFINE(PNG_DEPRECATED, [], + [AC_DEFINE(PNG_DEPSTRUCT, [], [Define to empty to suppress deprecation warnings when building with --enable-gcc-warnings and with libpng versions before 1.5, which lack png_longjmp.])], ------------------------------------------------------------ revno: 108978 committer: Glenn Morris branch nick: trunk timestamp: Mon 2012-07-09 17:28:39 -0400 message: Stop ns builds setting the EMACSPATH environment variable Ref bugs 4309, 6401, etc * src/nsterm.m (ns_exec_path): New function, split from ns_init_paths. (ns_init_paths): Do not set EMACSPATH. * src/nsterm.h (ns_exec_path): Add it. * src/callproc.c (init_callproc_1, init_callproc) [HAVE_NS]: Use ns_exec_path. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-09 21:14:12 +0000 +++ src/ChangeLog 2012-07-09 21:28:39 +0000 @@ -1,5 +1,12 @@ 2012-07-09 Glenn Morris + Stop ns builds setting the EMACSPATH environment variable. + * nsterm.m (ns_exec_path): New function, split from ns_init_paths. + (ns_init_paths): Do not set EMACSPATH. + * nsterm.h (ns_exec_path): Add it. + * callproc.c (init_callproc_1, init_callproc) [HAVE_NS]: + Use ns_exec_path. + * nsterm.m, nsterm.h (ns_etc_directory): Fix type, empty return. 2012-07-09 Paul Eggert === modified file 'src/callproc.c' --- src/callproc.c 2012-07-09 07:07:24 +0000 +++ src/callproc.c 2012-07-09 21:28:39 +0000 @@ -1519,6 +1519,7 @@ char *doc_dir = egetenv ("EMACSDOC"); #ifdef HAVE_NS const char *etc_dir = ns_etc_directory (); + const char *path_exec = ns_exec_path (); #endif Vdata_directory @@ -1540,8 +1541,13 @@ /* Check the EMACSPATH environment variable, defaulting to the PATH_EXEC path from epaths.h. */ - Vexec_path = decode_env_path ("EMACSPATH", PATH_EXEC); + Vexec_path = decode_env_path ("EMACSPATH", +#ifdef HAVE_NS + path_exec ? path_exec : +#endif + PATH_EXEC); Vexec_directory = Ffile_name_as_directory (Fcar (Vexec_path)); + /* FIXME? For ns, path_exec should go at the front? */ Vexec_path = nconc2 (decode_env_path ("PATH", ""), Vexec_path); } @@ -1576,7 +1582,14 @@ /* MSDOS uses wrapped binaries, so don't do this. */ if (NILP (Fmember (tem, Vexec_path))) { - Vexec_path = decode_env_path ("EMACSPATH", PATH_EXEC); +#ifdef HAVE_NS + const char *path_exec = ns_exec_path (); +#endif + Vexec_path = decode_env_path ("EMACSPATH", +#ifdef HAVE_NS + path_exec ? path_exec : +#endif + PATH_EXEC); Vexec_path = Fcons (tem, Vexec_path); Vexec_path = nconc2 (decode_env_path ("PATH", ""), Vexec_path); } === modified file 'src/nsterm.h' --- src/nsterm.h 2012-07-09 21:14:12 +0000 +++ src/nsterm.h 2012-07-09 21:28:39 +0000 @@ -799,6 +799,7 @@ extern void ns_run_ascript (void); extern const char *ns_etc_directory (void); +extern const char *ns_exec_path (void); extern void ns_init_paths (void); extern void syms_of_nsterm (void); extern void syms_of_nsfns (void); === modified file 'src/nsterm.m' --- src/nsterm.m 2012-07-09 21:14:12 +0000 +++ src/nsterm.m 2012-07-09 21:28:39 +0000 @@ -288,10 +288,9 @@ const char * ns_etc_directory (void) -{ /* If running as a self-contained app bundle, return as a string the filename of the etc directory, if present; else nil. */ - +{ NSBundle *bundle = [NSBundle mainBundle]; NSString *resourceDir = [bundle resourcePath]; NSString *resourcePath; @@ -306,6 +305,66 @@ return NULL; } + +const char * +ns_exec_path (void) +/* If running as a self-contained app bundle, return as a path string + the filenames of the libexec and bin directories, ie libexec:bin. + Otherwise, return nil. + Normally, Emacs does not add its own bin/ directory to the PATH. + However, a self-contained NS build has a different layout, with + bin/ and libexec/ subdirectories in the directory that contains + Emacs.app itself. + We put libexec first, because init_callproc_1 uses the first + element to initialize exec-directory. An alternative would be + for init_callproc to check for invocation-directory/libexec. +*/ +{ + NSBundle *bundle = [NSBundle mainBundle]; + NSString *resourceDir = [bundle resourcePath]; + NSString *binDir = [bundle bundlePath]; + NSString *resourcePath, *resourcePaths; + NSRange range; + BOOL onWindows = NO; /* FIXME determine this somehow */ + NSString *pathSeparator = onWindows ? @";" : @":"; + NSFileManager *fileManager = [NSFileManager defaultManager]; + NSArray *paths; + NSEnumerator *pathEnum; + BOOL isDir; + + range = [resourceDir rangeOfString: @"Contents"]; + if (range.location != NSNotFound) + { +#ifdef NS_IMPL_COCOA + binDir = [binDir stringByAppendingPathComponent: @"MacOS"]; +#else + binDir = [binDir stringByAppendingPathComponent: @"Contents"]; +#endif + } + + paths = [binDir stringsByAppendingPaths: + [NSArray arrayWithObjects: @"libexec", @"bin", nil]]; + pathEnum = [paths objectEnumerator]; + resourcePaths = @""; + + while (resourcePath = [pathEnum nextObject]) + { + if ([fileManager fileExistsAtPath: resourcePath isDirectory: &isDir]) + if (isDir) + { + if ([resourcePaths length] > 0) + resourcePaths + = [resourcePaths stringByAppendingString: pathSeparator]; + resourcePaths + = [resourcePaths stringByAppendingString: resourcePath]; + } + } + if ([resourcePaths length] > 0) return [resourcePaths UTF8String]; + + return NULL; +} + + void ns_init_paths (void) /* -------------------------------------------------------------------------- @@ -314,25 +373,14 @@ -------------------------------------------------------------------------- */ { NSBundle *bundle = [NSBundle mainBundle]; - NSString *binDir = [bundle bundlePath], *resourceDir = [bundle resourcePath]; + NSString *resourceDir = [bundle resourcePath]; NSString *resourcePath, *resourcePaths; - NSRange range; - BOOL onWindows = NO; /* how do I determine this? */ + BOOL onWindows = NO; /* FIXME determine this somehow */ NSString *pathSeparator = onWindows ? @";" : @":"; NSFileManager *fileManager = [NSFileManager defaultManager]; BOOL isDir; /*NSLog (@"ns_init_paths: '%@'\n%@\n", [[NSBundle mainBundle] bundlePath], [[NSBundle mainBundle] resourcePath]); */ - /* get bindir from base */ - range = [resourceDir rangeOfString: @"Contents"]; - if (range.location != NSNotFound) - { - binDir = [binDir stringByAppendingPathComponent: @"Contents"]; -#ifdef NS_IMPL_COCOA - binDir = [binDir stringByAppendingPathComponent: @"MacOS"]; -#endif - } - /* the following based on Andrew Choi's init_mac_osx_environment () */ if (!getenv ("EMACSLOADPATH")) { @@ -359,36 +407,6 @@ setenv ("EMACSLOADPATH", [resourcePaths UTF8String], 1); /*NSLog (@"loadPath: '%@'\n", resourcePaths); */ } - - /* Normally, Emacs does not add its own bin/ directory to the PATH. - However, a self-contained NS build has a different layout, with - bin/ and libexec/ subdirectories in the directory that contains - Emacs.app itself. - We put libexec first, because init_callproc_1 uses the first - element to initialize exec-directory. An alternative would be - for init_callproc to check for invocation-directory/libexec. */ - if (!getenv ("EMACSPATH")) - { - NSArray *paths = [binDir stringsByAppendingPaths: - [NSArray arrayWithObjects: @"libexec", - @"bin", nil]]; - NSEnumerator *pathEnum = [paths objectEnumerator]; - resourcePaths = @""; - while (resourcePath = [pathEnum nextObject]) - { - if ([fileManager fileExistsAtPath: resourcePath isDirectory: &isDir]) - if (isDir) - { - if ([resourcePaths length] > 0) - resourcePaths - = [resourcePaths stringByAppendingString: pathSeparator]; - resourcePaths - = [resourcePaths stringByAppendingString: resourcePath]; - } - } - if ([resourcePaths length] > 0) - setenv ("EMACSPATH", [resourcePaths UTF8String], 1); - } } static void ------------------------------------------------------------ revno: 108977 committer: Glenn Morris branch nick: trunk timestamp: Mon 2012-07-09 17:14:12 -0400 message: * src/nsterm.m, src/nsterm.h (ns_etc_directory): Fix type, empty return. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-09 21:12:08 +0000 +++ src/ChangeLog 2012-07-09 21:14:12 +0000 @@ -1,3 +1,7 @@ +2012-07-09 Glenn Morris + + * nsterm.m, nsterm.h (ns_etc_directory): Fix type, empty return. + 2012-07-09 Paul Eggert * process.c (wait_reading_process_output): 'waitchannels' was unset === modified file 'src/nsterm.h' --- src/nsterm.h 2012-07-09 07:07:24 +0000 +++ src/nsterm.h 2012-07-09 21:14:12 +0000 @@ -798,7 +798,7 @@ #define NSAPP_DATA2_RUNASSCRIPT 10 extern void ns_run_ascript (void); -extern char *ns_etc_directory (void); +extern const char *ns_etc_directory (void); extern void ns_init_paths (void); extern void syms_of_nsterm (void); extern void syms_of_nsfns (void); === modified file 'src/nsterm.m' --- src/nsterm.m 2012-07-09 07:07:24 +0000 +++ src/nsterm.m 2012-07-09 21:14:12 +0000 @@ -286,24 +286,24 @@ } -char * +const char * ns_etc_directory (void) { /* If running as a self-contained app bundle, return as a string the filename of the etc directory, if present; else nil. */ - NSBundle *bundle = [NSBundle mainBundle]; - NSString *resourceDir = [bundle resourcePath]; - NSString *resourcePath; - NSFileManager *fileManager = [NSFileManager defaultManager]; - BOOL isDir; + NSBundle *bundle = [NSBundle mainBundle]; + NSString *resourceDir = [bundle resourcePath]; + NSString *resourcePath; + NSFileManager *fileManager = [NSFileManager defaultManager]; + BOOL isDir; - resourcePath = [resourceDir stringByAppendingPathComponent: @"etc"]; - if ([fileManager fileExistsAtPath: resourcePath isDirectory: &isDir]) - { - if (isDir) return [resourcePath UTF8String]; - } - return nil; + resourcePath = [resourceDir stringByAppendingPathComponent: @"etc"]; + if ([fileManager fileExistsAtPath: resourcePath isDirectory: &isDir]) + { + if (isDir) return [resourcePath UTF8String]; + } + return NULL; } void ------------------------------------------------------------ revno: 108976 committer: Paul Eggert branch nick: trunk timestamp: Mon 2012-07-09 14:12:08 -0700 message: * process.c (wait_reading_process_output): 'waitchannels' was unset when read_kbd || !NILP (wait_for_cell); fix this. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-09 16:38:45 +0000 +++ src/ChangeLog 2012-07-09 21:12:08 +0000 @@ -1,5 +1,8 @@ 2012-07-09 Paul Eggert + * process.c (wait_reading_process_output): 'waitchannels' was unset + when read_kbd || !NILP (wait_for_cell); fix this. + Add GCC-style 'const' attribute to functions that can use it. * character.h (char_resolve_modifier_mask): * keyboard.h (make_ctrl_char): === modified file 'src/process.c' --- src/process.c 2012-07-09 12:02:27 +0000 +++ src/process.c 2012-07-09 21:12:08 +0000 @@ -4239,7 +4239,7 @@ If NSECS > 0, the timeout consists of NSECS only. If NSECS < 0, gobble data immediately, as if TIME_LIMIT were negative. - READ_KBD is a lisp value: + READ_KBD is: 0 to ignore keyboard input, or 1 to return when input is available, or -1 meaning caller will actually read the input, so don't throw to @@ -6820,7 +6820,7 @@ If NSECS > 0, the timeout consists of NSECS only. If NSECS < 0, gobble data immediately, as if TIME_LIMIT were negative. - READ_KBD is a Lisp_Object: + READ_KBD is: 0 to ignore keyboard input, or 1 to return when input is available, or -1 means caller will actually read the input, so don't throw to @@ -6842,8 +6842,6 @@ { register int nfds; EMACS_TIME end_time, timeout; - SELECT_TYPE waitchannels; - int xerrno; if (time_limit < 0) { @@ -6870,6 +6868,8 @@ while (1) { int timeout_reduced_for_timers = 0; + SELECT_TYPE waitchannels; + int xerrno; /* If calling from keyboard input, do not quit since we want to return C-g as an input character. @@ -6944,13 +6944,6 @@ if (read_kbd < 0) set_waiting_for_input (&timeout); - /* Wait till there is something to do. */ - - if (! read_kbd && NILP (wait_for_cell)) - FD_ZERO (&waitchannels); - else - FD_SET (0, &waitchannels); - /* If a frame has been newly mapped and needs updating, reprocess its display stuff. */ if (frame_garbaged && do_display) @@ -6961,13 +6954,16 @@ set_waiting_for_input (&timeout); } + /* Wait till there is something to do. */ + FD_ZERO (&waitchannels); if (read_kbd && detect_input_pending ()) + nfds = 0; + else { - nfds = 0; - FD_ZERO (&waitchannels); + if (read_kbd || !NILP (wait_for_cell)) + FD_SET (0, &waitchannels); + nfds = pselect (1, &waitchannels, NULL, NULL, &timeout, NULL); } - else - nfds = pselect (1, &waitchannels, NULL, NULL, &timeout, NULL); xerrno = errno; ------------------------------------------------------------ revno: 108975 committer: Glenn Morris branch nick: trunk timestamp: Mon 2012-07-09 15:56:14 -0400 message: Fix typo in previous diff: === modified file '.dir-locals.el' --- .dir-locals.el 2012-07-09 19:55:23 +0000 +++ .dir-locals.el 2012-07-09 19:56:14 +0000 @@ -2,7 +2,7 @@ (sentence-end-double-space . t) (fill-column . 70))) (c-mode . ((c-file-style . "GNU"))) - (obc-mode . ((c-file-style . "GNU"))) + (objc-mode . ((c-file-style . "GNU"))) ;; You must set bugtracker_debbugs_url in your bazaar.conf for this to work. ;; See admin/notes/bugtracker. (log-edit-mode . ((log-edit-rewrite-fixes ------------------------------------------------------------ revno: 108974 committer: Glenn Morris branch nick: trunk timestamp: Mon 2012-07-09 15:55:23 -0400 message: Apply GNU coding style to objc-mode as well as c-mode diff: === modified file '.dir-locals.el' --- .dir-locals.el 2012-05-08 15:19:18 +0000 +++ .dir-locals.el 2012-07-09 19:55:23 +0000 @@ -2,6 +2,7 @@ (sentence-end-double-space . t) (fill-column . 70))) (c-mode . ((c-file-style . "GNU"))) + (obc-mode . ((c-file-style . "GNU"))) ;; You must set bugtracker_debbugs_url in your bazaar.conf for this to work. ;; See admin/notes/bugtracker. (log-edit-mode . ((log-edit-rewrite-fixes ------------------------------------------------------------ revno: 108973 committer: Paul Eggert branch nick: trunk timestamp: Mon 2012-07-09 09:38:45 -0700 message: Add GCC-style 'const' attribute to functions that can use it. diff: === modified file 'ChangeLog' --- ChangeLog 2012-07-09 15:37:43 +0000 +++ ChangeLog 2012-07-09 16:38:45 +0000 @@ -1,3 +1,9 @@ +2012-07-09 Paul Eggert + + Add GCC-style 'const' attribute to functions that can use it. + * configure.ac (WARN_CFLAGS): Add -Wsuggest-attribute=const. + (ATTRIBUTE_CONST): New macro, in config.h. + 2012-07-09 Juanma Barranquero * lib/makefile.w32-in: Rework dependencies. === modified file 'configure.ac' --- configure.ac 2012-07-09 04:52:49 +0000 +++ configure.ac 2012-07-09 16:38:45 +0000 @@ -683,7 +683,6 @@ # The following lines should be removable at some point. nw="$nw -Wstack-protector" nw="$nw -Wstrict-overflow" - nw="$nw -Wsuggest-attribute=const" nw="$nw -Wsuggest-attribute=pure" gl_MANYWARN_ALL_GCC([ws]) @@ -3636,6 +3635,8 @@ ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument)) #endif +#define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST + /* Some versions of GNU/Linux define noinline in their headers. */ #ifdef noinline #undef noinline === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2012-07-09 14:01:41 +0000 +++ lib-src/ChangeLog 2012-07-09 16:38:45 +0000 @@ -1,3 +1,8 @@ +2012-07-09 Paul Eggert + + Add GCC-style 'const' attribute to functions that can use it. + * etags.c (number_len): Add ATTRIBUTE_CONST. + 2012-07-09 Juanma Barranquero * emacsclient.c (w32_execvp): Declare execvp to silence the compiler. === modified file 'lib-src/etags.c' --- lib-src/etags.c 2012-07-06 21:07:46 +0000 +++ lib-src/etags.c 2012-07-09 16:38:45 +0000 @@ -2123,7 +2123,7 @@ static int total_size_of_entries (node *); -static int number_len (long); +static int number_len (long) ATTRIBUTE_CONST; /* Length of a non-negative number's decimal representation. */ static int === modified file 'nt/ChangeLog' --- nt/ChangeLog 2012-07-09 13:40:34 +0000 +++ nt/ChangeLog 2012-07-09 16:38:45 +0000 @@ -1,3 +1,7 @@ +2012-07-09 Paul Eggert + + * config.nt (ATTRIBUTE_CONST): Add, to sync with configure.ac. + 2012-07-09 Juanma Barranquero * config.nt: Sync with autogen/config.in. === modified file 'nt/config.nt' --- nt/config.nt 2012-07-09 13:40:34 +0000 +++ nt/config.nt 2012-07-09 16:38:45 +0000 @@ -1501,6 +1501,8 @@ ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument)) #endif +#define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST + /* Some versions of GNU/Linux define noinline in their headers. */ #ifdef noinline #undef noinline === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-09 16:06:19 +0000 +++ src/ChangeLog 2012-07-09 16:38:45 +0000 @@ -1,5 +1,19 @@ 2012-07-09 Paul Eggert + Add GCC-style 'const' attribute to functions that can use it. + * character.h (char_resolve_modifier_mask): + * keyboard.h (make_ctrl_char): + * lisp.h (multibyte_char_to_unibyte, multibyte_char_to_unibyte_safe) + (init_character_once, next_almost_prime, init_fns, init_image) + (flush_pending_output, init_sound): + * mem-limits.h (start_of_data): + * menu.h (finish_menu_items): + Add ATTRIBUTE_CONST. + * emacs.c (DEFINE_DUMMY_FUNCTION): + Declare the dummy function with ATTRIBUTE_CONST. + * lisp.h (Fbyteorder, Fmax_char, Fidentity): + Add decls with ATTRIBUTE_CONST. + Minor improvements to make_formatted_string. * alloc.c (make_formatted_string): Prefer int to ptrdiff_t where int is good enough, as vsprintf returns an int. === modified file 'src/character.h' --- src/character.h 2012-05-25 18:19:24 +0000 +++ src/character.h 2012-07-09 16:38:45 +0000 @@ -665,7 +665,7 @@ UNICODE_CATEGORY_Cn } unicode_category_t; -extern EMACS_INT char_resolve_modifier_mask (EMACS_INT); +extern EMACS_INT char_resolve_modifier_mask (EMACS_INT) ATTRIBUTE_CONST; extern int char_string (unsigned, unsigned char *); extern int string_char (const unsigned char *, const unsigned char **, int *); === modified file 'src/emacs.c' --- src/emacs.c 2012-07-05 18:35:48 +0000 +++ src/emacs.c 2012-07-09 16:38:45 +0000 @@ -569,7 +569,7 @@ /* Define a dummy function F. Declare F too, to pacify gcc -Wmissing-prototypes. */ #define DEFINE_DUMMY_FUNCTION(f) \ - void f (void) EXTERNALLY_VISIBLE; void f (void) {} + void f (void) ATTRIBUTE_CONST EXTERNALLY_VISIBLE; void f (void) {} #ifndef GCC_CTORS_IN_LIBC DEFINE_DUMMY_FUNCTION (__do_global_ctors) === modified file 'src/keyboard.h' --- src/keyboard.h 2012-02-10 18:58:48 +0000 +++ src/keyboard.h 2012-07-09 16:38:45 +0000 @@ -487,7 +487,7 @@ extern void clear_input_pending (void); extern int requeued_events_pending_p (void); extern void bind_polling_period (int); -extern int make_ctrl_char (int); +extern int make_ctrl_char (int) ATTRIBUTE_CONST; extern void stuff_buffered_input (Lisp_Object); extern void clear_waiting_for_input (void); extern void swallow_events (int); === modified file 'src/lisp.h' --- src/lisp.h 2012-07-09 16:06:19 +0000 +++ src/lisp.h 2012-07-09 16:38:45 +0000 @@ -2336,6 +2336,8 @@ extern Lisp_Object Qfont_spec, Qfont_entity, Qfont_object; +EXFUN (Fbyteorder, 0) ATTRIBUTE_CONST; + /* Defined in frame.c */ extern Lisp_Object Qframep; @@ -2395,11 +2397,12 @@ extern void syms_of_coding (void); /* Defined in character.c */ +EXFUN (Fmax_char, 0) ATTRIBUTE_CONST; extern ptrdiff_t chars_in_text (const unsigned char *, ptrdiff_t); extern ptrdiff_t multibyte_chars_in_text (const unsigned char *, ptrdiff_t); -extern int multibyte_char_to_unibyte (int); -extern int multibyte_char_to_unibyte_safe (int); -extern void init_character_once (void); +extern int multibyte_char_to_unibyte (int) ATTRIBUTE_CONST; +extern int multibyte_char_to_unibyte_safe (int) ATTRIBUTE_CONST; +extern void init_character_once (void) ATTRIBUTE_CONST; extern void syms_of_character (void); /* Defined in charset.c */ @@ -2419,7 +2422,8 @@ /* Defined in fns.c */ extern Lisp_Object QCrehash_size, QCrehash_threshold; enum { NEXT_ALMOST_PRIME_LIMIT = 11 }; -extern EMACS_INT next_almost_prime (EMACS_INT); +EXFUN (Fidentity, 1) ATTRIBUTE_CONST; +extern EMACS_INT next_almost_prime (EMACS_INT) ATTRIBUTE_CONST; extern Lisp_Object larger_vector (Lisp_Object, ptrdiff_t, ptrdiff_t); extern void sweep_weak_hash_tables (void); extern Lisp_Object Qcursor_in_echo_area; @@ -2434,7 +2438,7 @@ ptrdiff_t hash_put (struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object, EMACS_UINT); void init_weak_hash_tables (void); -extern void init_fns (void); +extern void init_fns (void) ATTRIBUTE_CONST; extern Lisp_Object substring_both (Lisp_Object, ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t); @@ -2470,7 +2474,7 @@ extern Lisp_Object QCconversion; extern int x_bitmap_mask (struct frame *, ptrdiff_t); extern void syms_of_image (void); -extern void init_image (void); +extern void init_image (void) ATTRIBUTE_CONST; /* Defined in insdel.c */ extern Lisp_Object Qinhibit_modification_hooks; @@ -3119,7 +3123,7 @@ extern void reset_all_sys_modes (void); extern void wait_for_termination (pid_t); extern void interruptible_wait_for_termination (pid_t); -extern void flush_pending_output (int); +extern void flush_pending_output (int) ATTRIBUTE_CONST; extern void child_setup_tty (int); extern void setup_pty (int); extern int set_window_size (int, int, int); @@ -3141,7 +3145,7 @@ /* Defined in sound.c */ extern void syms_of_sound (void); -extern void init_sound (void); +extern void init_sound (void) ATTRIBUTE_CONST; /* Defined in category.c */ extern void init_category_once (void); === modified file 'src/mem-limits.h' --- src/mem-limits.h 2012-06-13 00:26:40 +0000 +++ src/mem-limits.h 2012-07-09 16:38:45 +0000 @@ -33,7 +33,7 @@ # endif #endif -extern char *start_of_data (void); +extern char *start_of_data (void) ATTRIBUTE_CONST; #if USE_LSB_TAG || UINTPTR_MAX <= VAL_MAX #define EXCEEDS_LISP_PTR(ptr) 0 #elif defined DATA_SEG_BITS === modified file 'src/menu.h' --- src/menu.h 2012-01-19 07:21:25 +0000 +++ src/menu.h 2012-07-09 16:38:45 +0000 @@ -26,7 +26,7 @@ Lisp_Object oldval); extern void init_menu_items (void); -extern void finish_menu_items (void); +extern void finish_menu_items (void) ATTRIBUTE_CONST; extern void discard_menu_items (void); extern void save_menu_items (void); extern int parse_single_submenu (Lisp_Object, Lisp_Object, Lisp_Object); ------------------------------------------------------------ revno: 108972 committer: Paul Eggert branch nick: trunk timestamp: Mon 2012-07-09 09:06:19 -0700 message: Minor improvements to make_formatted_string. * alloc.c (make_formatted_string): Prefer int to ptrdiff_t where int is good enough, as vsprintf returns an int. * lisp.h (make_formatted_string): Add ATTRIBUTE_FORMAT_PRINTF. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-09 12:02:27 +0000 +++ src/ChangeLog 2012-07-09 16:06:19 +0000 @@ -1,3 +1,10 @@ +2012-07-09 Paul Eggert + + Minor improvements to make_formatted_string. + * alloc.c (make_formatted_string): Prefer int to ptrdiff_t + where int is good enough, as vsprintf returns an int. + * lisp.h (make_formatted_string): Add ATTRIBUTE_FORMAT_PRINTF. + 2012-07-09 Dmitry Antipov Use make_formatted_string to avoid double length calculation. === modified file 'src/alloc.c' --- src/alloc.c 2012-07-09 12:02:27 +0000 +++ src/alloc.c 2012-07-09 16:06:19 +0000 @@ -2524,7 +2524,7 @@ make_formatted_string (char *buf, const char *format, ...) { va_list ap; - ptrdiff_t length; + int length; va_start (ap, format); length = vsprintf (buf, format, ap); === modified file 'src/lisp.h' --- src/lisp.h 2012-07-09 12:02:27 +0000 +++ src/lisp.h 2012-07-09 16:06:19 +0000 @@ -2611,7 +2611,8 @@ extern Lisp_Object allocate_misc (void); extern _Noreturn void string_overflow (void); extern Lisp_Object make_string (const char *, ptrdiff_t); -extern Lisp_Object make_formatted_string (char *, const char *, ...); +extern Lisp_Object make_formatted_string (char *, const char *, ...) + ATTRIBUTE_FORMAT_PRINTF (2, 3); extern Lisp_Object make_unibyte_string (const char *, ptrdiff_t); extern Lisp_Object make_multibyte_string (const char *, ptrdiff_t, ptrdiff_t); extern Lisp_Object make_event_array (int, Lisp_Object *); ------------------------------------------------------------ revno: 108971 committer: Juanma Barranquero branch nick: trunk timestamp: Mon 2012-07-09 17:37:43 +0200 message: lib/makefile.w32-in: Rework dependencies. (GNU_LIB, NT_INC, C_CTYPE_H, MS_W32_H, CONFIG_H, FILEMODE_H) (FTOASTR_H, FTOASTR_C, GETOPT_INT_H, MD5_H, SHA1_H, SHA256_H) (U64_H, SHA512_H): New macros. (SRC): Redefine to point to src/, not current directory. ($(BLD)/c-ctype.$(O), $(BLD)/c-strcasecmp.$(O)) ($(BLD)/c-strncasecmp.$(O), $(BLD)/dtoastr.$(O)) ($(BLD)/dtotimespec.$(O), $(BLD)/getopt.$(O), $(BLD)/getopt1.$(O)) ($(BLD)/gettime.$(O), $(BLD)/strftime.$(O), $(BLD)/time_r.$(O)) ($(BLD)/timespec-add.$(O), $(BLD)/timespec-sub.$(O), $(BLD)/md5.$(O)) ($(BLD)/sha1.$(O), $(BLD)/sha256.$(O), $(BLD)/sha512.$(O)) ($(BLD)/filemode.$(O)): Update dependencies. diff: === modified file 'ChangeLog' --- ChangeLog 2012-07-09 08:34:39 +0000 +++ ChangeLog 2012-07-09 15:37:43 +0000 @@ -1,3 +1,18 @@ +2012-07-09 Juanma Barranquero + + * lib/makefile.w32-in: Rework dependencies. + (GNU_LIB, NT_INC, C_CTYPE_H, MS_W32_H, CONFIG_H, FILEMODE_H) + (FTOASTR_H, FTOASTR_C, GETOPT_INT_H, MD5_H, SHA1_H, SHA256_H) + (U64_H, SHA512_H): New macros. + (SRC): Redefine to point to src/, not current directory. + ($(BLD)/c-ctype.$(O), $(BLD)/c-strcasecmp.$(O)) + ($(BLD)/c-strncasecmp.$(O), $(BLD)/dtoastr.$(O)) + ($(BLD)/dtotimespec.$(O), $(BLD)/getopt.$(O), $(BLD)/getopt1.$(O)) + ($(BLD)/gettime.$(O), $(BLD)/strftime.$(O), $(BLD)/time_r.$(O)) + ($(BLD)/timespec-add.$(O), $(BLD)/timespec-sub.$(O), $(BLD)/md5.$(O)) + ($(BLD)/sha1.$(O), $(BLD)/sha256.$(O), $(BLD)/sha512.$(O)) + ($(BLD)/filemode.$(O)): Update dependencies. + 2012-07-09 Paul Eggert Merge from gnulib, incorporating: === modified file 'lib/makefile.w32-in' --- lib/makefile.w32-in 2012-07-07 00:20:56 +0000 +++ lib/makefile.w32-in 2012-07-09 15:37:43 +0000 @@ -65,143 +65,139 @@ ### DEPENDENCIES ### EMACS_ROOT = .. -SRC = . +GNU_LIB = . +SRC = $(EMACS_ROOT)/src +NT_INC = $(EMACS_ROOT)/nt/inc + +C_CTYPE_H = $(GNU_LIB)/c-ctype.h \ + $(NT_INC)/stdbool.h +MS_W32_H = $(SRC)/s/ms-w32.h \ + $(NT_INC)/sys/stat.h +CONFIG_H = $(SRC)/config.h \ + $(MS_W32_H) +FILEMODE_H = $(GNU_LIB)/filemode.h \ + $(NT_INC)/sys/stat.h +FTOASTR_H = $(GNU_LIB)/ftoastr.h \ + $(GNU_LIB)/intprops.h +FTOASTR_C = $(GNU_LIB)/ftoastr.c \ + $(CONFIG_H) \ + $(FTOASTR_H) \ + $(GNU_LIB)/ftoastr.h +GETOPT_INT_H = $(GNU_LIB)/getopt_int.h \ + $(GNU_LIB)/getopt.h +MD5_H = $(GNU_LIB)/md5.h \ + $(NT_INC)/stdint.h +SHA1_H = $(GNU_LIB)/sha1.h \ + $(NT_INC)/stdint.h +SHA256_H = $(GNU_LIB)/sha256.h \ + $(NT_INC)/stdint.h +U64_H = $(GNU_LIB)/u64.h \ + $(NT_INC)/stdint.h +SHA512_H = $(GNU_LIB)/sha512.h \ + $(U64_H) \ + $(GNU_LIB)/u64.h $(BLD)/c-ctype.$(O) : \ - $(SRC)/c-ctype.c \ - $(SRC)/c-ctype.h \ - $(EMACS_ROOT)/src/s/ms-w32.h \ - $(EMACS_ROOT)/src/config.h + $(GNU_LIB)/c-ctype.c \ + $(CONFIG_H) \ + $(C_CTYPE_H) $(BLD)/c-strcasecmp.$(O) : \ - $(SRC)/c-strcasecmp.c \ - $(SRC)/c-strcase.h \ - $(SRC)/c-ctype.h \ - $(EMACS_ROOT)/src/s/ms-w32.h \ - $(EMACS_ROOT)/src/config.h + $(GNU_LIB)/c-strcasecmp.c \ + $(GNU_LIB)/c-strcase.h \ + $(CONFIG_H) \ + $(C_CTYPE_H) $(BLD)/c-strncasecmp.$(O) : \ - $(SRC)/c-strncasecmp.c \ - $(SRC)/c-strcase.h \ - $(SRC)/c-ctype.h \ - $(EMACS_ROOT)/src/s/ms-w32.h \ - $(EMACS_ROOT)/src/config.h + $(GNU_LIB)/c-strncasecmp.c \ + $(GNU_LIB)/c-strcase.h \ + $(CONFIG_H) \ + $(C_CTYPE_H) $(BLD)/dtoastr.$(O) : \ - $(SRC)/dtoastr.c \ - $(SRC)/ftoastr.c \ - $(SRC)/ftoastr.h \ - $(SRC)/intprops.h \ - $(EMACS_ROOT)/nt/inc/sys/stat.h \ - $(EMACS_ROOT)/src/s/ms-w32.h \ - $(EMACS_ROOT)/src/config.h + $(GNU_LIB)/dtoastr.c \ + $(FTOASTR_C) $(BLD)/dtotimespec.$(O) : \ - $(SRC)/dtotimespec.c \ - $(SRC)/intprops.h \ - $(SRC)/timespec.h \ - $(EMACS_ROOT)/nt/inc/sys/stat.h \ - $(EMACS_ROOT)/src/s/ms-w32.h \ - $(EMACS_ROOT)/src/config.h + $(GNU_LIB)/dtotimespec.c \ + $(GNU_LIB)/intprops.h \ + $(GNU_LIB)/timespec.h \ + $(CONFIG_H) $(BLD)/getopt.$(O) : \ - $(SRC)/getopt.c \ - $(SRC)/getopt.h \ - $(SRC)/getopt_int.h \ - $(SRC)/gettext.h \ - $(EMACS_ROOT)/nt/inc/unistd.h \ - $(EMACS_ROOT)/nt/inc/sys/stat.h \ - $(EMACS_ROOT)/src/s/ms-w32.h \ - $(EMACS_ROOT)/src/config.h + $(GNU_LIB)/getopt.c \ + $(GNU_LIB)/getopt.h \ + $(GNU_LIB)/gettext.h \ + $(NT_INC)/unistd.h \ + $(CONFIG_H) \ + $(GETOPT_INT_H) $(BLD)/getopt1.$(O) : \ - $(SRC)/getopt1.c \ - $(SRC)/getopt.h \ - $(SRC)/getopt_int.h \ - $(EMACS_ROOT)/nt/inc/sys/stat.h \ - $(EMACS_ROOT)/src/s/ms-w32.h \ - $(EMACS_ROOT)/src/config.h + $(GNU_LIB)/getopt1.c \ + $(GNU_LIB)/getopt.h \ + $(CONFIG_H) \ + $(GETOPT_INT_H) $(BLD)/gettime.$(O) : \ - $(SRC)/gettime.c \ - $(SRC)/timespec.h \ - $(EMACS_ROOT)/nt/inc/sys/time.h \ - $(EMACS_ROOT)/nt/inc/sys/stat.h \ - $(EMACS_ROOT)/src/s/ms-w32.h \ - $(EMACS_ROOT)/src/config.h + $(GNU_LIB)/gettime.c \ + $(GNU_LIB)/timespec.h \ + $(NT_INC)/sys/time.h \ + $(CONFIG_H) $(BLD)/strftime.$(O) : \ - $(SRC)/strftime.c \ - $(SRC)/strftime.h \ - $(EMACS_ROOT)/nt/inc/stdbool.h \ - $(EMACS_ROOT)/nt/inc/sys/stat.h \ - $(EMACS_ROOT)/src/s/ms-w32.h \ - $(EMACS_ROOT)/src/config.h + $(GNU_LIB)/strftime.c \ + $(GNU_LIB)/strftime.h \ + $(NT_INC)/stdbool.h \ + $(CONFIG_H) $(BLD)/time_r.$(O) : \ - $(SRC)/time_r.c \ - $(EMACS_ROOT)/nt/inc/sys/stat.h \ - $(EMACS_ROOT)/src/s/ms-w32.h \ - $(EMACS_ROOT)/src/config.h + $(GNU_LIB)/time_r.c \ + $(CONFIG_H) $(BLD)/timespec-add.$(O) : \ - $(SRC)/timespec-add.c \ - $(SRC)/intprops.h \ - $(SRC)/timespec.h \ - $(EMACS_ROOT)/nt/inc/sys/stat.h \ - $(EMACS_ROOT)/src/s/ms-w32.h \ - $(EMACS_ROOT)/src/config.h + $(GNU_LIB)/timespec-add.c \ + $(GNU_LIB)/intprops.h \ + $(GNU_LIB)/timespec.h \ + $(CONFIG_H) $(BLD)/timespec-sub.$(O) : \ - $(SRC)/timespec-sub.c \ - $(SRC)/intprops.h \ - $(SRC)/timespec.h \ - $(EMACS_ROOT)/nt/inc/sys/stat.h \ - $(EMACS_ROOT)/src/s/ms-w32.h \ - $(EMACS_ROOT)/src/config.h + $(GNU_LIB)/timespec-sub.c \ + $(GNU_LIB)/intprops.h \ + $(GNU_LIB)/timespec.h \ + $(CONFIG_H) $(BLD)/md5.$(O) : \ - $(SRC)/md5.c \ - $(SRC)/md5.h \ - $(EMACS_ROOT)/nt/inc/stdint.h \ - $(EMACS_ROOT)/nt/inc/stdalign.h \ - $(EMACS_ROOT)/nt/inc/sys/stat.h \ - $(EMACS_ROOT)/src/s/ms-w32.h \ - $(EMACS_ROOT)/src/config.h + $(GNU_LIB)/md5.c \ + $(NT_INC)/stdalign.h \ + $(NT_INC)/stdint.h \ + $(CONFIG_H) \ + $(MD5_H) $(BLD)/sha1.$(O) : \ - $(SRC)/sha1.c \ - $(SRC)/sha1.h \ - $(EMACS_ROOT)/nt/inc/stdint.h \ - $(EMACS_ROOT)/nt/inc/stdalign.h \ - $(EMACS_ROOT)/nt/inc/sys/stat.h \ - $(EMACS_ROOT)/src/s/ms-w32.h \ - $(EMACS_ROOT)/src/config.h + $(GNU_LIB)/sha1.c \ + $(NT_INC)/stdalign.h \ + $(NT_INC)/stdint.h \ + $(CONFIG_H) \ + $(SHA1_H) $(BLD)/sha256.$(O) : \ - $(SRC)/sha256.c \ - $(SRC)/sha256.h \ - $(EMACS_ROOT)/nt/inc/stdint.h \ - $(EMACS_ROOT)/nt/inc/stdalign.h \ - $(EMACS_ROOT)/nt/inc/sys/stat.h \ - $(EMACS_ROOT)/src/s/ms-w32.h \ - $(EMACS_ROOT)/src/config.h + $(GNU_LIB)/sha256.c \ + $(NT_INC)/stdalign.h \ + $(NT_INC)/stdint.h \ + $(CONFIG_H) \ + $(SHA256_H) $(BLD)/sha512.$(O) : \ - $(SRC)/sha512.c \ - $(SRC)/sha512.h \ - $(EMACS_ROOT)/nt/inc/stdint.h \ - $(EMACS_ROOT)/nt/inc/stdalign.h \ - $(EMACS_ROOT)/nt/inc/sys/stat.h \ - $(EMACS_ROOT)/src/s/ms-w32.h \ - $(EMACS_ROOT)/src/config.h + $(GNU_LIB)/sha512.c \ + $(NT_INC)/stdalign.h \ + $(NT_INC)/stdint.h \ + $(CONFIG_H) \ + $(SHA512_H) $(BLD)/filemode.$(O) : \ - $(SRC)/filemode.c \ - $(SRC)/filemode.h \ - $(EMACS_ROOT)/nt/inc/sys/stat.h \ - $(EMACS_ROOT)/src/s/ms-w32.h \ - $(EMACS_ROOT)/src/config.h + $(GNU_LIB)/filemode.c \ + $(CONFIG_H) \ + $(FILEMODE_H) # The following dependencies are for supporting parallel builds, where # we must make sure $(BLD) exists before any compilation starts. ------------------------------------------------------------ revno: 108970 committer: Juanma Barranquero branch nick: trunk timestamp: Mon 2012-07-09 16:01:41 +0200 message: lib-src/emacsclient.c (w32_execvp): Declare execvp to silence the compiler. diff: === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2012-07-09 04:21:55 +0000 +++ lib-src/ChangeLog 2012-07-09 14:01:41 +0000 @@ -1,5 +1,9 @@ 2012-07-09 Juanma Barranquero + * emacsclient.c (w32_execvp): Declare execvp to silence the compiler. + +2012-07-09 Juanma Barranquero + * makefile.w32-in ($(BLD)/test-distrib.exe): Use LIB_SRC, not SRC. (LIB_SRC, NT_INC, GNU_LIB, MS_W32_H, CONFIG_H, INTTYPES_H, NTLIB_H) (SYSTIME_H): New macros. === modified file 'lib-src/emacsclient.c' --- lib-src/emacsclient.c 2012-07-09 14:00:31 +0000 +++ lib-src/emacsclient.c 2012-07-09 14:01:41 +0000 @@ -463,6 +463,7 @@ w32_execvp (const char *path, char **argv) { int i; + extern int execvp (const char*, char **); /* Required to allow a .BAT script as alternate editor. */ argv[0] = (char *) alternate_editor; ------------------------------------------------------------ revno: 108969 committer: Juanma Barranquero branch nick: trunk timestamp: Mon 2012-07-09 16:00:31 +0200 message: lib-src/emacsclient.c: Adapt comments to GNU coding standards. diff: === modified file 'lib-src/emacsclient.c' --- lib-src/emacsclient.c 2012-06-24 17:39:14 +0000 +++ lib-src/emacsclient.c 2012-07-09 14:00:31 +0000 @@ -21,7 +21,7 @@ #ifdef WINDOWSNT -/* config.h defines these, which disables sockets altogether! */ +/* ms-w32.h defines these, which disables sockets altogether! */ # undef _WINSOCKAPI_ # undef _WINSOCK_H @@ -451,15 +451,14 @@ return window_app; } -/* - execvp wrapper for Windows. Quotes arguments with embedded spaces. +/* execvp wrapper for Windows. Quotes arguments with embedded spaces. This is necessary due to the broken implementation of exec* routines in the Microsoft libraries: they concatenate the arguments together without quoting special characters, and pass the result to CreateProcess, with predictably bad results. By contrast, POSIX execvp passes the arguments - directly into the argv array of the child process. -*/ + directly into the argv array of the child process. */ + int w32_execvp (const char *path, char **argv) { @@ -712,11 +711,10 @@ exit (EXIT_SUCCESS); } -/* - Try to run a different command, or --if no alternate editor is - defined-- exit with an errorcode. - Uses argv, but gets it from the global variable main_argv. -*/ +/* Try to run a different command, or --if no alternate editor is + defined-- exit with an errorcode. + Uses argv, but gets it from the global variable main_argv. */ + static _Noreturn void fail (void) { @@ -758,8 +756,9 @@ /* Socket used to communicate with the Emacs server process. */ HSOCKET emacs_socket = 0; -/* On Windows, the socket library was historically separate from the standard - C library, so errors are handled differently. */ +/* On Windows, the socket library was historically separate from the + standard C library, so errors are handled differently. */ + static void sock_err_message (const char *function_name) { @@ -864,7 +863,7 @@ /* The inverse of quote_argument. Removes quoting in string STR by - modifying the string in place. Returns STR. */ + modifying the string in place. Returns STR. */ static char * unquote_argument (char *str) @@ -947,10 +946,9 @@ #endif /* WINDOWSNT */ -/* - * Read the information needed to set up a TCP comm channel with - * the Emacs server: host, port, and authentication string. - */ +/* Read the information needed to set up a TCP comm channel with + the Emacs server: host, port, and authentication string. */ + static int get_server_config (const char *config_file, struct sockaddr_in *server, char *authentication) @@ -1031,18 +1029,14 @@ message (FALSE, "%s: connected to remote socket at %s\n", progname, inet_ntoa (server.sin_addr)); - /* - * Open up an AF_INET socket - */ + /* Open up an AF_INET socket. */ if ((s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { sock_err_message ("socket"); return INVALID_SOCKET; } - /* - * Set up the socket - */ + /* Set up the socket. */ if (connect (s, (struct sockaddr *) &server, sizeof server) < 0) { sock_err_message ("connect"); @@ -1051,9 +1045,7 @@ setsockopt (s, SOL_SOCKET, SO_LINGER, (char *) &l_arg, sizeof l_arg); - /* - * Send the authentication - */ + /* Send the authentication. */ auth_string[AUTH_KEY_LENGTH] = '\0'; send_to_emacs (s, "-auth "); @@ -1187,7 +1179,7 @@ going to sleep. Normally the suspend is initiated by Emacs via server-handle-suspend-tty, but if the server gets out of sync with reality, we may get a SIGTSTP on C-z. Handling this signal and - notifying Emacs about it should get things under control again. */ + notifying Emacs about it should get things under control again. */ static void handle_sigtstp (int signalnum) @@ -1239,10 +1231,7 @@ HSOCKET s; struct sockaddr_un server; - /* - * Open up an AF_UNIX socket in this person's home directory - */ - + /* Open up an AF_UNIX socket in this person's home directory. */ if ((s = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) { message (TRUE, "%s: socket: %s\n", progname, strerror (errno)); @@ -1476,10 +1465,9 @@ return FALSE; } -/* - * Search for a window of class "Emacs" and owned by a process with - * process id = emacs_pid. If found, allow it to grab the focus. - */ +/* Search for a window of class "Emacs" and owned by a process with + process id = emacs_pid. If found, allow it to grab the focus. */ + void w32_give_focus (void) { ------------------------------------------------------------ revno: 108968 committer: Juanma Barranquero branch nick: trunk timestamp: Mon 2012-07-09 15:40:34 +0200 message: nt/config.nt: Sync with autogen/config.in. diff: === modified file 'nt/ChangeLog' --- nt/ChangeLog 2012-07-07 23:16:19 +0000 +++ nt/ChangeLog 2012-07-09 13:40:34 +0000 @@ -1,3 +1,7 @@ +2012-07-09 Juanma Barranquero + + * config.nt: Sync with autogen/config.in. + 2012-07-07 Juanma Barranquero * config.nt (HAVE_STRCASECMP, HAVE_STRNCASECMP): Remove. === modified file 'nt/config.nt' --- nt/config.nt 2012-07-08 14:58:24 +0000 +++ nt/config.nt 2012-07-09 13:40:34 +0000 @@ -1097,6 +1097,11 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION +/* Define to empty to suppress deprecation warnings when building with + --enable-gcc-warnings and with libpng versions before 1.5, which lack + png_longjmp. */ +#undef PNG_DEPRECATED + /* Define to 1 if pthread_sigmask(), when it fails, returns -1 and sets errno. */ #undef PTHREAD_SIGMASK_FAILS_WITH_ERRNO ------------------------------------------------------------ revno: 108967 committer: Dmitry Antipov branch nick: trunk timestamp: Mon 2012-07-09 16:02:27 +0400 message: Use make_formatted_string to avoid double length calculation. * lisp.h (make_formatted_string): New prototype. * alloc.c (make_formatted_string): New function. * buffer.c (Fgenerate_new_buffer_name): Use it. * dbus.c (syms_of_dbusbind): Likewise. * editfns.c (Fcurrent_time_zone): Likewise. * filelock.c (get_boot_time): Likewise. * frame.c (make_terminal_frame, set_term_frame_name) (x_report_frame_params): Likewise. * image.c (gs_load): Likewise. * minibuf.c (get_minibuffer): Likewise. * msdos.c (dos_set_window_size): Likewise. * process.c (make_process): Likewise. * xdisp.c (ensure_echo_area_buffers): Likewise. * xsettings.c (apply_xft_settings): Likewise. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-09 07:07:24 +0000 +++ src/ChangeLog 2012-07-09 12:02:27 +0000 @@ -1,3 +1,21 @@ +2012-07-09 Dmitry Antipov + + Use make_formatted_string to avoid double length calculation. + * lisp.h (make_formatted_string): New prototype. + * alloc.c (make_formatted_string): New function. + * buffer.c (Fgenerate_new_buffer_name): Use it. + * dbus.c (syms_of_dbusbind): Likewise. + * editfns.c (Fcurrent_time_zone): Likewise. + * filelock.c (get_boot_time): Likewise. + * frame.c (make_terminal_frame, set_term_frame_name) + (x_report_frame_params): Likewise. + * image.c (gs_load): Likewise. + * minibuf.c (get_minibuffer): Likewise. + * msdos.c (dos_set_window_size): Likewise. + * process.c (make_process): Likewise. + * xdisp.c (ensure_echo_area_buffers): Likewise. + * xsettings.c (apply_xft_settings): Likewise. + 2012-07-09 Glenn Morris Stop ns builds polluting the environment with EMACSDATA, EMACSDOC. === modified file 'src/alloc.c' --- src/alloc.c 2012-07-06 05:07:44 +0000 +++ src/alloc.c 2012-07-09 12:02:27 +0000 @@ -2517,6 +2517,20 @@ return string; } +/* Print arguments to BUF according to a FORMAT, then return + a Lisp_String initialized with the data from BUF. */ + +Lisp_Object +make_formatted_string (char *buf, const char *format, ...) +{ + va_list ap; + ptrdiff_t length; + + va_start (ap, format); + length = vsprintf (buf, format, ap); + va_end (ap); + return make_string (buf, length); +} /*********************************************************************** === modified file 'src/buffer.c' --- src/buffer.c 2012-07-06 07:34:37 +0000 +++ src/buffer.c 2012-07-09 12:02:27 +0000 @@ -861,8 +861,9 @@ if (!strncmp (SSDATA (name), " ", 1)) /* see bug#1229 */ { /* Note fileio.c:make_temp_name does random differently. */ - sprintf (number, "-%"pI"d", XFASTINT (Frandom (make_number (999999)))); - tem2 = concat2 (name, build_string (number)); + tem2 = concat2 (name, make_formatted_string + (number, "-%"pI"d", + XFASTINT (Frandom (make_number (999999))))); tem = Fget_buffer (tem2); if (NILP (tem)) return tem2; @@ -873,8 +874,8 @@ count = 1; while (1) { - sprintf (number, "<%"pD"d>", ++count); - gentemp = concat2 (tem2, build_string (number)); + gentemp = concat2 (tem2, make_formatted_string + (number, "<%"pD"d>", ++count)); tem = Fstring_equal (gentemp, ignore); if (!NILP (tem)) return gentemp; === modified file 'src/dbusbind.c' --- src/dbusbind.c 2012-06-09 11:13:30 +0000 +++ src/dbusbind.c 2012-07-09 12:02:27 +0000 @@ -1757,8 +1757,8 @@ int major, minor, micro; char s[sizeof ".." + 3 * INT_STRLEN_BOUND (int)]; dbus_get_version (&major, &minor, µ); - sprintf (s, "%d.%d.%d", major, minor, micro); - Vdbus_runtime_version = build_string (s); + Vdbus_runtime_version + = make_formatted_string (s, "%d.%d.%d", major, minor, micro); #else Vdbus_runtime_version = Qnil; #endif === modified file 'src/editfns.c' --- src/editfns.c 2012-07-07 01:57:42 +0000 +++ src/editfns.c 2012-07-09 12:02:27 +0000 @@ -2082,8 +2082,9 @@ int m = offset / 60; int am = offset < 0 ? - m : m; char buf[sizeof "+00" + INT_STRLEN_BOUND (int)]; - sprintf (buf, "%c%02d%02d", (offset < 0 ? '-' : '+'), am/60, am%60); - zone_name = build_string (buf); + zone_name = make_formatted_string (buf, "%c%02d%02d", + (offset < 0 ? '-' : '+'), + am / 60, am % 60); } } === modified file 'src/filelock.c' --- src/filelock.c 2012-07-05 18:35:48 +0000 +++ src/filelock.c 2012-07-09 12:02:27 +0000 @@ -174,14 +174,14 @@ filename = Qnil; - sprintf (cmd_string, "%s.%d", WTMP_FILE, counter); - tempname = build_string (cmd_string); + tempname = make_formatted_string + (cmd_string, "%s.%d", WTMP_FILE, counter); if (! NILP (Ffile_exists_p (tempname))) filename = tempname; else { - sprintf (cmd_string, "%s.%d.gz", WTMP_FILE, counter); - tempname = build_string (cmd_string); + tempname = make_formatted_string (cmd_string, "%s.%d.gz", + WTMP_FILE, counter); if (! NILP (Ffile_exists_p (tempname))) { Lisp_Object args[6]; === modified file 'src/frame.c' --- src/frame.c 2012-07-07 21:39:23 +0000 +++ src/frame.c 2012-07-09 12:02:27 +0000 @@ -518,9 +518,7 @@ XSETFRAME (frame, f); Vframe_list = Fcons (frame, Vframe_list); - tty_frame_count++; - sprintf (name, "F%"pMd, tty_frame_count); - f->name = build_string (name); + f->name = make_formatted_string (name, "F%"pMd, ++tty_frame_count); f->visible = 1; /* FRAME_SET_VISIBLE wd set frame_garbaged. */ f->async_visible = 1; /* Don't let visible be cleared later. */ @@ -2028,9 +2026,7 @@ SBYTES (f->name))) return; - tty_frame_count++; - sprintf (namebuf, "F%"pMd, tty_frame_count); - name = build_string (namebuf); + name = make_formatted_string (namebuf, "F%"pMd, ++tty_frame_count); } else { @@ -3049,20 +3045,16 @@ actually a pointer. Explicit casting avoids compiler warnings. */ w = (unsigned long) FRAME_X_WINDOW (f); - sprintf (buf, "%lu", w); store_in_alist (alistptr, Qwindow_id, - build_string (buf)); + make_formatted_string (buf, "%lu", w)); #ifdef HAVE_X_WINDOWS #ifdef USE_X_TOOLKIT /* Tooltip frame may not have this widget. */ if (FRAME_X_OUTPUT (f)->widget) #endif - { - w = (unsigned long) FRAME_OUTER_WINDOW (f); - sprintf (buf, "%lu", w); - } + w = (unsigned long) FRAME_OUTER_WINDOW (f); store_in_alist (alistptr, Qouter_window_id, - build_string (buf)); + make_formatted_string (buf, "%lu", w)); #endif store_in_alist (alistptr, Qicon_name, f->icon_name); FRAME_SAMPLE_VISIBILITY (f); === modified file 'src/image.c' --- src/image.c 2012-07-07 19:23:41 +0000 +++ src/image.c 2012-07-09 12:02:27 +0000 @@ -8549,13 +8549,13 @@ don't either. Let the Lisp loader use `unwind-protect' instead. */ printnum1 = FRAME_X_WINDOW (f); printnum2 = img->pixmap; - sprintf (buffer, "%"pMu" %"pMu, printnum1, printnum2); - window_and_pixmap_id = build_string (buffer); + window_and_pixmap_id + = make_formatted_string (buffer, "%"pMu" %"pMu, printnum1, printnum2); printnum1 = FRAME_FOREGROUND_PIXEL (f); printnum2 = FRAME_BACKGROUND_PIXEL (f); - sprintf (buffer, "%"pMu" %"pMu, printnum1, printnum2); - pixel_colors = build_string (buffer); + pixel_colors + = make_formatted_string (buffer, "%"pMu" %"pMu, printnum1, printnum2); XSETFRAME (frame, f); loader = image_spec_value (img->spec, QCloader, NULL); === modified file 'src/lisp.h' --- src/lisp.h 2012-07-07 21:39:23 +0000 +++ src/lisp.h 2012-07-09 12:02:27 +0000 @@ -2611,6 +2611,7 @@ extern Lisp_Object allocate_misc (void); extern _Noreturn void string_overflow (void); extern Lisp_Object make_string (const char *, ptrdiff_t); +extern Lisp_Object make_formatted_string (char *, const char *, ...); extern Lisp_Object make_unibyte_string (const char *, ptrdiff_t); extern Lisp_Object make_multibyte_string (const char *, ptrdiff_t, ptrdiff_t); extern Lisp_Object make_event_array (int, Lisp_Object *); === modified file 'src/minibuf.c' --- src/minibuf.c 2012-07-06 04:42:30 +0000 +++ src/minibuf.c 2012-07-09 12:02:27 +0000 @@ -792,8 +792,8 @@ buf = Fcar (tail); if (NILP (buf) || NILP (BVAR (XBUFFER (buf), name))) { - sprintf (name, " *Minibuf-%"pI"d*", depth); - buf = Fget_buffer_create (build_string (name)); + buf = Fget_buffer_create + (make_formatted_string (name, " *Minibuf-%"pI"d*", depth)); /* Although the buffer's name starts with a space, undo should be enabled in it. */ === modified file 'src/msdos.c' --- src/msdos.c 2012-07-05 06:32:41 +0000 +++ src/msdos.c 2012-07-09 12:02:27 +0000 @@ -520,8 +520,10 @@ /* If the user specified a special video mode for these dimensions, use that mode. */ - sprintf (video_name, "screen-dimensions-%dx%d", *rows, *cols); - video_mode = Fsymbol_value (Fintern_soft (build_string (video_name), Qnil)); + video_mode + = Fsymbol_value (Fintern_soft (make_formatted_string + (video_name, "screen-dimensions-%dx%d", + *rows, *cols), Qnil)); if (INTEGERP (video_mode) && (video_mode_value = XINT (video_mode)) > 0) === modified file 'src/process.c' --- src/process.c 2012-07-06 16:57:32 +0000 +++ src/process.c 2012-07-09 12:02:27 +0000 @@ -645,8 +645,7 @@ { tem = Fget_process (name1); if (NILP (tem)) break; - sprintf (suffix, "<%"pMd">", i); - name1 = concat2 (name, build_string (suffix)); + name1 = concat2 (name, make_formatted_string (suffix, "<%"pMd">", i)); } name = name1; p->name = name; === modified file 'src/xdisp.c' --- src/xdisp.c 2012-07-08 16:38:43 +0000 +++ src/xdisp.c 2012-07-09 12:02:27 +0000 @@ -9866,8 +9866,8 @@ int j; old_buffer = echo_buffer[i]; - sprintf (name, " *Echo Area %d*", i); - echo_buffer[i] = Fget_buffer_create (build_string (name)); + echo_buffer[i] = Fget_buffer_create + (make_formatted_string (name, " *Echo Area %d*", i)); BVAR (XBUFFER (echo_buffer[i]), truncate_lines) = Qnil; /* to force word wrap in echo area - it was decided to postpone this*/ === modified file 'src/xsettings.c' --- src/xsettings.c 2012-06-27 15:46:48 +0000 +++ src/xsettings.c 2012-07-09 12:02:27 +0000 @@ -711,10 +711,12 @@ if (send_event_p) store_config_changed_event (Qfont_render, XCAR (dpyinfo->name_list_element)); - sprintf (buf, format, oldsettings.aa, oldsettings.hinting, - oldsettings.rgba, oldsettings.lcdfilter, - oldsettings.hintstyle, oldsettings.dpi); - Vxft_settings = build_string (buf); + Vxft_settings + = make_formatted_string (buf, format, + oldsettings.aa, oldsettings.hinting, + oldsettings.rgba, oldsettings.lcdfilter, + oldsettings.hintstyle, oldsettings.dpi); + } else FcPatternDestroy (pat); ------------------------------------------------------------ revno: 108966 committer: Glenn Morris branch nick: trunk timestamp: Mon 2012-07-09 06:17:37 -0400 message: Auto-commit of generated files. diff: === modified file 'autogen/Makefile.in' --- autogen/Makefile.in 2012-07-07 10:17:27 +0000 +++ autogen/Makefile.in 2012-07-09 10:17:37 +0000 @@ -97,7 +97,7 @@ $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/utimbuf.m4 \ $(top_srcdir)/m4/utimens.m4 $(top_srcdir)/m4/utimes.m4 \ $(top_srcdir)/m4/warnings.m4 $(top_srcdir)/m4/wchar_t.m4 \ - $(top_srcdir)/configure.in + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d === modified file 'autogen/config.in' --- autogen/config.in 2012-07-08 10:18:44 +0000 +++ autogen/config.in 2012-07-09 10:17:37 +0000 @@ -1,4 +1,4 @@ -/* src/config.in. Generated from configure.in by autoheader. */ +/* src/config.in. Generated from configure.ac by autoheader. */ /* GNU Emacs site configuration template file. @@ -1089,6 +1089,11 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION +/* Define to empty to suppress deprecation warnings when building with + --enable-gcc-warnings and with libpng versions before 1.5, which lack + png_longjmp. */ +#undef PNG_DEPRECATED + /* Define to 1 if pthread_sigmask(), when it fails, returns -1 and sets errno. */ #undef PTHREAD_SIGMASK_FAILS_WITH_ERRNO === modified file 'autogen/configure' --- autogen/configure 2012-07-08 10:18:44 +0000 +++ autogen/configure 2012-07-09 10:17:37 +0000 @@ -7606,41 +7606,6 @@ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Wno-deprecated-declarations" >&5 -$as_echo_n "checking whether C compiler handles -Wno-deprecated-declarations... " >&6; } -if test "${gl_cv_warn_c__Wno_deprecated_declarations+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - - gl_save_compiler_FLAGS="$CFLAGS" - as_fn_append CFLAGS " -Wno-deprecated-declarations" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_warn_c__Wno_deprecated_declarations=yes -else - gl_cv_warn_c__Wno_deprecated_declarations=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS="$gl_save_compiler_FLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Wno_deprecated_declarations" >&5 -$as_echo "$gl_cv_warn_c__Wno_deprecated_declarations" >&6; } -if test "x$gl_cv_warn_c__Wno_deprecated_declarations" = x""yes; then : - as_fn_append WARN_CFLAGS " -Wno-deprecated-declarations" -fi - - # triggered by libpng # In spite of excluding -Wlogical-op above, it is enabled, as of # gcc 4.5.0 20090517. @@ -20235,7 +20200,7 @@ cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF - + break fi done @@ -20289,6 +20254,22 @@ $as_echo "#define HAVE_PNG 1" >>confdefs.h LIBPNG="-lpng -lz -lm" + + ac_fn_c_check_decl "$LINENO" "png_longjmp" "ac_cv_have_decl_png_longjmp" "#ifdef HAVE_LIBPNG_PNG_H + # include + #else + # include + #endif + +" +if test "x$ac_cv_have_decl_png_longjmp" = x""yes; then : + +else + +$as_echo "#define PNG_DEPRECATED /**/" >>confdefs.h + +fi + fi fi @@ -24807,4 +24788,3 @@ $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi - ------------------------------------------------------------ revno: 108965 committer: Paul Eggert branch nick: trunk timestamp: Mon 2012-07-09 01:34:39 -0700 message: Merge from gnulib. diff: === modified file 'ChangeLog' --- ChangeLog 2012-07-09 04:58:55 +0000 +++ ChangeLog 2012-07-09 08:34:39 +0000 @@ -1,5 +1,8 @@ 2012-07-09 Paul Eggert + Merge from gnulib, incorporating: + 2012-07-09 timespec: mark functions with const attributes + Rename configure.in to configure.ac (Bug#11603). The name 'configure.in' has been obsolescent for quite some time, and the next release of Autoconf will generate warnings for it. === modified file 'doc/misc/texinfo.tex' --- doc/misc/texinfo.tex 2012-06-08 00:03:10 +0000 +++ doc/misc/texinfo.tex 2012-07-09 08:34:39 +0000 @@ -3,7 +3,7 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2012-06-05.14} +\def\texinfoversion{2012-07-03.16} % % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, @@ -4206,7 +4206,7 @@ } \def\ifsetfail{\doignore{ifset}} -% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been +% @ifclear VAR ... @end executes the `...' iff VAR has never been % defined with @set, or has been undefined with @clear. % % The `\else' inside the `\doifset' parameter is a trick to reuse the @@ -4217,6 +4217,35 @@ \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}} \def\ifclearfail{\doignore{ifclear}} +% @ifcommandisdefined CMD ... @end executes the `...' if CMD (written +% without the @) is in fact defined. We can only feasibly check at the +% TeX level, so something like `mathcode' is going to considered +% defined even though it is not a Texinfo command. +% +\makecond{ifcommanddefined} +\def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}} +% +\def\doifcmddefined#1#2{{% + \makevalueexpandable + \let\next=\empty + \expandafter\ifx\csname #2\endcsname\relax + #1% If not defined, \let\next as above. + \fi + \expandafter + }\next +} +\def\ifcmddefinedfail{\doignore{ifcommanddefined}} + +% @ifcommandnotdefined CMD ... handlded similar to @ifclear above. +\makecond{ifcommandnotdefined} +\def\ifcommandnotdefined{% + \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}} +\def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}} + +% Set the `txicommandconditionals' variable, so documents have a way to +% test if the @ifcommand...defined conditionals are available. +\set txicommandconditionals + % @dircategory CATEGORY -- specify a category of the dir file % which this file should belong to. Ignore this in TeX. \let\dircategory=\comment === modified file 'lib/getloadavg.c' --- lib/getloadavg.c 2012-05-26 23:14:36 +0000 +++ lib/getloadavg.c 2012-07-09 08:34:39 +0000 @@ -28,7 +28,7 @@ macro that comes with autoconf 2.13 or newer. If that isn't an option, then just put AC_CHECK_FUNCS(pstat_getdynamic) in your - configure.in file. + configure.ac file. HAVE_LIBPERFSTAT Define this if your system has the perfstat_cpu_total function in libperfstat (AIX). FIXUP_KERNEL_SYMBOL_ADDR() Adjust address in returned struct nlist. === modified file 'lib/timespec.h' --- lib/timespec.h 2012-06-24 17:21:20 +0000 +++ lib/timespec.h 2012-07-09 08:34:39 +0000 @@ -65,9 +65,12 @@ return a.tv_sec < 0 ? -1 : a.tv_sec || a.tv_nsec; } -struct timespec timespec_add (struct timespec, struct timespec); -struct timespec timespec_sub (struct timespec, struct timespec); -struct timespec dtotimespec (double); +struct timespec timespec_add (struct timespec, struct timespec) + _GL_ATTRIBUTE_CONST; +struct timespec timespec_sub (struct timespec, struct timespec) + _GL_ATTRIBUTE_CONST; +struct timespec dtotimespec (double) + _GL_ATTRIBUTE_CONST; /* Return an approximation to A, of type 'double'. */ static inline double === modified file 'm4/getopt.m4' --- m4/getopt.m4 2012-06-28 00:07:33 +0000 +++ m4/getopt.m4 2012-07-09 08:34:39 +0000 @@ -38,7 +38,6 @@ AC_REQUIRE([gl_FUNC_GETOPT_POSIX]) ]) -# emacs' configure.in uses this. AC_DEFUN([gl_GETOPT_IFELSE], [ AC_REQUIRE([gl_GETOPT_CHECK_HEADERS]) @@ -360,7 +359,6 @@ fi ]) -# emacs' configure.in uses this. AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER], [ GETOPT_H=getopt.h @@ -371,7 +369,6 @@ ]) # Prerequisites of lib/getopt*. -# emacs' configure.in uses this. AC_DEFUN([gl_PREREQ_GETOPT], [ AC_CHECK_DECLS_ONCE([getenv]) === modified file 'm4/gnulib-comp.m4' --- m4/gnulib-comp.m4 2012-07-06 21:07:46 +0000 +++ m4/gnulib-comp.m4 2012-07-09 08:34:39 +0000 @@ -28,7 +28,7 @@ # other built files. -# This macro should be invoked from ./configure.in, in the section +# This macro should be invoked from ./configure.ac, in the section # "Checks for programs", right after AC_PROG_CC, and certainly before # any checks for libraries, header files, types and library functions. AC_DEFUN([gl_EARLY], @@ -118,7 +118,7 @@ # Code from module warnings: ]) -# This macro should be invoked from ./configure.in, in the section +# This macro should be invoked from ./configure.ac, in the section # "Check for header files, types and library functions". AC_DEFUN([gl_INIT], [ ------------------------------------------------------------ revno: 108964 committer: Glenn Morris branch nick: trunk timestamp: Mon 2012-07-09 00:07:24 -0700 message: Stop ns builds polluting the environment with EMACSDATA, EMACSDOC It's bad form for one part of a program to communicate with another part by making persistent changes to the environment of all subsequent child processes. For example, it can cause odd bugs when building Emacs from within Emacs (eg bug#6401, maybe). * nsterm.m (ns_etc_directory): New function, split from ns_init_paths. (ns_init_paths): Do not set EMACSDATA, EMACSDOC. * nsterm.h (ns_etc_directory): Add it. * callproc.c [HAVE_NS]: Include nsterm.h. (init_callproc_1, init_callproc) [HAVE_NS]: Use ns_etc_directory. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-09 03:15:10 +0000 +++ src/ChangeLog 2012-07-09 07:07:24 +0000 @@ -1,3 +1,12 @@ +2012-07-09 Glenn Morris + + Stop ns builds polluting the environment with EMACSDATA, EMACSDOC. + * nsterm.m (ns_etc_directory): New function, split from ns_init_paths. + (ns_init_paths): Do not set EMACSDATA, EMACSDOC. + * nsterm.h (ns_etc_directory): Add it. + * callproc.c [HAVE_NS]: Include nsterm.h. + (init_callproc_1, init_callproc) [HAVE_NS]: Use ns_etc_directory. + 2012-07-09 Dmitry Antipov Move marker debugging code under MARKER_DEBUG. === modified file 'src/callproc.c' --- src/callproc.c 2012-07-05 18:35:48 +0000 +++ src/callproc.c 2012-07-09 07:07:24 +0000 @@ -61,6 +61,10 @@ #include "msdos.h" #endif +#ifdef HAVE_NS +#include "nsterm.h" +#endif + #ifndef USE_CRT_DLL extern char **environ; #endif @@ -1513,13 +1517,26 @@ { char *data_dir = egetenv ("EMACSDATA"); char *doc_dir = egetenv ("EMACSDOC"); +#ifdef HAVE_NS + const char *etc_dir = ns_etc_directory (); +#endif Vdata_directory = Ffile_name_as_directory (build_string (data_dir ? data_dir - : PATH_DATA)); +#ifdef HAVE_NS + : (etc_dir ? etc_dir : PATH_DATA) +#else + : PATH_DATA +#endif + )); Vdoc_directory = Ffile_name_as_directory (build_string (doc_dir ? doc_dir - : PATH_DOC)); +#ifdef HAVE_NS + : (etc_dir ? etc_dir : PATH_DOC) +#else + : PATH_DOC +#endif + )); /* Check the EMACSPATH environment variable, defaulting to the PATH_EXEC path from epaths.h. */ @@ -1537,6 +1554,17 @@ register char * sh; Lisp_Object tempdir; +#ifdef HAVE_NS + if (data_dir == 0) + { + const char *etc_dir = ns_etc_directory (); + if (etc_dir) + { + data_dir = alloca (strlen (etc_dir) + 1); + strcpy (data_dir, etc_dir); + } + } +#endif if (!NILP (Vinstallation_directory)) { === modified file 'src/nsterm.h' --- src/nsterm.h 2012-07-03 18:24:42 +0000 +++ src/nsterm.h 2012-07-09 07:07:24 +0000 @@ -798,6 +798,7 @@ #define NSAPP_DATA2_RUNASSCRIPT 10 extern void ns_run_ascript (void); +extern char *ns_etc_directory (void); extern void ns_init_paths (void); extern void syms_of_nsterm (void); extern void syms_of_nsfns (void); === modified file 'src/nsterm.m' --- src/nsterm.m 2012-07-06 21:07:46 +0000 +++ src/nsterm.m 2012-07-09 07:07:24 +0000 @@ -286,6 +286,26 @@ } +char * +ns_etc_directory (void) +{ +/* If running as a self-contained app bundle, return as a string the + filename of the etc directory, if present; else nil. */ + + NSBundle *bundle = [NSBundle mainBundle]; + NSString *resourceDir = [bundle resourcePath]; + NSString *resourcePath; + NSFileManager *fileManager = [NSFileManager defaultManager]; + BOOL isDir; + + resourcePath = [resourceDir stringByAppendingPathComponent: @"etc"]; + if ([fileManager fileExistsAtPath: resourcePath isDirectory: &isDir]) + { + if (isDir) return [resourcePath UTF8String]; + } + return nil; +} + void ns_init_paths (void) /* -------------------------------------------------------------------------- @@ -369,18 +389,6 @@ if ([resourcePaths length] > 0) setenv ("EMACSPATH", [resourcePaths UTF8String], 1); } - - resourcePath = [resourceDir stringByAppendingPathComponent: @"etc"]; - if ([fileManager fileExistsAtPath: resourcePath isDirectory: &isDir]) - { - if (isDir) - { - if (!getenv ("EMACSDATA")) - setenv ("EMACSDATA", [resourcePath UTF8String], 1); - if (!getenv ("EMACSDOC")) - setenv ("EMACSDOC", [resourcePath UTF8String], 1); - } - } } static void ------------------------------------------------------------ revno: 108963 committer: Paul Eggert branch nick: trunk timestamp: Sun 2012-07-08 21:58:55 -0700 message: Mention coordinates of recent Autoconf change, thanks to Stefano Lattarini. diff: === modified file 'ChangeLog' --- ChangeLog 2012-07-09 04:52:49 +0000 +++ ChangeLog 2012-07-09 04:58:55 +0000 @@ -3,6 +3,8 @@ Rename configure.in to configure.ac (Bug#11603). The name 'configure.in' has been obsolescent for quite some time, and the next release of Autoconf will generate warnings for it. + See commit 'v2.69-4-g560f16b' of 2012-05-06, "general: deprecate + 'configure.in' as autoconf input" in the Autoconf git repository. * configure.ac: Rename from configure.in. * INSTALL, INSTALL.BZR, README, make-dist: * Makefile.in (AUTOCONF_INPUTS):