emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] scratch/gnus-cloud 2204fd1 17/61: Merge branch 'master' of


From: Teodor Zlatanov
Subject: [Emacs-diffs] scratch/gnus-cloud 2204fd1 17/61: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Date: Fri, 1 Jul 2016 17:37:52 +0000 (UTC)

branch: scratch/gnus-cloud
commit 2204fd1314116910ceb85fc71ee604e62a2ca1f0
Merge: a744c73 cc113e5
Author: Ted Zlatanov <address@hidden>
Commit: Ted Zlatanov <address@hidden>

    Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
---
 src/coding.c |   12 ++++++++----
 src/fileio.c |   16 ++++++++++++++++
 src/lread.c  |    8 ++++++--
 3 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/src/coding.c b/src/coding.c
index 804b628..29c90f0 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -6826,7 +6826,14 @@ decode_eol (struct coding_system *coding)
 
       while (pos_byte < pos_end)
        {
+         int incr;
+
          p = BYTE_POS_ADDR (pos_byte);
+         if (coding->dst_multibyte)
+           incr = BYTES_BY_CHAR_HEAD (*p);
+         else
+           incr = 1;
+
          if (*p == '\r' && p[1] == '\n')
            {
              del_range_2 (pos, pos_byte, pos + 1, pos_byte + 1, 0);
@@ -6834,10 +6841,7 @@ decode_eol (struct coding_system *coding)
              pos_end--;
            }
          pos++;
-         if (coding->dst_multibyte)
-           pos_byte += BYTES_BY_CHAR_HEAD (*p);
-         else
-           pos_byte++;
+         pos_byte += incr;
        }
       coding->produced -= n;
       coding->produced_char -= n;
diff --git a/src/fileio.c b/src/fileio.c
index facc4be..b1f9d3c 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3359,6 +3359,21 @@ restore_window_points (Lisp_Object window_markers, 
ptrdiff_t inserted,
       }
 }
 
+/* Make sure the gap is at Z_BYTE.  This is required to treat buffer
+   text as a linear C char array.  */
+static void
+maybe_move_gap (struct buffer *b)
+{
+  if (BUF_GPT_BYTE (b) != BUF_Z_BYTE (b))
+    {
+      struct buffer *cb = current_buffer;
+
+      set_buffer_internal (b);
+      move_gap_both (Z, Z_BYTE);
+      set_buffer_internal (cb);
+    }
+}
+
 /* FIXME: insert-file-contents should be split with the top-level moved to
    Elisp and only the core kept in C.  */
 
@@ -3942,6 +3957,7 @@ by calling `format-decode', which see.  */)
 
       coding_system = CODING_ID_NAME (coding.id);
       set_coding_system = true;
+      maybe_move_gap (XBUFFER (conversion_buffer));
       decoded = BUF_BEG_ADDR (XBUFFER (conversion_buffer));
       inserted = (BUF_Z_BYTE (XBUFFER (conversion_buffer))
                  - BUF_BEG_BYTE (XBUFFER (conversion_buffer)));
diff --git a/src/lread.c b/src/lread.c
index 9f804ac..5c47f78 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1204,7 +1204,11 @@ Return t if the file exists and loads successfully.  */)
   specbind (Qold_style_backquotes, Qnil);
   record_unwind_protect (load_warn_old_style_backquotes, file);
 
-  if (suffix_p (found, ".elc") || (fd >= 0 && (version = safe_to_load_version 
(fd)) > 0))
+  int is_elc;
+  if ((is_elc = suffix_p (found, ".elc")) != 0
+      /* version = 1 means the file is empty, in which case we can
+        treat it as not byte-compiled.  */
+      || (fd >= 0 && (version = safe_to_load_version (fd)) > 1))
     /* Load .elc files directly, but not when they are
        remote and have no handler!  */
     {
@@ -1231,7 +1235,7 @@ Return t if the file exists and loads successfully.  */)
           /* openp already checked for newness, no point doing it again.
              FIXME would be nice to get a message when openp
              ignores suffix order due to load_prefer_newer.  */
-          if (!load_prefer_newer)
+          if (!load_prefer_newer && is_elc)
             {
               result = stat (SSDATA (efound), &s1);
               if (result == 0)



reply via email to

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