------------------------------------------------------------ revno: 116975 fixes bug: http://debbugs.gnu.org/17258 committer: Paul Eggert branch nick: trunk timestamp: Sun 2014-04-13 22:35:45 -0700 message: * autogen.sh: Use autoreconf's -f option. diff: === modified file 'ChangeLog' --- ChangeLog 2014-04-14 05:23:31 +0000 +++ ChangeLog 2014-04-14 05:35:45 +0000 @@ -1,5 +1,7 @@ 2014-04-14 Paul Eggert + * autogen.sh: Use autoreconf's -f option (Bug#17258). + Clean up configure-time library handling a bit. This patch was inspired by emacs-24 bzr 116961, which fixed a bug due to sloppy library handling in 'configure'. === modified file 'autogen.sh' --- autogen.sh 2014-02-10 01:34:22 +0000 +++ autogen.sh 2014-04-14 05:35:45 +0000 @@ -202,7 +202,8 @@ ## Let autoreconf figure out what, if anything, needs doing. -autoreconf -i -I m4 || exit $? +## Use autoreconf's -f option in case autoreconf itself has changed. +autoreconf -f -i -I m4 || exit $? ## Create a timestamp, so that './autogen.sh; make' doesn't ## cause 'make' to needlessly run 'autoheader'. ------------------------------------------------------------ revno: 116974 committer: Paul Eggert branch nick: trunk timestamp: Sun 2014-04-13 22:23:31 -0700 message: Clean up configure-time library handling a bit. This patch was inspired by emacs-24 bzr 116961, which fixed a bug due to sloppy library handling in 'configure'. * configure.ac (LIB_MATH, LIB_PTHREAD, LIBXMU): Use AC_SEARCH_LIBS instead of AC_CHECK_LIB as per Autoconf manual. (LIB_MATH, LIB_PTHREAD, HAVE_X11, IMAGEMAGICK_LIBS, GTK_LIBS) (DBUS_LIBS, LIBXMU, XFT_LIBS, LIBXSM, LIBXML2_LIBS, LIBS_MAIL) (with_kerberos): Don't let the library choice infect $LIBS. (dnet_ntoa, cma_open): Remove obsolete tests. (emacs_pthread_function): Probe for pthread_kill, not pthread_self, as that's a bit more selective on GNU/Linux. (LIBXEXT): Remove. (touchlock): Test for existence when $LIBS_MAIL is in use. (AC_CHECK_FUNCS): Use only $LIB_MATH in addition to $LIBS when testing for typical functions like accept4, lrand48. (random, rint): Remove obsolete HP-UX 9 A.09.05 test. diff: === modified file 'ChangeLog' --- ChangeLog 2014-04-11 06:43:20 +0000 +++ ChangeLog 2014-04-14 05:23:31 +0000 @@ -1,3 +1,23 @@ +2014-04-14 Paul Eggert + + Clean up configure-time library handling a bit. + This patch was inspired by emacs-24 bzr 116961, which fixed + a bug due to sloppy library handling in 'configure'. + * configure.ac (LIB_MATH, LIB_PTHREAD, LIBXMU): + Use AC_SEARCH_LIBS instead of AC_CHECK_LIB as per Autoconf manual. + (LIB_MATH, LIB_PTHREAD, HAVE_X11, IMAGEMAGICK_LIBS, GTK_LIBS) + (DBUS_LIBS, LIBXMU, XFT_LIBS, LIBXSM, LIBXML2_LIBS, LIBS_MAIL) + (with_kerberos): + Don't let the library choice infect $LIBS. + (dnet_ntoa, cma_open): Remove obsolete tests. + (emacs_pthread_function): Probe for pthread_kill, not pthread_self, + as that's a bit more selective on GNU/Linux. + (LIBXEXT): Remove. + (touchlock): Test for existence when $LIBS_MAIL is in use. + (AC_CHECK_FUNCS): Use only $LIB_MATH in addition to $LIBS + when testing for typical functions like accept4, lrand48. + (random, rint): Remove obsolete HP-UX 9 A.09.05 test. + 2014-04-11 Glenn Morris * make-dist: Do not distribute generated admin/grammars/Makefile. === modified file 'admin/CPP-DEFINES' --- admin/CPP-DEFINES 2014-03-26 01:14:44 +0000 +++ admin/CPP-DEFINES 2014-04-14 05:23:31 +0000 @@ -200,17 +200,13 @@ HAVE_KRB_H HAVE_LANGINFO_CODESET HAVE_LIBDGC -HAVE_LIBDNET HAVE_LIBKSTAT HAVE_LIBLOCKFILE -HAVE_LIBM HAVE_LIBMAIL HAVE_LIBOTF HAVE_LIBPERFSTAT HAVE_LIBPNG_PNG_H -HAVE_LIBPTHREADS HAVE_LIBSELINUX -HAVE_LIBXEXT HAVE_LIBXML2 HAVE_LIBXMU HAVE_LOCALTIME_R === modified file 'configure.ac' --- configure.ac 2014-04-11 06:43:20 +0000 +++ configure.ac 2014-04-14 05:23:31 +0000 @@ -1294,8 +1294,17 @@ # Likewise for obsolescent test for uid_t, gid_t; Emacs assumes them. AC_DEFUN([AC_TYPE_UID_T]) +# sqrt and other floating-point functions such as fmod and frexp +# are found in -lm on many systems. +OLD_LIBS=$LIBS +AC_SEARCH_LIBS([sqrt], [m]) +if test "X$LIBS" = "X$OLD_LIBS"; then + LIB_MATH= +else + LIB_MATH=$ac_cv_search_sqrt +fi +LIBS=$OLD_LIBS -LIB_MATH=-lm dnl Current possibilities handled by sed (aix4-2 -> aix, dnl gnu-linux -> gnu/linux, etc.): dnl gnu, gnu/linux, gnu/kfreebsd, aix, cygwin, darwin, hpux, irix. @@ -2044,53 +2053,32 @@ LIBS="$LIBS_SYSTEM $LIBS" -dnl If found, this adds -ldnet to LIBS, which Autoconf uses for checks. -AC_CHECK_LIB(dnet, dnet_ntoa) -dnl This causes -lresolv to get used in subsequent tests, -dnl which causes failures on some systems such as HPUX 9. -dnl AC_CHECK_LIB(resolv, gethostbyname) - dnl FIXME replace main with a function we actually want from this library. AC_CHECK_LIB(Xbsd, main, LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -lXbsd") -dnl Check if pthreads is available. +dnl Check for the POSIX thread library. LIB_PTHREAD= AC_CHECK_HEADERS_ONCE(pthread.h) if test "$ac_cv_header_pthread_h"; then dnl gmalloc.c uses pthread_atfork, which is not available on older-style dnl hosts such as MirBSD 10, so test for pthread_atfork instead of merely - dnl testing for pthread_self if Emacs uses gmalloc.c. + dnl testing for pthread_kill if Emacs uses gmalloc.c. if test "$GMALLOC_OBJ" = gmalloc.o; then emacs_pthread_function=pthread_atfork else - emacs_pthread_function=pthread_self - fi - AC_CHECK_LIB(pthread, $emacs_pthread_function, HAVE_PTHREAD=yes) -fi -if test "$HAVE_PTHREAD" = yes; then - case "${canonical}" in - *-hpux*) ;; - *) LIB_PTHREAD="-lpthread" - LIBS="$LIB_PTHREAD $LIBS" ;; - esac - AC_DEFINE(HAVE_PTHREAD, 1, [Define to 1 if you have pthread (-lpthread).]) + emacs_pthread_function=pthread_kill + fi + OLD_LIBS=$LIBS + AC_SEARCH_LIBS([$emacs_pthread_function], [pthread], + [AC_DEFINE([HAVE_PTHREAD], [1], + [Define to 1 if you have pthread (-lpthread).])]) + if test "X$LIBS" != "X$OLD_LIBS"; then + eval LIB_PTHREAD=\$ac_cv_search_$emacs_pthread_function + fi + LIBS=$OLD_LIBS fi AC_SUBST([LIB_PTHREAD]) -AC_CHECK_LIB(pthreads, cma_open) - -## Note: when using cpp in s/aix4.2.h, this definition depended on -## HAVE_LIBPTHREADS. That was not defined earlier in configure when -## the system file was sourced. Hence the value of LIBS_SYSTEM -## added to LIBS in configure would never contain the pthreads part, -## but the value used in Makefiles might. FIXME? -## -## -lpthreads seems to be necessary for Xlib in X11R6, and should -## be harmless on older versions of X where it happens to exist. -test "$opsys" = "aix4-2" && \ - test $ac_cv_lib_pthreads_cma_open = yes && \ - LIBS_SYSTEM="$LIBS_SYSTEM -lpthreads" - dnl Check for need for bigtoc support on IBM AIX case ${host_os} in @@ -2107,12 +2095,12 @@ ;; esac -# Change CFLAGS and CPPFLAGS temporarily so that C_SWITCH_X_SITE gets -# used for the tests that follow. We set them back to REAL_CFLAGS and -# REAL_CPPFLAGS later on. +# Change CFLAGS, CPPFLAGS, and LIBS temporarily so that C_SWITCH_X_SITE +# is for the tests that follow. We set them back later on. REAL_CFLAGS="$CFLAGS" REAL_CPPFLAGS="$CPPFLAGS" +REAL_LIBS="$LIBS" if test "${HAVE_X11}" = "yes"; then DEFS="$C_SWITCH_X_SITE $DEFS" @@ -2137,12 +2125,8 @@ [xgnu_linux_first_failure=no], [xgnu_linux_first_failure=yes]) if test "${xgnu_linux_first_failure}" = "yes"; then - OLD_LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE" - OLD_C_SWITCH_X_SITE="$C_SWITCH_X_SITE" OLD_CPPFLAGS="$CPPFLAGS" OLD_LIBS="$LIBS" - LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -b i486-linuxaout" - C_SWITCH_X_SITE="$C_SWITCH_X_SITE -b i486-linuxaout" CPPFLAGS="$CPPFLAGS -b i486-linuxaout" LIBS="$LIBS -b i486-linuxaout" AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], @@ -2151,15 +2135,15 @@ [xgnu_linux_second_failure=yes]) if test "${xgnu_linux_second_failure}" = "yes"; then # If we get the same failure with -b, there is no use adding -b. - # So take it out. This plays safe. - LD_SWITCH_X_SITE="$OLD_LD_SWITCH_X_SITE" - C_SWITCH_X_SITE="$OLD_C_SWITCH_X_SITE" - CPPFLAGS="$OLD_CPPFLAGS" - LIBS="$OLD_LIBS" + # So leave it out. This plays safe. AC_MSG_RESULT(no) else + LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -b i486-linuxaout" + C_SWITCH_X_SITE="$C_SWITCH_X_SITE -b i486-linuxaout" AC_MSG_RESULT(yes) fi + CPPFLAGS=$OLD_CPPFLAGS + LIBS=$OLD_LIBS else AC_MSG_RESULT(no) fi @@ -2226,7 +2210,6 @@ if test "${opsys}" = "mingw32"; then RSVG_LIBS= fi - LIBS="$RSVG_LIBS $LIBS" fi fi fi @@ -2245,9 +2228,13 @@ if test $HAVE_IMAGEMAGICK = yes; then AC_DEFINE(HAVE_IMAGEMAGICK, 1, [Define to 1 if using imagemagick.]) + OLD_CFLAGS=$CFLAGS + OLD_LIBS=$LIBS CFLAGS="$CFLAGS $IMAGEMAGICK_CFLAGS" LIBS="$IMAGEMAGICK_LIBS $LIBS" AC_CHECK_FUNCS(MagickExportImagePixels MagickMergeImageLayers) + CFLAGS=$OLD_CFLAGS + LIBS=$OLD_LIBS fi fi fi @@ -2302,10 +2289,12 @@ fi fi +OLD_CFLAGS=$CFLAGS +OLD_LIBS=$LIBS + if test x"$pkg_check_gtk" = xyes; then AC_SUBST(GTK_LIBS) - C_SWITCH_X_SITE="$C_SWITCH_X_SITE $GTK_CFLAGS" CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$GTK_LIBS $LIBS" dnl Try to compile a simple GTK program. @@ -2337,6 +2326,7 @@ AC_MSG_ERROR([Gtk+ wanted, but it does not compile, see config.log. Maybe some x11-devel files missing?]); fi else + C_SWITCH_X_SITE="$C_SWITCH_X_SITE $GTK_CFLAGS" HAVE_GTK=yes AC_DEFINE(USE_GTK, 1, [Define to 1 if using GTK.]) GTK_OBJ="gtkutil.o $GTK_OBJ" @@ -2405,6 +2395,9 @@ term_header=gtkutil.h fi +CFLAGS=$OLD_CFLAGS +LIBS=$OLD_LIBS + dnl D-Bus has been tested under GNU/Linux only. Must be adapted for dnl other platforms. HAVE_DBUS=no @@ -2412,17 +2405,19 @@ if test "${with_dbus}" = "yes"; then PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0, HAVE_DBUS=yes, HAVE_DBUS=no) if test "$HAVE_DBUS" = yes; then - LIBS="$LIBS $DBUS_LIBS" AC_DEFINE(HAVE_DBUS, 1, [Define to 1 if using D-Bus.]) dnl dbus_watch_get_unix_fd has been introduced in D-Bus 1.1.1. dnl dbus_type_is_valid and dbus_validate_* have been introduced in dnl D-Bus 1.5.12. + OLD_LIBS=$LIBS + LIBS="$LIBS $DBUS_LIBS" AC_CHECK_FUNCS(dbus_watch_get_unix_fd \ dbus_type_is_valid \ dbus_validate_bus_name \ dbus_validate_path \ dbus_validate_interface \ dbus_validate_member) + LIBS=$OLD_LIBS DBUS_OBJ=dbusbind.o fi fi @@ -2645,6 +2640,7 @@ X_TOOLKIT_TYPE=$USE_X_TOOLKIT LIBXTR6= +LIBXMU= if test "${USE_X_TOOLKIT}" != "none"; then AC_MSG_CHECKING(X11 toolkit version) AC_CACHE_VAL(emacs_cv_x11_toolkit_version_6, @@ -2671,37 +2667,20 @@ dnl tranle@intellicorp.com says libXmu.a can need XtMalloc in libXt.a to link. OLDLIBS="$LIBS" if test x$HAVE_X11XTR6 = xyes; then - LIBS="-lXt -lSM -lICE $LIBS" + OTHERLIBS='-lXt -lSM -lICE' else - LIBS="-lXt $LIBS" - fi - AC_CHECK_LIB(Xmu, XmuConvertStandardSelection) - test $ac_cv_lib_Xmu_XmuConvertStandardSelection = no && LIBS="$OLDLIBS" - dnl ac_cv_lib_Xmu_XmuConvertStandardSelection is also referenced below. + OTHERLIBS='-lXt' + fi + AC_SEARCH_LIBS([XmuConvertStandardSelection], [Xmu], [], [], [$OTHERLIBS]) + if test "X$LIBS" != "X$OLDLIBS"; then + LIBXMU=$ac_cv_search_XmuConvertStandardSelection + fi + LIBS=$OLDLIBS + dnl ac_cv_search_XmuConvertStandardSelection is also referenced below. fi AC_SUBST(LIBXTR6) - -dnl FIXME the logic here seems weird, but this is what cpp was doing. -dnl Why not just test for libxmu in the normal way? -LIBXMU=-lXmu -case $opsys in - ## These systems don't supply Xmu. - hpux* | aix4-2 ) - test "X$ac_cv_lib_Xmu_XmuConvertStandardSelection" != "Xyes" && LIBXMU= - ;; - mingw32 ) - LIBXMU= - ;; -esac AC_SUBST(LIBXMU) -# On Irix 6.5, at least, we need XShapeQueryExtension from -lXext for Xaw3D. -if test "${HAVE_X11}" = "yes"; then - if test "${USE_X_TOOLKIT}" != "none"; then - AC_CHECK_LIB(Xext, XShapeQueryExtension) - fi -fi - LIBXP= if test "${USE_X_TOOLKIT}" = "MOTIF"; then # OpenMotif may be installed in such a way on some GNU/Linux systems. @@ -2876,11 +2855,10 @@ AC_DEFINE(HAVE_XFT, 1, [Define to 1 if you have the Xft library.]) AC_SUBST(XFT_LIBS) C_SWITCH_X_SITE="$C_SWITCH_X_SITE $XFT_CFLAGS" - else - CPPFLAGS="$OLD_CPPFLAGS" - CFLAGS="$OLD_CFLAGS" - LIBS="$OLD_LIBS" fi # "${HAVE_XFT}" = "yes" + CPPFLAGS=$OLD_CPPFLAGS + CFLAGS=$OLD_CFLAGS + LIBS=$OLD_LIBS fi # "$HAVE_XFT" != no fi # "x${with_xft}" != "xno" @@ -3283,10 +3261,6 @@ if test "${HAVE_X_SM}" = "yes"; then AC_DEFINE(HAVE_X_SM, 1, [Define to 1 if you have the SM library (-lSM).]) LIBXSM="-lSM -lICE" - case "$LIBS" in - *-lSM*) ;; - *) LIBS="$LIBXSM $LIBS" ;; - esac fi fi AC_SUBST(LIBXSM) @@ -3362,8 +3336,8 @@ fi if test "${HAVE_LIBXML2}" = "yes"; then if test "${opsys}" != "mingw32"; then - LIBS="$LIBXML2_LIBS $LIBS" - AC_CHECK_LIB(xml2, htmlReadMemory, HAVE_LIBXML2=yes, HAVE_LIBXML2=no) + AC_CHECK_LIB(xml2, htmlReadMemory, HAVE_LIBXML2=yes, HAVE_LIBXML2=no + [$LIBXML2_LIBS]) else LIBXML2_LIBS="" fi @@ -3392,19 +3366,17 @@ AC_DEFINE(HAVE_H_ERRNO, 1, [Define to 1 if netdb.h declares h_errno.]) fi -# sqrt and other floating-point functions such as fmod and frexp -# are found in -lm on most systems, but mingw32 doesn't use -lm. -if test "${opsys}" != "mingw32"; then - AC_CHECK_LIB(m, sqrt) -fi - # Check for mail-locking functions in a "mail" library. Probably this should # have the same check as for liblockfile below. AC_CHECK_LIB(mail, maillock, have_mail=yes, have_mail=no) if test $have_mail = yes; then LIBS_MAIL=-lmail + AC_DEFINE(HAVE_LIBMAIL, 1, [Define to 1 if you have the `mail' library (-lmail).]) + + OLD_LIBS=$LIBS LIBS="$LIBS_MAIL $LIBS" - AC_DEFINE(HAVE_LIBMAIL, 1, [Define to 1 if you have the `mail' library (-lmail).]) + AC_CHECK_FUNCS(touchlock) + LIBS=$OLD_LIBS else LIBS_MAIL= fi @@ -3412,7 +3384,6 @@ AC_CHECK_LIB(lockfile, maillock, have_lockfile=yes, have_lockfile=no) if test $have_lockfile = yes; then LIBS_MAIL=-llockfile - LIBS="$LIBS_MAIL $LIBS" AC_DEFINE(HAVE_LIBLOCKFILE, 1, [Define to 1 if you have the `lockfile' library (-llockfile).]) else # If we have the shared liblockfile, assume we must use it for mail @@ -3477,18 +3448,19 @@ esac AC_SUBST(BLESSMAIL_TARGET) - +OLD_LIBS=$LIBS +LIBS="$LIB_MATH $LIBS" AC_CHECK_FUNCS(accept4 gethostname \ getrusage get_current_dir_name \ -lrand48 \ +lrand48 random rint \ select getpagesize setlocale \ getrlimit setrlimit shutdown getaddrinfo \ strsignal setitimer \ sendto recvfrom getsockname getpeername getifaddrs freeifaddrs \ gai_strerror getline getdelim sync \ getpwent endpwent getgrent endgrent \ -touchlock \ cfmakeraw cfsetspeed copysign __executable_start log2) +LIBS=$OLD_LIBS dnl No need to check for aligned_alloc and posix_memalign if using dnl gmalloc.o, as it supplies them. Don't use these functions on @@ -3497,17 +3469,6 @@ AC_CHECK_FUNCS([aligned_alloc posix_memalign], [break]) fi -## Eric Backus says, HP-UX 9.x on HP 700 machines -## has a broken `rint' in some library versions including math library -## version number A.09.05. -## You can fix the math library by installing patch number PHSS_4630. -## But we can fix it more reliably for Emacs by just not using rint. -## We also skip HAVE_RANDOM - see comments in src/conf_post.h. -case $opsys in - hpux*) : ;; - *) AC_CHECK_FUNCS(random rint) ;; -esac - dnl Cannot use AC_CHECK_FUNCS AC_CACHE_CHECK([for __builtin_unwind_init], emacs_cv_func___builtin_unwind_init, @@ -3724,6 +3685,7 @@ KRB4LIB= if test "${with_kerberos}" != no; then + OLD_LIBS=$LIBS AC_CHECK_LIB(com_err, com_err, have_com_err=yes, have_com_err=no) if test $have_com_err = yes; then COM_ERRLIB=-lcom_err @@ -3780,6 +3742,7 @@ [AC_CHECK_HEADERS(kerberos/krb.h)])]) fi AC_CHECK_HEADERS(com_err.h) + LIBS=$OLD_LIBS fi AC_SUBST(COM_ERRLIB) @@ -3994,7 +3957,7 @@ case $opsys in aix4-2) dnl Unfortunately without libXmu we cannot support EditRes. - if test x$ac_cv_lib_Xmu_XmuConvertStandardSelection != xyes; then + if test "x$ac_cv_search_XmuConvertStandardSelection" = xno; then AC_DEFINE(NO_EDITRES, 1) fi ;; @@ -4574,6 +4537,7 @@ # Set up the CFLAGS for real compilation, so we can substitute it. CFLAGS="$REAL_CFLAGS" CPPFLAGS="$REAL_CPPFLAGS" +LIBS="$REAL_LIBS" ## Hack to detect a buggy GCC version. if test "x$GCC" = xyes \ === modified file 'src/conf_post.h' --- src/conf_post.h 2014-03-28 16:32:54 +0000 +++ src/conf_post.h 2014-04-14 05:23:31 +0000 @@ -87,10 +87,6 @@ #ifdef HPUX #undef srandom #undef random -/* We try to avoid checking for random and rint on hpux in - configure.ac, but some other configure test might check for them as - a dependency, so to be safe we also undefine them here. - */ #undef HAVE_RANDOM #undef HAVE_RINT #endif /* HPUX */ ------------------------------------------------------------ revno: 116973 committer: Stefan Monnier branch nick: trunk timestamp: Sat 2014-04-12 15:38:06 -0400 message: * lisp/progmodes/grep.el: Use lexical-binding. (grep-expand-template): Pass explicit lexical env to `eval'. (zrgrep): Let-bind grep-find-template explicitly. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-04-12 19:30:14 +0000 +++ lisp/ChangeLog 2014-04-12 19:38:06 +0000 @@ -1,5 +1,9 @@ 2014-04-12 Stefan Monnier + * progmodes/grep.el: Use lexical-binding. + (grep-expand-template): Pass explicit lexical env to `eval'. + (zrgrep): Let-bind grep-find-template explicitly. + * emacs-lisp/cl-lib.el (current-case-table): Remove setter. * leim/quail/sisheng.el (sisheng-list): Use with-case-table. @@ -29,8 +33,8 @@ 2014-04-12 Matthias Dahl - * faces.el (make-face): Remove deprecated optional argument. The - conditional application of X resources is handled directly by + * faces.el (make-face): Remove deprecated optional argument. + The conditional application of X resources is handled directly by make-face-x-resource-internal since Emacs 24.4. (make-empty-face): Don't pass optional argument to make-face. === modified file 'lisp/progmodes/grep.el' --- lisp/progmodes/grep.el 2014-02-14 06:59:24 +0000 +++ lisp/progmodes/grep.el 2014-04-12 19:38:06 +0000 @@ -1,4 +1,4 @@ -;;; grep.el --- run `grep' and display the results +;;; grep.el --- run `grep' and display the results -*- lexical-binding:t -*- ;; Copyright (C) 1985-1987, 1993-1999, 2001-2014 Free Software ;; Foundation, Inc. @@ -805,16 +805,20 @@ (defun grep-expand-template (template &optional regexp files dir excl) "Patch grep COMMAND string replacing , , , , and ." - (let ((command template) - (cf case-fold-search) - (case-fold-search nil)) + (let* ((command template) + (env `((cf . ,case-fold-search) + (excl . ,excl) + (dir . ,dir) + (files . ,files) + (regexp . ,regexp))) + (case-fold-search nil)) (dolist (kw grep-expand-keywords command) (if (string-match (car kw) command) (setq command (replace-match (or (if (symbolp (cdr kw)) - (symbol-value (cdr kw)) - (save-match-data (eval (cdr kw)))) + (eval (cdr kw) env) + (save-match-data (eval (cdr kw) env))) "") t t command)))))) @@ -1055,7 +1059,7 @@ (setq default-directory dir))))))) ;;;###autoload -(defun zrgrep (regexp &optional files dir confirm grep-find-template) +(defun zrgrep (regexp &optional files dir confirm template) "Recursively grep for REGEXP in gzipped FILES in tree rooted at DIR. Like `rgrep' but uses `zgrep' for `grep-program', sets the default file name to `*.gz', and sets `grep-highlight-matches' to `always'." @@ -1090,10 +1094,8 @@ (list regexp files dir confirm grep-find-template))))))) ;; Set `grep-highlight-matches' to `always' ;; since `zgrep' puts filters in the grep output. - (let ((grep-highlight-matches 'always)) - ;; `rgrep' uses the dynamically bound value `grep-find-template' - ;; from the argument `grep-find-template' whose value is computed - ;; in the `interactive' spec. + (let ((grep-find-template template) + (grep-highlight-matches 'always)) (rgrep regexp files dir confirm))) ;;;###autoload