emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r111623: Merge from emacs-24; up to r


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111623: Merge from emacs-24; up to r111206
Date: Wed, 30 Jan 2013 00:07:37 -0800
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111623 [merge]
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Wed 2013-01-30 00:07:37 -0800
message:
  Merge from emacs-24; up to r111206
modified:
  lisp/ChangeLog
  lisp/cedet/cedet.el
  lisp/cedet/inversion.el
  lisp/cedet/semantic.el
  lisp/emacs-lisp/cl.el
  lisp/imenu.el
  lisp/progmodes/python.el
  src/ChangeLog
  src/w32.c
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-01-29 20:51:07 +0000
+++ b/lisp/ChangeLog    2013-01-30 08:07:37 +0000
@@ -1,3 +1,17 @@
+2013-01-30  Glenn Morris  <address@hidden>
+
+       * imenu.el (imenu-default-create-index-function):
+       Put back a version of the infinite loop test removed 2013-01-23.
+
+2013-01-30  Fabián Ezequiel Gallina  <address@hidden>
+
+       * progmodes/python.el (python-shell-parse-command): Find
+       python-shell-interpreter with modified environment.
+
+2013-01-30  Stefan Monnier  <address@hidden>
+
+       * emacs-lisp/cl.el (cl-set-getf): Add compatibility alias.
+
 2013-01-29  Alan Mackenzie  <address@hidden>
 
        Amend to fontify /regexp/s in actions correctly.
@@ -21002,7 +21016,7 @@
        * nxml/rng-xsd.el (rng-xsd-check-pattern): Use case-sensitive
        matching (Bug#8516).
 
-2011-01-22  Jari Aalto  <address@hidden>
+2011-05-22  Jari Aalto  <address@hidden>
 
        * vc/vc-dir.el (vc-default-dir-printer): Give edited tag a
        different face (Bug#8178).

=== modified file 'lisp/cedet/cedet.el'
--- a/lisp/cedet/cedet.el       2013-01-01 09:11:05 +0000
+++ b/lisp/cedet/cedet.el       2013-01-28 00:34:22 +0000
@@ -4,7 +4,7 @@
 
 ;; Author: David Ponce <address@hidden>
 ;; Maintainer: Eric M. Ludlam  <address@hidden>
-;; Version: 1.0pre7
+;; Version: 1.1
 ;; Keywords: OO, lisp
 
 ;; This file is part of GNU Emacs.

=== modified file 'lisp/cedet/inversion.el'
--- a/lisp/cedet/inversion.el   2013-01-01 09:11:05 +0000
+++ b/lisp/cedet/inversion.el   2013-01-28 00:34:22 +0000
@@ -3,7 +3,7 @@
 ;;; Copyright (C) 2002-2003, 2005-2013 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
-;; Version: 0.2
+;; Version: 1.3
 ;; Keywords: OO, lisp
 
 ;; This file is part of GNU Emacs.

=== modified file 'lisp/cedet/semantic.el'
--- a/lisp/cedet/semantic.el    2013-01-01 09:11:05 +0000
+++ b/lisp/cedet/semantic.el    2013-01-28 00:34:22 +0000
@@ -4,7 +4,7 @@
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: syntax tools
-;; Version: 2.0
+;; Version: 2.1beta
 
 ;; This file is part of GNU Emacs.
 

=== modified file 'lisp/emacs-lisp/cl.el'
--- a/lisp/emacs-lisp/cl.el     2013-01-02 16:13:04 +0000
+++ b/lisp/emacs-lisp/cl.el     2013-01-30 08:07:37 +0000
@@ -689,6 +689,7 @@
   'cl--map-keymap-recursively "24.3")
 (define-obsolete-function-alias 'cl-map-intervals 'cl--map-intervals "24.3")
 (define-obsolete-function-alias 'cl-map-extents 'cl--map-overlays "24.3")
+(define-obsolete-function-alias 'cl-set-getf 'cl--set-getf "24.3")
 
 (defun cl-maclisp-member (item list)
   (declare (obsolete member "24.3"))

=== modified file 'lisp/imenu.el'
--- a/lisp/imenu.el     2013-01-25 04:41:39 +0000
+++ b/lisp/imenu.el     2013-01-30 08:07:37 +0000
@@ -678,11 +678,13 @@
   ;; in these major modes.  But save that change for later.
   (cond ((and imenu-prev-index-position-function
              imenu-extract-index-name-function)
-        (let ((index-alist '()) (pos (point))
+        (let ((index-alist '()) (pos -1)
               name)
           (goto-char (point-max))
           ;; Search for the function
           (while (funcall imenu-prev-index-position-function)
+             (when (= pos (point))
+               (error "Infinite loop at %s:%d: 
imenu-prev-index-position-function does not move point" (buffer-name) pos))
              (setq pos (point))
             (save-excursion
               (setq name (funcall imenu-extract-index-name-function)))

=== modified file 'lisp/progmodes/python.el'
--- a/lisp/progmodes/python.el  2013-01-25 04:41:39 +0000
+++ b/lisp/progmodes/python.el  2013-01-30 08:07:37 +0000
@@ -1664,7 +1664,11 @@
 
 (defun python-shell-parse-command ()
   "Calculate the string used to execute the inferior Python process."
-  (format "%s %s" python-shell-interpreter python-shell-interpreter-args))
+  (let ((process-environment (python-shell-calculate-process-environment))
+        (exec-path (python-shell-calculate-exec-path)))
+    (format "%s %s"
+            (executable-find python-shell-interpreter)
+            python-shell-interpreter-args)))
 
 (defun python-shell-calculate-process-environment ()
   "Calculate process environment given `python-shell-virtualenv-path'."

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-01-28 14:41:08 +0000
+++ b/src/ChangeLog     2013-01-30 08:07:37 +0000
@@ -1,3 +1,19 @@
+2013-01-30  Eli Zaretskii  <address@hidden>
+
+       * w32.c (sys_open): Zero out the flags for the new file descriptor.
+       (sys_close): Zero out the flags for the file descriptor before
+       closing it.  (Bug#13546)
+
+       * w32.c (parse_root, get_volume_info, readdir, read_unc_volume)
+       (logon_network_drive, stat_worker, symlink, chase_symlinks): Use
+       CharNextExA and CharPrevExA to iterate over file names encoded in
+       DBCS.  (Bug#13553)
+
+       * w32.c (w32_get_long_filename, init_environment, readlink):
+       Support file names encoded in DBCS codepages.
+       (readlink): Use the current file-name-coding-system, not the ANSI
+       codepage, to decode and handle targets of symlinks.
+
 2013-01-28  Eli Zaretskii  <address@hidden>
 
        * w32.c (opendir): Now accepts a 'const char *'.

=== modified file 'src/w32.c'
--- a/src/w32.c 2013-01-28 14:41:08 +0000
+++ b/src/w32.c 2013-01-30 08:07:37 +0000
@@ -37,7 +37,7 @@
 /* must include CRT headers *before* config.h */
 
 #include <config.h>
-#include <mbstring.h>  /* for _mbspbrk and _mbslwr */
+#include <mbstring.h>  /* for _mbspbrk, _mbslwr, _mbsrchr, ... */
 
 #undef access
 #undef chdir
@@ -1730,12 +1730,17 @@
   else if (IS_DIRECTORY_SEP (name[0]) && IS_DIRECTORY_SEP (name[1]))
     {
       int slashes = 2;
+      int dbcs_p = max_filename_mbslen () > 1;
+
       name += 2;
       do
         {
          if (IS_DIRECTORY_SEP (*name) && --slashes == 0)
            break;
-         name++;
+         if (dbcs_p)
+           name = CharNextExA (file_name_codepage, name, 0);
+         else
+           name++;
        }
       while ( *name );
       if (IS_DIRECTORY_SEP (name[0]))
@@ -1800,7 +1805,7 @@
   while (p != NULL && *p)
     {
       q = p;
-      p = strchr (q, '\\');
+      p = _mbschr (q, '\\');
       if (p) *p = '\0';
       len = get_long_basename (full, o, size);
       if (len > 0)
@@ -2072,16 +2077,16 @@
 
       if (!GetModuleFileName (NULL, modname, MAX_PATH))
        emacs_abort ();
-      if ((p = strrchr (modname, '\\')) == NULL)
+      if ((p = _mbsrchr (modname, '\\')) == NULL)
        emacs_abort ();
       *p = 0;
 
-      if ((p = strrchr (modname, '\\')) && xstrcasecmp (p, "\\bin") == 0)
+      if ((p = _mbsrchr (modname, '\\')) && xstrcasecmp (p, "\\bin") == 0)
        {
          char buf[SET_ENV_BUF_SIZE];
 
          *p = 0;
-         for (p = modname; *p; p++)
+         for (p = modname; *p; p = CharNext (p))
            if (*p == '\\') *p = '/';
 
          _snprintf (buf, sizeof (buf)-1, "emacs_dir=%s", modname);
@@ -2096,17 +2101,17 @@
                      || xstrcasecmp (p, "\\AMD64") == 0))
        {
          *p = 0;
-         p = strrchr (modname, '\\');
+         p = _mbsrchr (modname, '\\');
          if (p != NULL)
            {
              *p = 0;
-             p = strrchr (modname, '\\');
+             p = _mbsrchr (modname, '\\');
              if (p && xstrcasecmp (p, "\\src") == 0)
                {
                  char buf[SET_ENV_BUF_SIZE];
 
                  *p = 0;
-                 for (p = modname; *p; p++)
+                 for (p = modname; *p; p = CharNext (p))
                    if (*p == '\\') *p = '/';
 
                  _snprintf (buf, sizeof (buf)-1, "emacs_dir=%s", modname);
@@ -2641,12 +2646,23 @@
     {
       char *str = temp;
       int slashes = 4;
+      int dbcs_p = max_filename_mbslen () > 1;
+
       rootname = temp;
       do
         {
          if (IS_DIRECTORY_SEP (*name) && --slashes == 0)
            break;
-         *str++ = *name++;
+         if (!dbcs_p)
+           *str++ = *name++;
+         else
+           {
+             const char *p = name;
+
+             name = CharNextExA (file_name_codepage, name, 0);
+             memcpy (str, p, name - p);
+             str += name - p;
+           }
        }
       while ( *name );
 
@@ -2882,11 +2898,23 @@
     {
       char filename[MAXNAMLEN + 3];
       int ln;
+      int dbcs_p = max_filename_mbslen () > 1;
 
       strcpy (filename, dir_pathname);
       ln = strlen (filename) - 1;
-      if (!IS_DIRECTORY_SEP (filename[ln]))
-       strcat (filename, "\\");
+      if (!dbcs_p)
+       {
+         if (!IS_DIRECTORY_SEP (filename[ln]))
+           strcat (filename, "\\");
+       }
+      else
+       {
+         char *end = filename + ln + 1;
+         char *last_char = CharPrevExA (file_name_codepage, filename, end, 0);
+
+         if (!IS_DIRECTORY_SEP (*last_char))
+           strcat (filename, "\\");
+       }
       strcat (filename, "*");
 
       /* Note: No need to resolve symlinks in FILENAME, because
@@ -2991,6 +3019,7 @@
   DWORD bufsize = 512;
   char *buffer;
   char *ptr;
+  int dbcs_p = max_filename_mbslen () > 1;
 
   count = 1;
   buffer = alloca (bufsize);
@@ -3001,7 +3030,13 @@
   /* WNetEnumResource returns \\resource\share...skip forward to "share". */
   ptr = ((LPNETRESOURCE) buffer)->lpRemoteName;
   ptr += 2;
-  while (*ptr && !IS_DIRECTORY_SEP (*ptr)) ptr++;
+  if (!dbcs_p)
+    while (*ptr && !IS_DIRECTORY_SEP (*ptr)) ptr++;
+  else
+    {
+      while (*ptr && !IS_DIRECTORY_SEP (*ptr))
+       ptr = CharNextExA (file_name_codepage, ptr, 0);
+    }
   ptr++;
 
   strncpy (readbuf, ptr, size);
@@ -3038,9 +3073,11 @@
 {
   NETRESOURCE resource;
   char share[MAX_PATH];
-  int i, n_slashes;
+  int n_slashes;
   char drive[4];
   UINT drvtype;
+  char *p;
+  int dbcs_p;
 
   if (IS_DIRECTORY_SEP (path[0]) && IS_DIRECTORY_SEP (path[1]))
     drvtype = DRIVE_REMOTE;
@@ -3062,13 +3099,18 @@
   n_slashes = 2;
   strncpy (share, path, MAX_PATH);
   /* Truncate to just server and share name.  */
-  for (i = 2; i < MAX_PATH; i++)
+  dbcs_p = max_filename_mbslen () > 1;
+  for (p = share + 2; *p && p < share + MAX_PATH; )
     {
-      if (IS_DIRECTORY_SEP (share[i]) && ++n_slashes > 3)
+      if (IS_DIRECTORY_SEP (*p) && ++n_slashes > 3)
         {
-          share[i] = '\0';
+          *p = '\0';
           break;
         }
+      if (dbcs_p)
+       p = CharNextExA (file_name_codepage, p, 0);
+      else
+       p++;
     }
 
   resource.dwType = RESOURCETYPE_DISK;
@@ -3365,9 +3407,12 @@
      and system files. Force all file handles to be
      non-inheritable. */
   int res = _open (mpath, (oflag & ~_O_CREAT) | _O_NOINHERIT, mode);
-  if (res >= 0)
-    return res;
-  return _open (mpath, oflag | _O_NOINHERIT, mode);
+  if (res < 0)
+    res = _open (mpath, oflag | _O_NOINHERIT, mode);
+  if (res >= 0 && res < MAXDESC)
+    fd_info[res].flags = 0;
+
+  return res;
 }
 
 int
@@ -3843,6 +3888,7 @@
   DWORD access_rights = 0;
   DWORD fattrs = 0, serialnum = 0, fs_high = 0, fs_low = 0, nlinks = 1;
   FILETIME ctime, atime, wtime;
+  int dbcs_p;
 
   if (path == NULL || buf == NULL)
     {
@@ -4040,6 +4086,7 @@
         did not ask for extra precision, resolving symlinks will fly
         in the face of that request, since the user then wants the
         lightweight version of the code.  */
+      dbcs_p = max_filename_mbslen () > 1;
       rootdir = (path >= save_name + len - 1
                 && (IS_DIRECTORY_SEP (*path) || *path == 0));
 
@@ -4067,8 +4114,19 @@
        }
       else if (rootdir)
        {
-         if (!IS_DIRECTORY_SEP (name[len-1]))
-           strcat (name, "\\");
+         if (!dbcs_p)
+           {
+             if (!IS_DIRECTORY_SEP (name[len-1]))
+               strcat (name, "\\");
+           }
+         else
+           {
+             char *end = name + len;
+             char *n = CharPrevExA (file_name_codepage, name, end, 0);
+
+             if (!IS_DIRECTORY_SEP (*n))
+               strcat (name, "\\");
+           }
          if (GetDriveType (name) < 2)
            {
              errno = ENOENT;
@@ -4080,15 +4138,37 @@
        }
       else
        {
-         if (IS_DIRECTORY_SEP (name[len-1]))
-           name[len - 1] = 0;
+         if (!dbcs_p)
+           {
+             if (IS_DIRECTORY_SEP (name[len-1]))
+               name[len - 1] = 0;
+           }
+         else
+           {
+             char *end = name + len;
+             char *n = CharPrevExA (file_name_codepage, name, end, 0);
+
+             if (IS_DIRECTORY_SEP (*n))
+               *n = 0;
+           }
 
          /* (This is hacky, but helps when doing file completions on
             network drives.)  Optimize by using information available from
             active readdir if possible.  */
          len = strlen (dir_pathname);
-         if (IS_DIRECTORY_SEP (dir_pathname[len-1]))
-           len--;
+         if (!dbcs_p)
+           {
+             if (IS_DIRECTORY_SEP (dir_pathname[len-1]))
+               len--;
+           }
+         else
+           {
+             char *end = dir_pathname + len;
+             char *n = CharPrevExA (file_name_codepage, dir_pathname, end, 0);
+
+             if (IS_DIRECTORY_SEP (*n))
+               len--;
+           }
          if (dir_find_handle != INVALID_HANDLE_VALUE
              && !(is_a_symlink && follow_symlinks)
              && strnicmp (save_name, dir_pathname, len) == 0
@@ -4359,6 +4439,7 @@
   char linkfn[MAX_PATH], *tgtfn;
   DWORD flags = 0;
   int dir_access, filename_ends_in_slash;
+  int dbcs_p;
 
   /* Diagnostics follows Posix as much as possible.  */
   if (filename == NULL || linkname == NULL)
@@ -4384,6 +4465,8 @@
       return -1;
     }
 
+  dbcs_p = max_filename_mbslen () > 1;
+
   /* Note: since empty FILENAME was already rejected, we can safely
      refer to FILENAME[1].  */
   if (!(IS_DIRECTORY_SEP (filename[0]) || IS_DEVICE_SEP (filename[1])))
@@ -4398,8 +4481,21 @@
       char tem[MAX_PATH];
       char *p = linkfn + strlen (linkfn);
 
-      while (p > linkfn && !IS_ANY_SEP (p[-1]))
-       p--;
+      if (!dbcs_p)
+       {
+         while (p > linkfn && !IS_ANY_SEP (p[-1]))
+           p--;
+       }
+      else
+       {
+         char *p1 = CharPrevExA (file_name_codepage, linkfn, p, 0);
+
+         while (p > linkfn && !IS_ANY_SEP (*p1))
+           {
+             p = p1;
+             p1 = CharPrevExA (file_name_codepage, linkfn, p1, 0);
+           }
+       }
       if (p > linkfn)
        strncpy (tem, linkfn, p - linkfn);
       tem[p - linkfn] = '\0';
@@ -4414,7 +4510,15 @@
      exist, but ends in a slash, we create a symlink to directory.  If
      FILENAME exists and is a directory, we always create a symlink to
      directory.  */
-  filename_ends_in_slash = IS_DIRECTORY_SEP (filename[strlen (filename) - 1]);
+  if (!dbcs_p)
+    filename_ends_in_slash = IS_DIRECTORY_SEP (filename[strlen (filename) - 
1]);
+  else
+    {
+      const char *end = filename + strlen (filename);
+      const char *n = CharPrevExA (file_name_codepage, filename, end, 0);
+
+      filename_ends_in_slash = IS_DIRECTORY_SEP (*n);
+    }
   if (dir_access == 0 || filename_ends_in_slash)
     flags = SYMBOLIC_LINK_FLAG_DIRECTORY;
 
@@ -4604,6 +4708,8 @@
          WCHAR *lwname_src =
            reparse_data->SymbolicLinkReparseBuffer.PathBuffer
            + 
reparse_data->SymbolicLinkReparseBuffer.PrintNameOffset/sizeof(WCHAR);
+         /* This updates file_name_codepage which we need below.  */
+         int dbcs_p = max_filename_mbslen () > 1;
 
          /* According to MSDN, PrintNameLength does not include the
             terminating null character.  */
@@ -4611,9 +4717,7 @@
          memcpy (lwname, lwname_src, lwname_len);
          lwname[lwname_len/sizeof(WCHAR)] = 0; /* null-terminate */
 
-         /* FIXME: Should we use the current file-name coding system
-            instead of the fixed value of the ANSI codepage?  */
-         lname_len = WideCharToMultiByte (w32_ansi_code_page, 0, lwname, -1,
+         lname_len = WideCharToMultiByte (file_name_codepage, 0, lwname, -1,
                                           lname, MAX_PATH, NULL, NULL);
          if (!lname_len)
            {
@@ -4639,18 +4743,33 @@
          else
            {
              size_t size_to_copy = buf_size;
-             BYTE *p = lname;
+             BYTE *p = lname, *p2;
              BYTE *pend = p + lname_len;
 
              /* Normalize like dostounix_filename does, but we don't
                 want to assume that lname is null-terminated.  */
-             if (*p && p[1] == ':' && *p >= 'A' && *p <= 'Z')
-               *p += 'a' - 'A';
+             if (dbcs_p)
+               p2 = CharNextExA (file_name_codepage, p, 0);
+             else
+               p2 = p + 1;
+             if (*p && *p2 == ':' && *p >= 'A' && *p <= 'Z')
+               {
+                 *p += 'a' - 'A';
+                 p += 2;
+               }
              while (p <= pend)
                {
                  if (*p == '\\')
                    *p = '/';
-                 ++p;
+                 if (dbcs_p)
+                   {
+                     p = CharNextExA (file_name_codepage, p, 0);
+                     /* CharNextExA doesn't advance at null character.  */
+                     if (!*p)
+                       break;
+                   }
+                 else
+                   ++p;
                }
              /* Testing for null-terminated LNAME is paranoia:
                 WideCharToMultiByte should always return a
@@ -4724,6 +4843,7 @@
   char link[MAX_PATH];
   ssize_t res, link_len;
   int loop_count = 0;
+  int dbcs_p;
 
   if (is_windows_9x () == TRUE || !is_symlink (file))
     return (char *)file;
@@ -4731,13 +4851,27 @@
   if ((link_len = GetFullPathName (file, MAX_PATH, link, NULL)) == 0)
     return (char *)file;
 
+  dbcs_p = max_filename_mbslen () > 1;
   target[0] = '\0';
   do {
 
     /* Remove trailing slashes, as we want to resolve the last
        non-trivial part of the link name.  */
-    while (link_len > 3 && IS_DIRECTORY_SEP (link[link_len-1]))
-      link[link_len--] = '\0';
+    if (!dbcs_p)
+      {
+       while (link_len > 3 && IS_DIRECTORY_SEP (link[link_len-1]))
+         link[link_len--] = '\0';
+      }
+    else if (link_len > 3)
+      {
+       char *n = CharPrevExA (file_name_codepage, link, link + link_len, 0);
+
+       while (n >= link + 2 && IS_DIRECTORY_SEP (*n))
+         {
+           n[1] = '\0';
+           n = CharPrevExA (file_name_codepage, link, n, 0);
+         }
+      }
 
     res = readlink (link, target, MAX_PATH);
     if (res > 0)
@@ -4750,8 +4884,21 @@
               the symlink, then copy the result back to target.  */
            char *p = link + link_len;
 
-           while (p > link && !IS_ANY_SEP (p[-1]))
-             p--;
+           if (!dbcs_p)
+             {
+               while (p > link && !IS_ANY_SEP (p[-1]))
+                 p--;
+             }
+           else
+             {
+               char *p1 = CharPrevExA (file_name_codepage, link, p, 0);
+
+               while (p > link && !IS_ANY_SEP (*p1))
+                 {
+                   p = p1;
+                   p1 = CharPrevExA (file_name_codepage, link, p1, 0);
+                 }
+             }
            strcpy (p, target);
            strcpy (target, link);
          }
@@ -6543,15 +6690,15 @@
        }
     }
 
+  if (fd >= 0 && fd < MAXDESC)
+    fd_info[fd].flags = 0;
+
   /* Note that sockets do not need special treatment here (at least on
      NT and Windows 95 using the standard tcp/ip stacks) - it appears that
      closesocket is equivalent to CloseHandle, which is to be expected
      because socket handles are fully fledged kernel handles. */
   rc = _close (fd);
 
-  if (rc == 0 && fd < MAXDESC)
-    fd_info[fd].flags = 0;
-
   return rc;
 }
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]