Using saved parent location: http://bzr.savannah.gnu.org/r/emacs/trunk/ Now on revision 103418. ------------------------------------------------------------ revno: 103418 committer: Paul Eggert branch nick: trunk timestamp: Thu 2011-02-24 23:23:41 -0800 message: Regenerate. diff: === modified file 'ChangeLog' --- ChangeLog 2011-02-24 04:28:17 +0000 +++ ChangeLog 2011-02-25 07:23:41 +0000 @@ -1,3 +1,8 @@ +2011-02-25 Paul Eggert + + * configure, lib/Makefile.in, lib/getopt_int.h, lib/gnulib.mk: + * lib/stdlib.in.h, m4/stdlib_h.m4: Regenerate. + 2011-02-24 Glenn Morris * configure.in: Replace obsolete AC_OUTPUT() with AC_CONFIG_FILES(), === modified file 'configure' --- configure 2011-02-22 01:55:20 +0000 +++ configure 2011-02-25 07:23:41 +0000 @@ -874,6 +874,7 @@ GNULIB_CLOSE GNULIB_CHOWN GETLOADAVG_LIBS +REPLACE_WCTOMB REPLACE_UNSETENV REPLACE_STRTOD REPLACE_SETENV @@ -881,6 +882,7 @@ REPLACE_REALLOC REPLACE_PUTENV REPLACE_MKSTEMP +REPLACE_MBTOWC REPLACE_MALLOC REPLACE_CANONICALIZE_FILE_NAME REPLACE_CALLOC @@ -909,6 +911,7 @@ HAVE_CANONICALIZE_FILE_NAME HAVE_ATOLL HAVE__EXIT +GNULIB_WCTOMB GNULIB_UNSETENV GNULIB_UNLOCKPT GNULIB_SYSTEM_POSIX @@ -927,6 +930,7 @@ GNULIB_MKOSTEMPS GNULIB_MKOSTEMP GNULIB_MKDTEMP +GNULIB_MBTOWC GNULIB_MALLOC_POSIX GNULIB_GRANTPT GNULIB_GETSUBOPT @@ -13780,6 +13784,7 @@ GNULIB_GETSUBOPT=0; GNULIB_GRANTPT=0; GNULIB_MALLOC_POSIX=0; + GNULIB_MBTOWC=0; GNULIB_MKDTEMP=0; GNULIB_MKOSTEMP=0; GNULIB_MKOSTEMPS=0; @@ -13798,6 +13803,7 @@ GNULIB_SYSTEM_POSIX=0; GNULIB_UNLOCKPT=0; GNULIB_UNSETENV=0; + GNULIB_WCTOMB=0; HAVE__EXIT=1; HAVE_ATOLL=1; HAVE_CANONICALIZE_FILE_NAME=1; @@ -13826,6 +13832,7 @@ REPLACE_CALLOC=0; REPLACE_CANONICALIZE_FILE_NAME=0; REPLACE_MALLOC=0; + REPLACE_MBTOWC=0; REPLACE_MKSTEMP=0; REPLACE_PUTENV=0; REPLACE_REALLOC=0; @@ -13833,6 +13840,7 @@ REPLACE_SETENV=0; REPLACE_STRTOD=0; REPLACE_UNSETENV=0; + REPLACE_WCTOMB=0; GNULIB_CHOWN=0; @@ -19249,7 +19257,15 @@ ac_config_files="$ac_config_files Makefile lib/Makefile lib-src/Makefile oldXMenu/Makefile doc/emacs/Makefile doc/misc/Makefile doc/lispintro/Makefile doc/lispref/Makefile src/Makefile lwlib/Makefile lisp/Makefile leim/Makefile test/automated/Makefile" -ac_config_commands="$ac_config_commands default" + +ac_config_commands="$ac_config_commands mkdirs" + + +ac_config_commands="$ac_config_commands epaths" + + +ac_config_commands="$ac_config_commands gdbinit" + cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -20034,7 +20050,9 @@ "lisp/Makefile") CONFIG_FILES="$CONFIG_FILES lisp/Makefile" ;; "leim/Makefile") CONFIG_FILES="$CONFIG_FILES leim/Makefile" ;; "test/automated/Makefile") CONFIG_FILES="$CONFIG_FILES test/automated/Makefile" ;; - "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; + "mkdirs") CONFIG_COMMANDS="$CONFIG_COMMANDS mkdirs" ;; + "epaths") CONFIG_COMMANDS="$CONFIG_COMMANDS epaths" ;; + "gdbinit") CONFIG_COMMANDS="$CONFIG_COMMANDS gdbinit" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac @@ -20764,21 +20782,20 @@ done } ;; - "default":C) - -### Make the necessary directories, if they don't exist. + "mkdirs":C) for dir in etc lisp ; do test -d ${dir} || mkdir ${dir} done - + ;; + "epaths":C) echo creating src/epaths.h ${MAKE-make} epaths-force - + ;; + "gdbinit":C) if test ! -f src/.gdbinit && test -f $srcdir/src/.gdbinit; then echo creating src/.gdbinit echo source $srcdir/src/.gdbinit > src/.gdbinit fi - ;; esac @@ -20818,3 +20835,4 @@ $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi + === modified file 'lib/Makefile.in' --- lib/Makefile.in 2011-02-22 01:55:20 +0000 +++ lib/Makefile.in 2011-02-25 07:23:41 +0000 @@ -179,6 +179,7 @@ GNULIB_LSEEK = @GNULIB_LSEEK@ GNULIB_LSTAT = @GNULIB_LSTAT@ GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@ +GNULIB_MBTOWC = @GNULIB_MBTOWC@ GNULIB_MKDIRAT = @GNULIB_MKDIRAT@ GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ GNULIB_MKFIFO = @GNULIB_MKFIFO@ @@ -225,6 +226,7 @@ GNULIB_UNSETENV = @GNULIB_UNSETENV@ GNULIB_USLEEP = @GNULIB_USLEEP@ GNULIB_UTIMENSAT = @GNULIB_UTIMENSAT@ +GNULIB_WCTOMB = @GNULIB_WCTOMB@ GNULIB_WRITE = @GNULIB_WRITE@ GNULIB__EXIT = @GNULIB__EXIT@ GNU_OBJC_CFLAGS = @GNU_OBJC_CFLAGS@ @@ -452,6 +454,7 @@ REPLACE_LSEEK = @REPLACE_LSEEK@ REPLACE_LSTAT = @REPLACE_LSTAT@ REPLACE_MALLOC = @REPLACE_MALLOC@ +REPLACE_MBTOWC = @REPLACE_MBTOWC@ REPLACE_MKDIR = @REPLACE_MKDIR@ REPLACE_MKFIFO = @REPLACE_MKFIFO@ REPLACE_MKNOD = @REPLACE_MKNOD@ @@ -478,6 +481,7 @@ REPLACE_UNSETENV = @REPLACE_UNSETENV@ REPLACE_USLEEP = @REPLACE_USLEEP@ REPLACE_UTIMENSAT = @REPLACE_UTIMENSAT@ +REPLACE_WCTOMB = @REPLACE_WCTOMB@ REPLACE_WRITE = @REPLACE_WRITE@ RSVG_CFLAGS = @RSVG_CFLAGS@ RSVG_LIBS = @RSVG_LIBS@ @@ -1001,6 +1005,7 @@ -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \ -e 's|@''GNULIB_GRANTPT''@|$(GNULIB_GRANTPT)|g' \ -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \ + -e 's|@''GNULIB_MBTOWC''@|$(GNULIB_MBTOWC)|g' \ -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \ -e 's|@''GNULIB_MKOSTEMP''@|$(GNULIB_MKOSTEMP)|g' \ -e 's|@''GNULIB_MKOSTEMPS''@|$(GNULIB_MKOSTEMPS)|g' \ @@ -1019,6 +1024,7 @@ -e 's|@''GNULIB_SYSTEM_POSIX''@|$(GNULIB_SYSTEM_POSIX)|g' \ -e 's|@''GNULIB_UNLOCKPT''@|$(GNULIB_UNLOCKPT)|g' \ -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \ + -e 's|@''GNULIB_WCTOMB''@|$(GNULIB_WCTOMB)|g' \ < $(srcdir)/stdlib.in.h | \ sed -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \ -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \ @@ -1047,6 +1053,7 @@ -e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \ -e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \ -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \ + -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \ -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \ @@ -1054,6 +1061,7 @@ -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \ -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \ -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \ + -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ === modified file 'lib/getopt_int.h' --- lib/getopt_int.h 2011-01-09 07:33:50 +0000 +++ lib/getopt_int.h 2011-02-25 07:23:41 +0000 @@ -108,7 +108,7 @@ #if defined _LIBC && defined USE_NONOPTION_FLAGS int __nonoption_flags_max_len; int __nonoption_flags_len; -# endif +#endif }; /* The initializer is necessary to set OPTIND and OPTERR to their === modified file 'lib/gnulib.mk' --- lib/gnulib.mk 2011-02-22 01:55:20 +0000 +++ lib/gnulib.mk 2011-02-25 07:23:41 +0000 @@ -267,6 +267,7 @@ -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \ -e 's|@''GNULIB_GRANTPT''@|$(GNULIB_GRANTPT)|g' \ -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \ + -e 's|@''GNULIB_MBTOWC''@|$(GNULIB_MBTOWC)|g' \ -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \ -e 's|@''GNULIB_MKOSTEMP''@|$(GNULIB_MKOSTEMP)|g' \ -e 's|@''GNULIB_MKOSTEMPS''@|$(GNULIB_MKOSTEMPS)|g' \ @@ -285,6 +286,7 @@ -e 's|@''GNULIB_SYSTEM_POSIX''@|$(GNULIB_SYSTEM_POSIX)|g' \ -e 's|@''GNULIB_UNLOCKPT''@|$(GNULIB_UNLOCKPT)|g' \ -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \ + -e 's|@''GNULIB_WCTOMB''@|$(GNULIB_WCTOMB)|g' \ < $(srcdir)/stdlib.in.h | \ sed -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \ -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \ @@ -313,6 +315,7 @@ -e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \ -e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \ -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \ + -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \ -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \ @@ -320,6 +323,7 @@ -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \ -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \ -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \ + -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ === modified file 'lib/stdlib.in.h' --- lib/stdlib.in.h 2011-02-16 00:33:44 +0000 +++ lib/stdlib.in.h 2011-02-25 07:23:41 +0000 @@ -274,6 +274,21 @@ "use gnulib module malloc-posix for portability"); #endif +/* Convert a multibyte character to a wide character. */ +#if @GNULIB_MBTOWC@ +# if @REPLACE_MBTOWC@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef mbtowc +# define mbtowc rpl_mbtowc +# endif +_GL_FUNCDECL_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); +_GL_CXXALIAS_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); +# else +_GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); +# endif +_GL_CXXALIASWARN (mbtowc); +#endif + #if @GNULIB_MKDTEMP@ /* Create a unique temporary directory from TEMPLATE. The last six characters of TEMPLATE must be "XXXXXX"; @@ -723,6 +738,21 @@ # endif #endif +/* Convert a wide character to a multibyte character. */ +#if @GNULIB_WCTOMB@ +# if @REPLACE_WCTOMB@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef wctomb +# define wctomb rpl_wctomb +# endif +_GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc)); +_GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc)); +# else +_GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc)); +# endif +_GL_CXXALIASWARN (wctomb); +#endif + #endif /* _GL_STDLIB_H */ #endif /* _GL_STDLIB_H */ === modified file 'm4/stdlib_h.m4' --- m4/stdlib_h.m4 2011-02-16 00:33:44 +0000 +++ m4/stdlib_h.m4 2011-02-25 07:23:41 +0000 @@ -1,4 +1,4 @@ -# stdlib_h.m4 serial 36 +# stdlib_h.m4 serial 37 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -44,6 +44,7 @@ GNULIB_GETSUBOPT=0; AC_SUBST([GNULIB_GETSUBOPT]) GNULIB_GRANTPT=0; AC_SUBST([GNULIB_GRANTPT]) GNULIB_MALLOC_POSIX=0; AC_SUBST([GNULIB_MALLOC_POSIX]) + GNULIB_MBTOWC=0; AC_SUBST([GNULIB_MBTOWC]) GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP]) GNULIB_MKOSTEMP=0; AC_SUBST([GNULIB_MKOSTEMP]) GNULIB_MKOSTEMPS=0; AC_SUBST([GNULIB_MKOSTEMPS]) @@ -62,6 +63,7 @@ GNULIB_SYSTEM_POSIX=0; AC_SUBST([GNULIB_SYSTEM_POSIX]) GNULIB_UNLOCKPT=0; AC_SUBST([GNULIB_UNLOCKPT]) GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV]) + GNULIB_WCTOMB=0; AC_SUBST([GNULIB_WCTOMB]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE__EXIT=1; AC_SUBST([HAVE__EXIT]) HAVE_ATOLL=1; AC_SUBST([HAVE_ATOLL]) @@ -91,6 +93,7 @@ REPLACE_CALLOC=0; AC_SUBST([REPLACE_CALLOC]) REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME]) REPLACE_MALLOC=0; AC_SUBST([REPLACE_MALLOC]) + REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC]) REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) REPLACE_REALLOC=0; AC_SUBST([REPLACE_REALLOC]) @@ -98,4 +101,5 @@ REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV]) REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD]) REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV]) + REPLACE_WCTOMB=0; AC_SUBST([REPLACE_WCTOMB]) ]) ------------------------------------------------------------ revno: 103417 committer: Paul Eggert branch nick: trunk timestamp: Thu 2011-02-24 22:30:50 -0800 message: * dired.c (Ffile_attributes): Increase size of modes from 10 to 12 diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2011-02-23 20:41:43 +0000 +++ src/ChangeLog 2011-02-25 06:30:50 +0000 @@ -1,3 +1,9 @@ +2011-02-25 Paul Eggert + + * dired.c (Ffile_attributes): Increase size of modes from 10 to 12 + as per recent filemodestring API change. Reported by Jonas Ă–ster in + . + 2011-02-23 Ben Key (tiny change) * nsterm.m (ns_draw_window_cursor): Obey the cursor_width argument === modified file 'src/dired.c' --- src/dired.c 2011-02-22 18:32:51 +0000 +++ src/dired.c 2011-02-25 06:30:50 +0000 @@ -937,7 +937,7 @@ Lisp_Object dirname; struct stat sdir; #endif /* BSD4_2 */ - char modes[10]; + char modes[12]; Lisp_Object handler; struct gcpro gcpro1; char *uname = NULL, *gname = NULL; ------------------------------------------------------------ revno: 103416 committer: Glenn Morris branch nick: trunk timestamp: Thu 2011-02-24 00:45:25 -0800 message: Yet more directory-local variables fixes. * lisp/files-x.el (modify-dir-local-variable): Handle dir-locals from the cache, and from non-file sources. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-02-24 08:26:25 +0000 +++ lisp/ChangeLog 2011-02-24 08:45:25 +0000 @@ -1,5 +1,8 @@ 2011-02-24 Glenn Morris + * files-x.el (modify-dir-local-variable): Handle dir-locals from + the cache, and from non-file sources. + * help-fns.el (describe-variable): Return consistent results when a dir-local from a file came from the cache or did not. (Bug#8095) If a dir-local has no associated file, say it came from a "directory". === modified file 'lisp/files-x.el' --- lisp/files-x.el 2011-01-25 04:08:28 +0000 +++ lisp/files-x.el 2011-02-24 08:45:25 +0000 @@ -360,18 +360,28 @@ (catch 'exit (unless enable-local-variables (throw 'exit (message "Directory-local variables are disabled"))) - (let ((variables-file (or (and (buffer-file-name) (not (file-remote-p (buffer-file-name))) (dir-locals-find-file (buffer-file-name))) dir-locals-file)) variables) - + (if (consp variables-file) ; result from cache + ;; If cache element has an mtime, assume it came from a file. + ;; Otherwise, assume it was set directly. + (setq variables-file (if (nth 2 variables-file) + (expand-file-name dir-locals-file + (car variables-file)) + (cadr variables-file)))) + ;; I can't be bothered to handle this case right now. + ;; Dir locals were set directly from a class. You need to + ;; directly modify the class in dir-locals-class-alist. + (and variables-file (not (stringp variables-file)) + (throw 'exit (message "Directory locals were not set from a file"))) ;; Don't create ".dir-locals.el" for the deletion operation. - (when (and (eq op 'delete) - (not (file-exists-p variables-file))) - (throw 'exit (message "File .dir-locals.el not found"))) - + (and (eq op 'delete) + (or (not variables-file) + (not (file-exists-p variables-file))) + (throw 'exit (message "No .dir-locals.el file was found"))) (let ((auto-insert nil)) (find-file variables-file)) (widen) ------------------------------------------------------------ revno: 103415 committer: Glenn Morris branch nick: trunk timestamp: Thu 2011-02-24 00:26:25 -0800 message: Fix for another bit of bug#8095, re dir-locals. * lisp/help-fns.el (describe-variable): Return consistent results when a dir-local from a file came from the cache or did not. If a dir-local has no associated file, say it came from a "directory". diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-02-24 08:02:45 +0000 +++ lisp/ChangeLog 2011-02-24 08:26:25 +0000 @@ -1,11 +1,15 @@ 2011-02-24 Glenn Morris + * help-fns.el (describe-variable): Return consistent results when a + dir-local from a file came from the cache or did not. (Bug#8095) + If a dir-local has no associated file, say it came from a "directory". + * files.el (hack-dir-local-variables): Fix setting of `dir-name'. (hack-local-variables-confirm, hack-local-variables-filter): Doc fix. * files.el (dir-locals-find-file): Doc fix. Fix the check for cache elements that have no associated file, - and the mtime check for those that do. + and the mtime check for those that do. (Bug#8095) * dired-x.el (dired-hack-local-variables): Handle interrupts during hacking local variables. (Bug#5216) === modified file 'lisp/help-fns.el' --- lisp/help-fns.el 2011-02-22 18:22:04 +0000 +++ lisp/help-fns.el 2011-02-24 08:26:25 +0000 @@ -748,15 +748,21 @@ (setq extra-line t) (if (member (cons variable val) dir-local-variables-alist) (let ((file (and (buffer-file-name) - (not (file-remote-p (buffer-file-name))) - (dir-locals-find-file (buffer-file-name))))) + (not (file-remote-p (buffer-file-name))) + (dir-locals-find-file + (buffer-file-name)))) + (type "file")) (princ " This variable is a directory local variable") (when file - (princ (concat "\n from the file \"" - (if (consp file) - (car file) - file) - "\""))) + (if (consp file) ; result from cache + ;; If the cache element has an mtime, we + ;; assume it came from a file. + (if (nth 2 file) + (setq file (expand-file-name + dir-locals-file (car file))) + ;; Otherwise, assume it was set directly. + (setq type "directory"))) + (princ (format "\n from the %s \"%s\"" type file))) (princ ".\n")) (princ " This variable is a file local variable.\n"))) ------------------------------------------------------------ revno: 103414 committer: Glenn Morris branch nick: trunk timestamp: Thu 2011-02-24 00:02:45 -0800 message: More dir-locals fixes for files.el. * lisp/files.el (hack-local-variables-confirm, hack-local-variables-filter): Doc fix (say _which_ directory `dir-name' is). (hack-dir-local-variables): Fix setting of `dir-name'. Previous value seems clearly wrong. Eg put a risky variable in a dir-locals file, visit a file in a subdirectory, see which directory it says the risky variables come from. It should be the one with the associated directory variables, not the one containing the visited file. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-02-24 07:47:06 +0000 +++ lisp/ChangeLog 2011-02-24 08:02:45 +0000 @@ -1,5 +1,8 @@ 2011-02-24 Glenn Morris + * files.el (hack-dir-local-variables): Fix setting of `dir-name'. + (hack-local-variables-confirm, hack-local-variables-filter): Doc fix. + * files.el (dir-locals-find-file): Doc fix. Fix the check for cache elements that have no associated file, and the mtime check for those that do. === modified file 'lisp/files.el' --- lisp/files.el 2011-02-24 07:47:06 +0000 +++ lisp/files.el 2011-02-24 08:02:45 +0000 @@ -2919,8 +2919,8 @@ ALL-VARS is the list of all variables to be set up. UNSAFE-VARS is the list of those that aren't marked as safe or risky. RISKY-VARS is the list of those that are marked as risky. -DIR-NAME is a directory name if these settings come from -directory-local variables, or nil otherwise." +If these settings come from directory-local variables, then +DIR-NAME is the name of the associated directory. Otherwise it is nil." (if noninteractive nil (save-window-excursion @@ -3062,8 +3062,8 @@ `enable-local-eval', `enable-local-variables', and (if necessary) user interaction. The results are added to `file-local-variables-alist', without applying them. -DIR-NAME is a directory name if these settings come from - directory-local variables, or nil otherwise." +If these settings come from directory-local variables, then +DIR-NAME is the name of the associated directory. Otherwise it is nil." ;; Find those variables that we may want to save to ;; `safe-local-variable-values'. (let (all-vars risky-vars unsafe-vars) @@ -3547,11 +3547,8 @@ (dir-name nil)) (cond ((stringp variables-file) - ;; FIXME seems like the wrong dir-name. - (setq dir-name (if (buffer-file-name) - (file-name-directory (buffer-file-name)) - default-directory)) - (setq class (dir-locals-read-from-file variables-file))) + (setq dir-name (file-name-directory variables-file) + class (dir-locals-read-from-file variables-file))) ((consp variables-file) (setq dir-name (nth 0 variables-file)) (setq class (nth 1 variables-file)))) ------------------------------------------------------------ revno: 103413 committer: Glenn Morris branch nick: trunk timestamp: Wed 2011-02-23 23:47:06 -0800 message: Partial fix for bug#8095. * lisp/files.el (dir-locals-find-file): Doc fix. Fix the check for cache elements that have no associated file, and the mtime check for those that do. Still to do: some places that use dir-locals-find-file assume the result is always a file, which is not true. (The function name is misleading.) diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-02-24 03:59:04 +0000 +++ lisp/ChangeLog 2011-02-24 07:47:06 +0000 @@ -1,5 +1,9 @@ 2011-02-24 Glenn Morris + * files.el (dir-locals-find-file): Doc fix. + Fix the check for cache elements that have no associated file, + and the mtime check for those that do. + * dired-x.el (dired-hack-local-variables): Handle interrupts during hacking local variables. (Bug#5216) === modified file 'lisp/files.el' --- lisp/files.el 2011-02-23 03:24:23 +0000 +++ lisp/files.el 2011-02-24 07:47:06 +0000 @@ -3347,11 +3347,11 @@ DIR is the name of the directory. CLASS is the name of a variable class (a symbol). MTIME is the recorded modification time of the directory-local - variables file associated with this entry. This time is a list - of two integers (the same format as `file-attributes'), and is - used to test whether the cache entry is still valid. - Alternatively, MTIME can be nil, which means the entry is always - considered valid.") +variables file associated with this entry. This time is a list +of two integers (the same format as `file-attributes'), and is +used to test whether the cache entry is still valid. +Alternatively, MTIME can be nil, which means the entry is always +considered valid.") (defsubst dir-locals-get-class-variables (class) "Return the variable list for CLASS." @@ -3460,13 +3460,20 @@ (defun dir-locals-find-file (file) "Find the directory-local variables for FILE. This searches upward in the directory tree from FILE. -If the directory root of FILE has been registered in - `dir-locals-directory-cache' and the directory-local variables - file has not been modified, return the matching entry in - `dir-locals-directory-cache'. -Otherwise, if a directory-local variables file is found, return - the file name. -Otherwise, return nil." +It stops at the first directory that has been registered in +`dir-locals-directory-cache' or contains a `dir-locals-file'. +If it finds an entry in the cache, it checks that it is valid. +A cache entry with no modification time element (normally, one that +has been assigned directly using `dir-locals-set-directory-class', not +set from a file) is always valid. +A cache entry based on a `dir-locals-file' is valid if the modification +time stored in the cache matches the current file modification time. +If not, the cache entry is cleared so that the file will be re-read. + +This function returns either nil (no directory local variables found), +or the matching entry from `dir-locals-directory-cache' (a list), +or the full path to the `dir-locals-file' (a string) in the case +of no valid cache entry." (setq file (expand-file-name file)) (let* ((dir-locals-file-name (if (eq system-type 'ms-dos) @@ -3475,8 +3482,8 @@ (locals-file (locate-dominating-file file dir-locals-file-name)) (dir-elt nil)) ;; `locate-dominating-file' may have abbreviated the name. - (when locals-file - (setq locals-file (expand-file-name dir-locals-file-name locals-file))) + (if locals-file + (setq locals-file (expand-file-name dir-locals-file-name locals-file))) ;; Find the best cached value in `dir-locals-directory-cache'. (dolist (elt dir-locals-directory-cache) (when (and (eq t (compare-strings file nil (length (car elt)) @@ -3485,23 +3492,32 @@ '(windows-nt cygwin ms-dos)))) (> (length (car elt)) (length (car dir-elt)))) (setq dir-elt elt))) - (let ((use-cache (and dir-elt - (or (null locals-file) - (<= (length (file-name-directory locals-file)) - (length (car dir-elt))))))) - (if use-cache - ;; Check the validity of the cache. - (if (and (file-readable-p (car dir-elt)) - (or (null (nth 2 dir-elt)) + (if (and dir-elt + (or (null locals-file) + (<= (length (file-name-directory locals-file)) + (length (car dir-elt))))) + ;; Found a potential cache entry. Check validity. + ;; A cache entry with no MTIME is assumed to always be valid + ;; (ie, set directly, not from a dir-locals file). + ;; Note, we don't bother to check that there is a matching class + ;; element in dir-locals-class-alist, since that's done by + ;; dir-locals-set-directory-class. + (if (or (null (nth 2 dir-elt)) + (let ((cached-file (expand-file-name dir-locals-file-name + (car dir-elt)))) + (and (file-readable-p cached-file) (equal (nth 2 dir-elt) - (nth 5 (file-attributes (car dir-elt)))))) - ;; This cache entry is OK. - dir-elt - ;; This cache entry is invalid; clear it. - (setq dir-locals-directory-cache - (delq dir-elt dir-locals-directory-cache)) - locals-file) - locals-file)))) + (nth 5 (file-attributes cached-file)))))) + ;; This cache entry is OK. + dir-elt + ;; This cache entry is invalid; clear it. + (setq dir-locals-directory-cache + (delq dir-elt dir-locals-directory-cache)) + ;; Return the first existing dir-locals file. Might be the same + ;; as dir-elt's, might not (eg latter might have been deleted). + locals-file) + ;; No cache entry. + locals-file))) (defun dir-locals-read-from-file (file) "Load a variables FILE and register a new class and instance. @@ -3531,6 +3547,7 @@ (dir-name nil)) (cond ((stringp variables-file) + ;; FIXME seems like the wrong dir-name. (setq dir-name (if (buffer-file-name) (file-name-directory (buffer-file-name)) default-directory))