Add :risky and :safe options to defcustom
                
            
            
                11 years, 9 months
            
            
                
                    
                     
                    
                    
                    Michael Sperber
                
 
                
                    
                        
                            
This is a synch from GNU Emacs, used by some 3rd-party Elisp code.  Will
push Wednesday if nobody objects.
-- 
Regards,
Mike
diff --git a/lisp/custom.el b/lisp/custom.el
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -178,6 +178,10 @@
 		 (put symbol 'custom-get value))
 		((eq keyword :require)
 		 (push value requests))
+		((eq keyword :risky)
+		 (put symbol 'risky-local-variable value))
+		((eq keyword :safe)
+		 (put symbol 'safe-local-variable value))
 		((eq keyword :type)
 		 (put symbol 'custom-type value))
 		((eq keyword :options)
@@ -264,6 +268,8 @@
 	VALUE should be a feature symbol.  If you save a value
 	for this option, then when your custom init file loads the value,
 	it does (require VALUE) first.
+:risky  Set SYMBOL's `risky-local-variable' property to VALUE.
+:safe   Set SYMBOL's `safe-local-variable' property to VALUE.
 :version
         VALUE should be a string specifying that the variable was
         first introduced, or its default value was changed, in Emacs
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
                        
                     
                    
                 
             
         
        
        
            
        
        
            
                
                    
                    
                    [COMMIT] Correct buffered_bytecount_to_charcount() on non-Mule.
                
            
            
                11 years, 9 months
            
            
                
                    
                     
                    
                    
                    Aidan Kehoe
                
 
                
                    
                        
                            
APPROVE COMMIT
NOTE: This patch has been committed.
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1390489396 0
# Node ID 6355de501637068fe0e77e23640d3763708b285f
# Parent  7343a186a4757d2053e550dcb9299fd446970487
Correct buffered_bytecount_to_charcount() on non-Mule.
src/ChangeLog addition:
[...]
	* text.h (buffered_bytecount_to_charcount): This was
	declared wrong for non-mule, correct this. Thank you Mats Lidell
	and the buildbot.
diff -r 7343a186a475 -r 6355de501637 src/ChangeLog
--- a/src/ChangeLog	Thu Jan 23 13:49:40 2014 +0000
+++ b/src/ChangeLog	Thu Jan 23 15:03:16 2014 +0000
@@ -1,5 +1,9 @@
 2014-01-23  Aidan Kehoe  <kehoea(a)parhasard.net>
 
+	* text.h (buffered_bytecount_to_charcount): This was
+	declared wrong for non-mule, correct this. Thank you Mats Lidell
+	and the buildbot.
+
 	* lstream.c (Lstream_read_1):
 	Don't include the unread partial character in
 	unget_character_count, since our consumers will never be aware of it.
diff -r 7343a186a475 -r 6355de501637 src/text.h
--- a/src/text.h	Thu Jan 23 13:49:40 2014 +0000
+++ b/src/text.h	Thu Jan 23 15:03:16 2014 +0000
@@ -922,7 +922,7 @@
 #define charcount_to_bytecount_fmt(ptr, len, fmt) ((Bytecount) (len))
 #define skip_ascii(ptr, end) end
 #define skip_ascii_down(ptr, end) end
-#define buffered_bytecount_to_charcount (ptr, len) (len)
+#define buffered_bytecount_to_charcount(ptr, len) (len)
 
 #endif /* MULE */
 
-- 
‘Liston operated so fast that he once accidentally amputated an assistant’s 
fingers along with a patient’s leg, […] The patient and the assistant both 
died of sepsis, and a spectator reportedly died of shock, resulting in the 
only known procedure with a 300% mortality.’ (Atul Gawande, NEJM, 2012)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
                        
                     
                    
                 
             
         
        
        
            
        
        
            
                
                    
                    
                    commit/XEmacs: kehoea: Correct buffered_bytecount_to_charcount() on non-Mule.
                
            
            
                11 years, 9 months
            
            
                
                    
                     
                    
                    
                    Bitbucket
                
 
                
                    
                        
                            1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/6355de501637/
Changeset:   6355de501637
User:        kehoea
Date:        2014-01-23 16:03:16
Summary:     Correct buffered_bytecount_to_charcount() on non-Mule.
src/ChangeLog addition:
[...]
	* text.h (buffered_bytecount_to_charcount): This was
	declared wrong for non-mule, correct this. Thank you Mats Lidell
	and the buildbot.
Affected #:  2 files
diff -r 7343a186a4757d2053e550dcb9299fd446970487 -r 6355de501637068fe0e77e23640d3763708b285f src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,9 @@
 2014-01-23  Aidan Kehoe  <kehoea(a)parhasard.net>
 
+	* text.h (buffered_bytecount_to_charcount): This was
+	declared wrong for non-mule, correct this. Thank you Mats Lidell
+	and the buildbot.
+
 	* lstream.c (Lstream_read_1):
 	Don't include the unread partial character in
 	unget_character_count, since our consumers will never be aware of it.
diff -r 7343a186a4757d2053e550dcb9299fd446970487 -r 6355de501637068fe0e77e23640d3763708b285f src/text.h
--- a/src/text.h
+++ b/src/text.h
@@ -922,7 +922,7 @@
 #define charcount_to_bytecount_fmt(ptr, len, fmt) ((Bytecount) (len))
 #define skip_ascii(ptr, end) end
 #define skip_ascii_down(ptr, end) end
-#define buffered_bytecount_to_charcount (ptr, len) (len)
+#define buffered_bytecount_to_charcount(ptr, len) (len)
 
 #endif /* MULE */
Repository URL: https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
                        
                     
                    
                 
             
         
        
        
            
        
        
            
                
                    
                    
                    [COMMIT] Correct some partial character accounting, buffered_bytecount_to_charcount().
                
            
            
                11 years, 9 months
            
            
                
                    
                     
                    
                    
                    Aidan Kehoe
                
 
                
                    
                        
                            
APPROVE COMMIT
NOTE: This patch has been committed
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1390484980 0
# Node ID 7343a186a4757d2053e550dcb9299fd446970487
# Parent  0cb4f494a54809a054e242ee16c00c0e9c34d39d
Correct some partial character accounting, buffered_bytecount_to_charcount().
src/ChangeLog addition:
2014-01-23  Aidan Kehoe  <kehoea(a)parhasard.net>
	* lstream.c (Lstream_read_1):
	Don't include the unread partial character in
	unget_character_count, since our consumers will never be aware of it.
	* text.c:
	* text.c (buffered_bytecount_to_charcount):
	A buffer consisting entirely of a partial character needs to be
	treated as a partial last character, not a partial first
	character, to avoid double-counting.
diff -r 0cb4f494a548 -r 7343a186a475 src/ChangeLog
--- a/src/ChangeLog	Wed Jan 22 17:52:00 2014 +0000
+++ b/src/ChangeLog	Thu Jan 23 13:49:40 2014 +0000
@@ -1,3 +1,14 @@
+2014-01-23  Aidan Kehoe  <kehoea(a)parhasard.net>
+
+	* lstream.c (Lstream_read_1):
+	Don't include the unread partial character in
+	unget_character_count, since our consumers will never be aware of it.
+	* text.c:
+	* text.c (buffered_bytecount_to_charcount):
+	A buffer consisting entirely of a partial character needs to be
+	treated as a partial last character, not a partial first
+	character, to avoid double-counting.
+
 2014-01-22  Aidan Kehoe  <kehoea(a)parhasard.net>
 
 	* text.c (buffered_bytecount_to_charcount): New.
diff -r 0cb4f494a548 -r 7343a186a475 src/lstream.c
--- a/src/lstream.c	Wed Jan 22 17:52:00 2014 +0000
+++ b/src/lstream.c	Thu Jan 23 13:49:40 2014 +0000
@@ -721,8 +721,15 @@
       Bytecount newoff = validate_ibyte_string_backward (p, off);
       if (newoff < off)
 	{
+          Charcount before = lstr->unget_character_count;
 	  Lstream_unread (lstr, p + newoff, off - newoff);
 	  off = newoff;
+
+          /* Since it's Lstream_read rather than our consumers unreading the
+             incomplete character (conceptually, not affecting the number of
+             characters ever Lstream_read() from the stream),
+             unget_character_count shouldn't include it. */
+          lstr->unget_character_count = before;
 	}
     }
 
diff -r 0cb4f494a548 -r 7343a186a475 src/text.c
--- a/src/text.c	Wed Jan 22 17:52:00 2014 +0000
+++ b/src/text.c	Thu Jan 23 13:49:40 2014 +0000
@@ -2244,9 +2244,9 @@
 /* Return the character count of an lstream or coding buffer of
    internal-format text, counting partial characters at the beginning of the
    buffer as whole characters, and *not* counting partial characters at the
-   end of the buffer. This is because the result of this function is
-   subtracted from the character count given by the coding system character
-   tell methods, which include the former but not the latter. */
+   end of the buffer. The result of this function is subtracted from the
+   character count given by the coding system character tell methods, and we
+   need to treat each buffer in the same way to avoid double-counting. */
 
 Charcount
 buffered_bytecount_to_charcount (const Ibyte *bufptr, Bytecount len)
@@ -2258,10 +2258,10 @@
     {
       if (rep_bytes_by_first_byte (*bufptr) > len)
         {
-          /* This is a partial first character, include it. Return
-             immediately so validate_ibyte_string_backward doesn't run off
-             the beginning of the string. */
-          return (Charcount) 1;
+          /* This is a partial last character. Return 0, avoid treating it
+             as a partial first character, since that would lead to it being
+             counted twice. */
+          return (Charcount) 0;
         }
     }
   else
-- 
‘Liston operated so fast that he once accidentally amputated an assistant’s 
fingers along with a patient’s leg, […] The patient and the assistant both 
died of sepsis, and a spectator reportedly died of shock, resulting in the 
only known procedure with a 300% mortality.’ (Atul Gawande, NEJM, 2012)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
                        
                     
                    
                 
             
         
        
        
            
        
        
            
                
                    
                    
                    commit/XEmacs: kehoea: Correct some partial character accounting, buffered_bytecount_to_charcount().
                
            
            
                11 years, 9 months
            
            
                
                    
                     
                    
                    
                    Bitbucket
                
 
                
                    
                        
                            1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/7343a186a475/
Changeset:   7343a186a475
User:        kehoea
Date:        2014-01-23 14:49:40
Summary:     Correct some partial character accounting, buffered_bytecount_to_charcount().
src/ChangeLog addition:
2014-01-23  Aidan Kehoe  <kehoea(a)parhasard.net>
	* lstream.c (Lstream_read_1):
	Don't include the unread partial character in
	unget_character_count, since our consumers will never be aware of it.
	* text.c:
	* text.c (buffered_bytecount_to_charcount):
	A buffer consisting entirely of a partial character needs to be
	treated as a partial last character, not a partial first
	character, to avoid double-counting.
Affected #:  3 files
diff -r 0cb4f494a54809a054e242ee16c00c0e9c34d39d -r 7343a186a4757d2053e550dcb9299fd446970487 src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,14 @@
+2014-01-23  Aidan Kehoe  <kehoea(a)parhasard.net>
+
+	* lstream.c (Lstream_read_1):
+	Don't include the unread partial character in
+	unget_character_count, since our consumers will never be aware of it.
+	* text.c:
+	* text.c (buffered_bytecount_to_charcount):
+	A buffer consisting entirely of a partial character needs to be
+	treated as a partial last character, not a partial first
+	character, to avoid double-counting.
+
 2014-01-22  Aidan Kehoe  <kehoea(a)parhasard.net>
 
 	* text.c (buffered_bytecount_to_charcount): New.
diff -r 0cb4f494a54809a054e242ee16c00c0e9c34d39d -r 7343a186a4757d2053e550dcb9299fd446970487 src/lstream.c
--- a/src/lstream.c
+++ b/src/lstream.c
@@ -721,8 +721,15 @@
       Bytecount newoff = validate_ibyte_string_backward (p, off);
       if (newoff < off)
 	{
+          Charcount before = lstr->unget_character_count;
 	  Lstream_unread (lstr, p + newoff, off - newoff);
 	  off = newoff;
+
+          /* Since it's Lstream_read rather than our consumers unreading the
+             incomplete character (conceptually, not affecting the number of
+             characters ever Lstream_read() from the stream),
+             unget_character_count shouldn't include it. */
+          lstr->unget_character_count = before;
 	}
     }
 
diff -r 0cb4f494a54809a054e242ee16c00c0e9c34d39d -r 7343a186a4757d2053e550dcb9299fd446970487 src/text.c
--- a/src/text.c
+++ b/src/text.c
@@ -2244,9 +2244,9 @@
 /* Return the character count of an lstream or coding buffer of
    internal-format text, counting partial characters at the beginning of the
    buffer as whole characters, and *not* counting partial characters at the
-   end of the buffer. This is because the result of this function is
-   subtracted from the character count given by the coding system character
-   tell methods, which include the former but not the latter. */
+   end of the buffer. The result of this function is subtracted from the
+   character count given by the coding system character tell methods, and we
+   need to treat each buffer in the same way to avoid double-counting. */
 
 Charcount
 buffered_bytecount_to_charcount (const Ibyte *bufptr, Bytecount len)
@@ -2258,10 +2258,10 @@
     {
       if (rep_bytes_by_first_byte (*bufptr) > len)
         {
-          /* This is a partial first character, include it. Return
-             immediately so validate_ibyte_string_backward doesn't run off
-             the beginning of the string. */
-          return (Charcount) 1;
+          /* This is a partial last character. Return 0, avoid treating it
+             as a partial first character, since that would lead to it being
+             counted twice. */
+          return (Charcount) 0;
         }
     }
   else
Repository URL: https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
                        
                     
                    
                 
             
         
        
        
            
        
        
            
                
                    
                    
                    [COMMIT] Have the result of coding_character_tell() reflect str->convert_to, too.
                
            
            
                11 years, 9 months
            
            
                
                    
                     
                    
                    
                    Aidan Kehoe
                
 
                
                    
                        
                            
APPROVE COMMIT
NOTE: This patch has been committed.
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1390413120 0
# Node ID 0cb4f494a54809a054e242ee16c00c0e9c34d39d
# Parent  cfc6a8c144f16b2598435cfb0aa8a2a48204c947
Have the result of coding_character_tell() reflect str->convert_to, too.
src/ChangeLog addition:
2014-01-22  Aidan Kehoe  <kehoea(a)parhasard.net>
	* text.c (buffered_bytecount_to_charcount): New.
	Return the number of characters in a coding or lstream buffer,
	including partial characters at the beginning of the buffer, but
	not including those at the end. Refactored from
	Lstream_character_tell().
	* text.h:
	* text.h (buffered_bytecount_to_charcount): Declare it.
	* lstream.c (Lstream_character_tell):
	Use the refactored buffered_bytecount_to_charcount () here, both
	for the unget buffer and in_buffer.
	* file-coding.c (coding_character_tell):
	Check the character count of the lstream buffer too, when passing
	back the character count from the coding stream.
diff -r cfc6a8c144f1 -r 0cb4f494a548 src/ChangeLog
--- a/src/ChangeLog	Tue Jan 21 00:27:16 2014 +0000
+++ b/src/ChangeLog	Wed Jan 22 17:52:00 2014 +0000
@@ -1,3 +1,19 @@
+2014-01-22  Aidan Kehoe  <kehoea(a)parhasard.net>
+
+	* text.c (buffered_bytecount_to_charcount): New.
+	Return the number of characters in a coding or lstream buffer,
+	including partial characters at the beginning of the buffer, but
+	not including those at the end. Refactored from
+	Lstream_character_tell().
+	* text.h:
+	* text.h (buffered_bytecount_to_charcount): Declare it.
+	* lstream.c (Lstream_character_tell):
+	Use the refactored buffered_bytecount_to_charcount () here, both
+	for the unget buffer and in_buffer.
+	* file-coding.c (coding_character_tell):
+	Check the character count of the lstream buffer too, when passing
+	back the character count from the coding stream.
+
 2014-01-21  Aidan Kehoe  <kehoea(a)parhasard.net>
 
 	* redisplay.c (start_with_line_at_pixpos):
diff -r cfc6a8c144f1 -r 0cb4f494a548 src/file-coding.c
--- a/src/file-coding.c	Tue Jan 21 00:27:16 2014 +0000
+++ b/src/file-coding.c	Wed Jan 22 17:52:00 2014 +0000
@@ -1994,8 +1994,19 @@
 coding_character_tell (Lstream *stream)
 {
   struct coding_stream *str = CODING_STREAM_DATA (stream);
-
-  return XCODESYSMETH_OR_GIVEN (str->codesys, character_tell, (str), -1);
+  Charcount ctell
+    = XCODESYSMETH_OR_GIVEN (str->codesys, character_tell, (str), -1);
+  
+  if (ctell > 0 && Dynarr_length (str->convert_to) > 0)
+    {
+      ctell
+        -= buffered_bytecount_to_charcount ((const Ibyte *)
+                                            (Dynarr_begin (str->convert_to)),
+                                            Dynarr_length (str->convert_to));
+      text_checking_assert (ctell >= 0);
+    }
+
+  return ctell;
 }
 
 static int
diff -r cfc6a8c144f1 -r 0cb4f494a548 src/lstream.c
--- a/src/lstream.c	Tue Jan 21 00:27:16 2014 +0000
+++ b/src/lstream.c	Wed Jan 22 17:52:00 2014 +0000
@@ -752,15 +752,10 @@
           /* The character count should not include those characters
              currently *in* the unget buffer, subtract that count.  */
           Ibyte *ungot, *ungot_ptr;
-          Bytecount ii = lstr->unget_buffer_ind, impartial, sevenflen;
+          Bytecount ii = lstr->unget_buffer_ind;
 
           ungot_ptr = ungot
-            = alloca_ibytes (lstr->unget_buffer_ind) + MAX_ICHAR_LEN;
-
-          /* Make sure the string starts with a valid ibyteptr, otherwise
-             validate_ibyte_string_backward could run off the beginning. */
-          sevenflen = set_itext_ichar (ungot, (Ichar) 0x7f);
-          ungot_ptr += sevenflen;
+            = alloca_ibytes (lstr->unget_buffer_ind);
 
           /* Internal format data, but in reverse order. There's not
              actually a need to alloca here, we could work out the character
@@ -772,90 +767,23 @@
               *ungot_ptr++ = lstr->unget_buffer[--ii];
             }
 
-          impartial
-            = validate_ibyte_string_backward (ungot, ungot_ptr - ungot);
-
-          /* Move past the character we added. */
-          impartial -= sevenflen;
-          INC_IBYTEPTR (ungot);
-
-          if (impartial > 0 && !valid_ibyteptr_p (ungot))
-            {
-              Ibyte *newstart = ungot, *limit = ungot + impartial;
-              /* Our consumer has the start of a partial character, we
-                 have the rest. */
-
-              while (!valid_ibyteptr_p (newstart) && newstart < limit)
-                {
-                  newstart++, impartial--;
-                }
-                  
-              /* Remove this character from the count, since the
-                 end-consumer hasn't seen the full character. */
-              ctell--;
-              ungot = newstart;
-            }
-          else if (valid_ibyteptr_p (ungot)
-                   && rep_bytes_by_first_byte (*ungot) > impartial)
-            {
-              /* Rest of a partial character has yet to be read, its first
-                 octet has probably been unread by Lstream_read_1(). We
-                 included it in the accounting in Lstream_unread(), adjust
-                 the figure here appropriately. */
-              ctell--;
-            }
-
-          /* bytecount_to_charcount will throw an assertion failure if we're
-             not at the start of a character. */
-          text_checking_assert (impartial == 0 || valid_ibyteptr_p (ungot));
-
           /* The character length of this text is included in
              unget_character_count; if the bytes are still in the unget
              buffer, then our consumers haven't seen them, and so the
              character tell figure shouldn't reflect them. Subtract it from
              the total.  */
-          ctell -= bytecount_to_charcount (ungot, impartial);
+          ctell
+            -= buffered_bytecount_to_charcount (ungot, ungot_ptr - ungot);
         }
 
       if (lstr->in_buffer_ind < lstr->in_buffer_current)
         {
-          Ibyte *inbuf = lstr->in_buffer + lstr->in_buffer_ind;
-          Bytecount partial = lstr->in_buffer_current - lstr->in_buffer_ind,
-            impartial;
-
-          if (!valid_ibyteptr_p (inbuf))
-            {
-              Ibyte *newstart = inbuf;
-              Ibyte *limit = lstr->in_buffer + lstr->in_buffer_current;
-              /* Our consumer has the start of a partial character, we
-                 have the rest. */
-
-              while (newstart < limit && !valid_ibyteptr_p (newstart))
-                {
-                  newstart++;
-                }
-                  
-              /* Remove this character from the count, since the
-                 end-consumer hasn't seen the full character. */
-              ctell--;
-              inbuf = newstart;
-              partial = limit - newstart;
-            }
-
-          if (valid_ibyteptr_p (inbuf)) 
-            {
-              /* There's at least one valid starting char in the string,
-                 validate_ibyte_string_backward won't run off the
-                 begining. */
-              impartial = 
-                validate_ibyte_string_backward (inbuf, partial);
-            }
-          else
-            {
-              impartial = 0;
-            }
-
-          ctell -= bytecount_to_charcount (inbuf, impartial);
+          ctell
+            -= buffered_bytecount_to_charcount ((const Ibyte *)
+                                                (lstr->in_buffer
+                                                 + lstr->in_buffer_ind),
+                                                lstr->in_buffer_current
+                                                - lstr->in_buffer_ind);
         }
 
       text_checking_assert (ctell >= 0);
diff -r cfc6a8c144f1 -r 0cb4f494a548 src/text.c
--- a/src/text.c	Tue Jan 21 00:27:16 2014 +0000
+++ b/src/text.c	Wed Jan 22 17:52:00 2014 +0000
@@ -2241,6 +2241,60 @@
   return count;
 }
 
+/* Return the character count of an lstream or coding buffer of
+   internal-format text, counting partial characters at the beginning of the
+   buffer as whole characters, and *not* counting partial characters at the
+   end of the buffer. This is because the result of this function is
+   subtracted from the character count given by the coding system character
+   tell methods, which include the former but not the latter. */
+
+Charcount
+buffered_bytecount_to_charcount (const Ibyte *bufptr, Bytecount len)
+{
+  Boolint partial_first = 0;
+  Bytecount impartial;
+
+  if (valid_ibyteptr_p (bufptr))
+    {
+      if (rep_bytes_by_first_byte (*bufptr) > len)
+        {
+          /* This is a partial first character, include it. Return
+             immediately so validate_ibyte_string_backward doesn't run off
+             the beginning of the string. */
+          return (Charcount) 1;
+        }
+    }
+  else
+    {
+      const Ibyte *newstart = bufptr, *limit = newstart + len;
+
+      /* Our consumer has the start of a partial character, we have the
+         rest. */
+      while (newstart < limit && !valid_ibyteptr_p (newstart))
+        {
+          newstart++;
+        }
+                  
+      partial_first = 1;
+      bufptr = newstart;
+      len = limit - newstart;
+    }
+
+  if (len && valid_ibyteptr_p (bufptr))
+    {
+      /* There's at least one valid starting char in the string,
+         validate_ibyte_string_backward won't run off the begining. */
+      impartial = validate_ibyte_string_backward (bufptr, len);
+    }
+  else
+    {
+      impartial = 0;
+    }
+
+  return (Charcount) partial_first + bytecount_to_charcount (bufptr,
+                                                             impartial);
+}
+
 Bytecount
 charcount_to_bytecount_fun (const Ibyte *ptr, Charcount len)
 {
diff -r cfc6a8c144f1 -r 0cb4f494a548 src/text.h
--- a/src/text.h	Tue Jan 21 00:27:16 2014 +0000
+++ b/src/text.h	Wed Jan 22 17:52:00 2014 +0000
@@ -908,6 +908,12 @@
   return ptr;
 }
 
+/* Return the character count of an lstream or coding buffer of internal
+   format text, counting partial characters at the beginning of the buffer
+   as whole characters, and *not* counting partial characters at the end of
+   the buffer. */
+Charcount buffered_bytecount_to_charcount (const Ibyte *, Bytecount len);
+
 #else
 
 #define bytecount_to_charcount(ptr, len) ((Charcount) (len))
@@ -916,6 +922,7 @@
 #define charcount_to_bytecount_fmt(ptr, len, fmt) ((Bytecount) (len))
 #define skip_ascii(ptr, end) end
 #define skip_ascii_down(ptr, end) end
+#define buffered_bytecount_to_charcount (ptr, len) (len)
 
 #endif /* MULE */
 
-- 
‘Liston operated so fast that he once accidentally amputated an assistant’s 
fingers along with a patient’s leg, […] The patient and the assistant both 
died of sepsis, and a spectator reportedly died of shock, resulting in the 
only known procedure with a 300% mortality.’ (Atul Gawande, NEJM, 2012)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
                        
                     
                    
                 
             
         
        
        
            
        
        
            
                
                    
                    
                    commit/XEmacs: kehoea: Have the result of coding_character_tell() reflect str->convert_to, too.
                
            
            
                11 years, 9 months
            
            
                
                    
                     
                    
                    
                    Bitbucket
                
 
                
                    
                        
                            1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/0cb4f494a548/
Changeset:   0cb4f494a548
User:        kehoea
Date:        2014-01-22 18:52:00
Summary:     Have the result of coding_character_tell() reflect str->convert_to, too.
src/ChangeLog addition:
2014-01-22  Aidan Kehoe  <kehoea(a)parhasard.net>
	* text.c (buffered_bytecount_to_charcount): New.
	Return the number of characters in a coding or lstream buffer,
	including partial characters at the beginning of the buffer, but
	not including those at the end. Refactored from
	Lstream_character_tell().
	* text.h:
	* text.h (buffered_bytecount_to_charcount): Declare it.
	* lstream.c (Lstream_character_tell):
	Use the refactored buffered_bytecount_to_charcount () here, both
	for the unget buffer and in_buffer.
	* file-coding.c (coding_character_tell):
	Check the character count of the lstream buffer too, when passing
	back the character count from the coding stream.
Affected #:  5 files
diff -r cfc6a8c144f16b2598435cfb0aa8a2a48204c947 -r 0cb4f494a54809a054e242ee16c00c0e9c34d39d src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,19 @@
+2014-01-22  Aidan Kehoe  <kehoea(a)parhasard.net>
+
+	* text.c (buffered_bytecount_to_charcount): New.
+	Return the number of characters in a coding or lstream buffer,
+	including partial characters at the beginning of the buffer, but
+	not including those at the end. Refactored from
+	Lstream_character_tell().
+	* text.h:
+	* text.h (buffered_bytecount_to_charcount): Declare it.
+	* lstream.c (Lstream_character_tell):
+	Use the refactored buffered_bytecount_to_charcount () here, both
+	for the unget buffer and in_buffer.
+	* file-coding.c (coding_character_tell):
+	Check the character count of the lstream buffer too, when passing
+	back the character count from the coding stream.
+
 2014-01-21  Aidan Kehoe  <kehoea(a)parhasard.net>
 
 	* redisplay.c (start_with_line_at_pixpos):
diff -r cfc6a8c144f16b2598435cfb0aa8a2a48204c947 -r 0cb4f494a54809a054e242ee16c00c0e9c34d39d src/file-coding.c
--- a/src/file-coding.c
+++ b/src/file-coding.c
@@ -1994,8 +1994,19 @@
 coding_character_tell (Lstream *stream)
 {
   struct coding_stream *str = CODING_STREAM_DATA (stream);
-
-  return XCODESYSMETH_OR_GIVEN (str->codesys, character_tell, (str), -1);
+  Charcount ctell
+    = XCODESYSMETH_OR_GIVEN (str->codesys, character_tell, (str), -1);
+  
+  if (ctell > 0 && Dynarr_length (str->convert_to) > 0)
+    {
+      ctell
+        -= buffered_bytecount_to_charcount ((const Ibyte *)
+                                            (Dynarr_begin (str->convert_to)),
+                                            Dynarr_length (str->convert_to));
+      text_checking_assert (ctell >= 0);
+    }
+
+  return ctell;
 }
 
 static int
diff -r cfc6a8c144f16b2598435cfb0aa8a2a48204c947 -r 0cb4f494a54809a054e242ee16c00c0e9c34d39d src/lstream.c
--- a/src/lstream.c
+++ b/src/lstream.c
@@ -752,15 +752,10 @@
           /* The character count should not include those characters
              currently *in* the unget buffer, subtract that count.  */
           Ibyte *ungot, *ungot_ptr;
-          Bytecount ii = lstr->unget_buffer_ind, impartial, sevenflen;
+          Bytecount ii = lstr->unget_buffer_ind;
 
           ungot_ptr = ungot
-            = alloca_ibytes (lstr->unget_buffer_ind) + MAX_ICHAR_LEN;
-
-          /* Make sure the string starts with a valid ibyteptr, otherwise
-             validate_ibyte_string_backward could run off the beginning. */
-          sevenflen = set_itext_ichar (ungot, (Ichar) 0x7f);
-          ungot_ptr += sevenflen;
+            = alloca_ibytes (lstr->unget_buffer_ind);
 
           /* Internal format data, but in reverse order. There's not
              actually a need to alloca here, we could work out the character
@@ -772,90 +767,23 @@
               *ungot_ptr++ = lstr->unget_buffer[--ii];
             }
 
-          impartial
-            = validate_ibyte_string_backward (ungot, ungot_ptr - ungot);
-
-          /* Move past the character we added. */
-          impartial -= sevenflen;
-          INC_IBYTEPTR (ungot);
-
-          if (impartial > 0 && !valid_ibyteptr_p (ungot))
-            {
-              Ibyte *newstart = ungot, *limit = ungot + impartial;
-              /* Our consumer has the start of a partial character, we
-                 have the rest. */
-
-              while (!valid_ibyteptr_p (newstart) && newstart < limit)
-                {
-                  newstart++, impartial--;
-                }
-                  
-              /* Remove this character from the count, since the
-                 end-consumer hasn't seen the full character. */
-              ctell--;
-              ungot = newstart;
-            }
-          else if (valid_ibyteptr_p (ungot)
-                   && rep_bytes_by_first_byte (*ungot) > impartial)
-            {
-              /* Rest of a partial character has yet to be read, its first
-                 octet has probably been unread by Lstream_read_1(). We
-                 included it in the accounting in Lstream_unread(), adjust
-                 the figure here appropriately. */
-              ctell--;
-            }
-
-          /* bytecount_to_charcount will throw an assertion failure if we're
-             not at the start of a character. */
-          text_checking_assert (impartial == 0 || valid_ibyteptr_p (ungot));
-
           /* The character length of this text is included in
              unget_character_count; if the bytes are still in the unget
              buffer, then our consumers haven't seen them, and so the
              character tell figure shouldn't reflect them. Subtract it from
              the total.  */
-          ctell -= bytecount_to_charcount (ungot, impartial);
+          ctell
+            -= buffered_bytecount_to_charcount (ungot, ungot_ptr - ungot);
         }
 
       if (lstr->in_buffer_ind < lstr->in_buffer_current)
         {
-          Ibyte *inbuf = lstr->in_buffer + lstr->in_buffer_ind;
-          Bytecount partial = lstr->in_buffer_current - lstr->in_buffer_ind,
-            impartial;
-
-          if (!valid_ibyteptr_p (inbuf))
-            {
-              Ibyte *newstart = inbuf;
-              Ibyte *limit = lstr->in_buffer + lstr->in_buffer_current;
-              /* Our consumer has the start of a partial character, we
-                 have the rest. */
-
-              while (newstart < limit && !valid_ibyteptr_p (newstart))
-                {
-                  newstart++;
-                }
-                  
-              /* Remove this character from the count, since the
-                 end-consumer hasn't seen the full character. */
-              ctell--;
-              inbuf = newstart;
-              partial = limit - newstart;
-            }
-
-          if (valid_ibyteptr_p (inbuf)) 
-            {
-              /* There's at least one valid starting char in the string,
-                 validate_ibyte_string_backward won't run off the
-                 begining. */
-              impartial = 
-                validate_ibyte_string_backward (inbuf, partial);
-            }
-          else
-            {
-              impartial = 0;
-            }
-
-          ctell -= bytecount_to_charcount (inbuf, impartial);
+          ctell
+            -= buffered_bytecount_to_charcount ((const Ibyte *)
+                                                (lstr->in_buffer
+                                                 + lstr->in_buffer_ind),
+                                                lstr->in_buffer_current
+                                                - lstr->in_buffer_ind);
         }
 
       text_checking_assert (ctell >= 0);
diff -r cfc6a8c144f16b2598435cfb0aa8a2a48204c947 -r 0cb4f494a54809a054e242ee16c00c0e9c34d39d src/text.c
--- a/src/text.c
+++ b/src/text.c
@@ -2241,6 +2241,60 @@
   return count;
 }
 
+/* Return the character count of an lstream or coding buffer of
+   internal-format text, counting partial characters at the beginning of the
+   buffer as whole characters, and *not* counting partial characters at the
+   end of the buffer. This is because the result of this function is
+   subtracted from the character count given by the coding system character
+   tell methods, which include the former but not the latter. */
+
+Charcount
+buffered_bytecount_to_charcount (const Ibyte *bufptr, Bytecount len)
+{
+  Boolint partial_first = 0;
+  Bytecount impartial;
+
+  if (valid_ibyteptr_p (bufptr))
+    {
+      if (rep_bytes_by_first_byte (*bufptr) > len)
+        {
+          /* This is a partial first character, include it. Return
+             immediately so validate_ibyte_string_backward doesn't run off
+             the beginning of the string. */
+          return (Charcount) 1;
+        }
+    }
+  else
+    {
+      const Ibyte *newstart = bufptr, *limit = newstart + len;
+
+      /* Our consumer has the start of a partial character, we have the
+         rest. */
+      while (newstart < limit && !valid_ibyteptr_p (newstart))
+        {
+          newstart++;
+        }
+                  
+      partial_first = 1;
+      bufptr = newstart;
+      len = limit - newstart;
+    }
+
+  if (len && valid_ibyteptr_p (bufptr))
+    {
+      /* There's at least one valid starting char in the string,
+         validate_ibyte_string_backward won't run off the begining. */
+      impartial = validate_ibyte_string_backward (bufptr, len);
+    }
+  else
+    {
+      impartial = 0;
+    }
+
+  return (Charcount) partial_first + bytecount_to_charcount (bufptr,
+                                                             impartial);
+}
+
 Bytecount
 charcount_to_bytecount_fun (const Ibyte *ptr, Charcount len)
 {
diff -r cfc6a8c144f16b2598435cfb0aa8a2a48204c947 -r 0cb4f494a54809a054e242ee16c00c0e9c34d39d src/text.h
--- a/src/text.h
+++ b/src/text.h
@@ -908,6 +908,12 @@
   return ptr;
 }
 
+/* Return the character count of an lstream or coding buffer of internal
+   format text, counting partial characters at the beginning of the buffer
+   as whole characters, and *not* counting partial characters at the end of
+   the buffer. */
+Charcount buffered_bytecount_to_charcount (const Ibyte *, Bytecount len);
+
 #else
 
 #define bytecount_to_charcount(ptr, len) ((Charcount) (len))
@@ -916,6 +922,7 @@
 #define charcount_to_bytecount_fmt(ptr, len, fmt) ((Bytecount) (len))
 #define skip_ascii(ptr, end) end
 #define skip_ascii_down(ptr, end) end
+#define buffered_bytecount_to_charcount (ptr, len) (len)
 
 #endif /* MULE */
Repository URL: https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
                        
                     
                    
                 
             
         
        
        
            
        
        
            
                
                    
                    
                    hebrew.el for quail input
                
            
            
                11 years, 9 months
            
            
                
                    
                     
                    
                    
                    Uwe Brauer
                
 
                
                    
                        
                            
Hello
Thanks to Jeff Sparkes, his gtk branch now starts to support BIDI.
That is why I attach hebrew.el which contains various layout for hebrew
input. I will send a patch against the leim-list.el in a separate
message.
Uwe Brauer 
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
                        
                     
                    
                 
             
         
        
        
            
        
        
            
                
                    
                    
                    [COMMIT] Don't return a Charbpos before visible region, start_with_line_at_pixpos()
                
            
            
                11 years, 9 months
            
            
                
                    
                     
                    
                    
                    Aidan Kehoe
                
 
                
                    
                        
                            
Thank you Julian!
APPROVE COMMIT
NOTE: This patch has been committed.
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1390264036 0
# Node ID cfc6a8c144f16b2598435cfb0aa8a2a48204c947
# Parent  7277cf461612be80403c68d3368a5b3329210e3d
Don't return a Charbpos before visible region, start_with_line_at_pixpos()
src/ChangeLog addition:
2014-01-21  Aidan Kehoe  <kehoea(a)parhasard.net>
	* redisplay.c (start_with_line_at_pixpos):
	Apply Julian Bradfield's change of
	slrnlc7tnv.l3h.jcb(a)home.stevens-bradfield.com , never returning a
	Charbpos before the visible region. Thank you Julian!
diff -r 7277cf461612 -r cfc6a8c144f1 src/ChangeLog
--- a/src/ChangeLog	Mon Jan 20 18:13:15 2014 +0000
+++ b/src/ChangeLog	Tue Jan 21 00:27:16 2014 +0000
@@ -1,3 +1,10 @@
+2014-01-21  Aidan Kehoe  <kehoea(a)parhasard.net>
+
+	* redisplay.c (start_with_line_at_pixpos):
+	Apply Julian Bradfield's change of
+	slrnlc7tnv.l3h.jcb(a)home.stevens-bradfield.com , never returning a
+	Charbpos before the visible region. Thank you Julian!
+
 2014-01-20  Aidan Kehoe  <kehoea(a)parhasard.net>
 
 	* fileio.c (Fcopy_file, Finsert_file_contents_internal):
diff -r 7277cf461612 -r cfc6a8c144f1 src/redisplay.c
--- a/src/redisplay.c	Mon Jan 20 18:13:15 2014 +0000
+++ b/src/redisplay.c	Tue Jan 21 00:27:16 2014 +0000
@@ -8287,12 +8287,15 @@
       if (pixheight < 0)
 	{
 	  w->line_cache_validation_override--;
-	  if (-pixheight > point_line_height)
-	    /* We can't make the target line cover pixpos, so put it
-	       above pixpos.  That way it will at least be visible. */
-	    return prev_pos;
-	  else
-	    return cur_pos;
+          /* I see no reason why cur_pos can't be before BEGV
+             here, so check for it. It's not clear to me whether
+             prev_pos could be before BEGV, so check that as well. */
+          if (-pixheight > point_line_height)
+            /* We can't make the target line cover pixpos, so put it
+               above pixpos.  That way it will at least be visible. */
+            return (prev_pos <= BUF_BEGV (b)) ? BUF_BEGV (b) : prev_pos;
+          else
+            return (cur_pos <= BUF_BEGV (b)) ? BUF_BEGV (b) : cur_pos;
 	}
 
       cur_elt--;
-- 
‘Liston operated so fast that he once accidentally amputated an assistant’s
fingers along with a patient’s leg, […] The patient and the assistant both
died of sepsis, and a spectator reportedly died of shock, resulting in the
only known procedure with a 300% mortality.’ (Atul Gawande, NEJM, 2012)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
                        
                     
                    
                 
             
         
        
        
            
        
        
            
                
                    
                    
                    commit/XEmacs: kehoea: Don't return a Charbpos before visible region,  start_with_line_at_pixpos()
                
            
            
                11 years, 9 months
            
            
                
                    
                     
                    
                    
                    Bitbucket
                
 
                
                    
                        
                            1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/cfc6a8c144f1/
Changeset:   cfc6a8c144f1
User:        kehoea
Date:        2014-01-21 01:27:16
Summary:     Don't return a Charbpos before visible region, start_with_line_at_pixpos()
src/ChangeLog addition:
2014-01-21  Aidan Kehoe  <kehoea(a)parhasard.net>
	* redisplay.c (start_with_line_at_pixpos):
	Apply Julian Bradfield's change of
	slrnlc7tnv.l3h.jcb(a)home.stevens-bradfield.com , never returning a
	Charbpos before the visible region. Thank you Julian!
Affected #:  2 files
diff -r 7277cf461612be80403c68d3368a5b3329210e3d -r cfc6a8c144f16b2598435cfb0aa8a2a48204c947 src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
+2014-01-21  Aidan Kehoe  <kehoea(a)parhasard.net>
+
+	* redisplay.c (start_with_line_at_pixpos):
+	Apply Julian Bradfield's change of
+	slrnlc7tnv.l3h.jcb(a)home.stevens-bradfield.com , never returning a
+	Charbpos before the visible region. Thank you Julian!
+
 2014-01-20  Aidan Kehoe  <kehoea(a)parhasard.net>
 
 	* fileio.c (Fcopy_file, Finsert_file_contents_internal):
diff -r 7277cf461612be80403c68d3368a5b3329210e3d -r cfc6a8c144f16b2598435cfb0aa8a2a48204c947 src/redisplay.c
--- a/src/redisplay.c
+++ b/src/redisplay.c
@@ -8287,12 +8287,15 @@
       if (pixheight < 0)
 	{
 	  w->line_cache_validation_override--;
-	  if (-pixheight > point_line_height)
-	    /* We can't make the target line cover pixpos, so put it
-	       above pixpos.  That way it will at least be visible. */
-	    return prev_pos;
-	  else
-	    return cur_pos;
+          /* I see no reason why cur_pos can't be before BEGV
+             here, so check for it. It's not clear to me whether
+             prev_pos could be before BEGV, so check that as well. */
+          if (-pixheight > point_line_height)
+            /* We can't make the target line cover pixpos, so put it
+               above pixpos.  That way it will at least be visible. */
+            return (prev_pos <= BUF_BEGV (b)) ? BUF_BEGV (b) : prev_pos;
+          else
+            return (cur_pos <= BUF_BEGV (b)) ? BUF_BEGV (b) : cur_pos;
 	}
 
       cur_elt--;
Repository URL: https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches