all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Yair F <yair.f.lists@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 6621@debbugs.gnu.org
Subject: bug#6621: Emacs crash when trying to report emacs crash
Date: Wed, 14 Jul 2010 20:54:33 +0300	[thread overview]
Message-ID: <AANLkTik7VukD8sPqm7BoO8K7yi7pkS-47uXHLgcqPQiF@mail.gmail.com> (raw)
In-Reply-To: <83pqyqqx9y.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 4204 bytes --]

On Wed, Jul 14, 2010 at 11:32 AM, Eli Zaretskii <eliz@gnu.org> wrote:

> My Emacs is not compiled with -DENABLE_CHECKING, so the assert
> triggered here is a no-op for me, and Emacs works for me just fine
> with this recipe.
I have a slight suspicion that this relates to OTF/XFT font handling.
You build on Windows right?

>
> I will build with -DENABLE_CHECKING and try again, but until I
> do, could you please show the output of the`pit' command in frame #1?
>
> Also, in the same frame #1, what do these commands show:
>
>  (gdb) pgrowx it->glyph_row
>  (gdb) prowlims it->glyph_row
>  (gdb) pmtxrows it->w->desired_matrix
>
> Finally, does the problem persist if you turn off
> auto-composition-mode before pasting the text?
As expected, turning off auto-composition-mode prevents the crash.
See my lisp/language/hebrew.el attached.

>
(gdb) up
#1  0x0809cd6b in set_iterator_to_next (it=0xbfffdee4, reseat_p=1) at
xdisp.c:6254
6254              xassert (IT_BYTEPOS (*it) == CHAR_TO_BYTE (IT_CHARPOS (*it)));
(gdb) pit
cur=151[277] pos=150[276] start=128[235] end=151 stop=151 face=16 MB ch='@'
vpos=6 hpos=17 y=102 lvy=510 x=114 vx=0-640 w=8 a+d=13+4=17 max=13+4=17
(gdb) pgrowx it->glyph_row
TEXT: 17 glyphs
  0    0: COMP[47 (0..1)] pos=128 w=9 a+d=13+4 face=16 MB
  1    9: CHAR[0x5e7] pos=130 blev=0,btyp=UNDEF w=9 a+d=13+4 face=16 MB
  2   18: CHAR[ ] pos=131 blev=0,btyp=UNDEF w=8 a+d=13+4 MB
  3   26: COMP[49 (0..1)] pos=132 w=9 a+d=13+4 face=16 MB
  4   35: CHAR[0x5e5] pos=134 blev=0,btyp=UNDEF w=7 a+d=13+4 face=16 MB
  5   42: CHAR[ ] pos=135 blev=0,btyp=UNDEF w=8 a+d=13+4 MB
  6   50: COMP[51 (0..1)] pos=136 w=3 a+d=13+4 face=16 MB
  7   53: COMP[53 (0..1)] pos=138 w=8 a+d=13+4 face=16 MB
  8   61: CHAR[0x5d9] pos=140 blev=0,btyp=UNDEF w=3 a+d=13+4 face=16 MB
  9   64: CHAR[ ] pos=141 blev=0,btyp=UNDEF w=8 a+d=13+4 MB
 10   72: COMP[55 (0..1)] pos=142 w=6 a+d=13+4 face=16 MB
 11   78: COMP[57 (0..1)] pos=144 w=9 a+d=13+4 face=16 MB
 12   87: CHAR[0x5e2] pos=146 blev=0,btyp=UNDEF w=8 a+d=13+4 face=16 MB
 13   95: COMP[35 (0..0)] pos=147 w=3 a+d=13+4 face=16 MB
 14   98: COMP[35 (1..1)] pos=149 w=0 a+d=13+4 face=16 MB
 15   98: CHAR[^] pos=150 blev=0,btyp=UNDEF w=8 a+d=13+4 face=17 MB
 16  106: CHAR[@] pos=150 blev=0,btyp=UNDEF w=8 a+d=13+4 face=17 MB
(gdb) prowlims it->glyph_row
edges=(0,0),r2l=0,cont=0,trunc=(0,0),at_zv=0
(gdb) pmtxrows it->w->desired_matrix
0: edges=(1,9),r2l=0,cont=0,trunc=(0,0),at_zv=0
1: edges=(9,31),r2l=0,cont=0,trunc=(0,0),at_zv=0
2: edges=(31,59),r2l=0,cont=0,trunc=(0,0),at_zv=0
3: edges=(59,85),r2l=0,cont=0,trunc=(0,0),at_zv=0
4: edges=(85,108),r2l=0,cont=0,trunc=(0,0),at_zv=0
5: edges=(108,128),r2l=0,cont=0,trunc=(0,0),at_zv=0
6: edges=(0,0),r2l=0,cont=0,trunc=(0,0),at_zv=0
7: edges=(149,149),r2l=0,cont=0,trunc=(0,0),at_zv=1
8: edges=(149,149),r2l=0,cont=0,trunc=(0,0),at_zv=1
9: edges=(149,149),r2l=0,cont=0,trunc=(0,0),at_zv=1
10: edges=(149,149),r2l=0,cont=0,trunc=(0,0),at_zv=1
11: edges=(149,149),r2l=0,cont=0,trunc=(0,0),at_zv=1
12: edges=(149,149),r2l=0,cont=0,trunc=(0,0),at_zv=1
13: edges=(149,149),r2l=0,cont=0,trunc=(0,0),at_zv=1
14: edges=(149,149),r2l=0,cont=0,trunc=(0,0),at_zv=1
15: edges=(149,149),r2l=0,cont=0,trunc=(0,0),at_zv=1
16: edges=(149,149),r2l=0,cont=0,trunc=(0,0),at_zv=1
17: edges=(149,149),r2l=0,cont=0,trunc=(0,0),at_zv=1
18: edges=(149,149),r2l=0,cont=0,trunc=(0,0),at_zv=1
19: edges=(149,149),r2l=0,cont=0,trunc=(0,0),at_zv=1
20: edges=(149,149),r2l=0,cont=0,trunc=(0,0),at_zv=1
21: edges=(149,149),r2l=0,cont=0,trunc=(0,0),at_zv=1
22: edges=(149,149),r2l=0,cont=0,trunc=(0,0),at_zv=1
23: edges=(149,149),r2l=0,cont=0,trunc=(0,0),at_zv=1
24: edges=(149,149),r2l=0,cont=0,trunc=(0,0),at_zv=1
25: edges=(149,149),r2l=0,cont=0,trunc=(0,0),at_zv=1
26: edges=(149,149),r2l=0,cont=0,trunc=(0,0),at_zv=1
27: edges=(149,149),r2l=0,cont=0,trunc=(0,0),at_zv=1
28: edges=(149,149),r2l=0,cont=0,trunc=(0,0),at_zv=1
29: edges=(149,149),r2l=0,cont=0,trunc=(0,0),at_zv=1
30: edges=(192,192),r2l=0,cont=0,trunc=(0,0),at_zv=1
31: edges=(192,192),r2l=0,cont=0,trunc=(0,0),at_zv=1
32: edges=(192,192),r2l=0,cont=0,trunc=(0,0),at_zv=1

[-- Attachment #2: hebrew.el --]
[-- Type: text/x-emacs-lisp, Size: 11224 bytes --]

;;; hebrew.el --- support for Hebrew -*- coding: utf-8 -*-

;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
;;   Free Software Foundation, Inc.
;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
;;   2005, 2006, 2007, 2008, 2009, 2010
;;   National Institute of Advanced Industrial Science and Technology (AIST)
;;   Registration Number H14PRO021

;; Copyright (C) 2003
;;   National Institute of Advanced Industrial Science and Technology (AIST)
;;   Registration Number H13PRO009

;; Keywords: multilingual, Hebrew

;; This file is part of GNU Emacs.

;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.

;;; Commentary:

;; For Hebrew, the character set ISO8859-8 is supported.
;; See http://www.ecma.ch/ecma1/STAND/ECMA-121.HTM.
;; Windows-1255 is also supported.

;;; Code:

(define-coding-system 'hebrew-iso-8bit
  "ISO 2022 based 8-bit encoding for Hebrew (MIME:ISO-8859-8)."
  :coding-type 'charset
  :mnemonic ?8
  :charset-list '(iso-8859-8)
  :mime-charset 'iso-8859-8)

(define-coding-system-alias 'iso-8859-8 'hebrew-iso-8bit)

;; These are for Explicit and Implicit directionality information, as
;; defined in RFC 1556.  We don't yet support directional information
;; in bidi languages, so these aliases are a lie, especially as far as
;; iso-8859-8-e is concerned.  FIXME.
(define-coding-system-alias 'iso-8859-8-e 'hebrew-iso-8bit)
(define-coding-system-alias 'iso-8859-8-i 'hebrew-iso-8bit)

(set-language-info-alist
 "Hebrew" '((charset iso-8859-8)
	    (coding-priority hebrew-iso-8bit)
	    (coding-system hebrew-iso-8bit windows-1255 cp862)
	    (nonascii-translation . iso-8859-8)
	    (input-method . "hebrew")
	    (unibyte-display . hebrew-iso-8bit)
	    (sample-text . "Hebrew	שלום")
	    (documentation . "Bidirectional editing is supported.")))

(set-language-info-alist
 "Windows-1255" '((coding-priority windows-1255)
		  (coding-system windows-1255)
		  (documentation . "\
Support for Windows-1255 encoding, e.g. for Yiddish.
Bidirectional editing is supported.")))

(define-coding-system 'windows-1255
  "windows-1255 (Hebrew) encoding (MIME: WINDOWS-1255)"
  :coding-type 'charset
  :mnemonic ?h
  :charset-list '(windows-1255)
  :mime-charset 'windows-1255)
(define-coding-system-alias 'cp1255 'windows-1255)

(define-coding-system 'cp862
  "DOS codepage 862 (Hebrew)"
  :coding-type 'charset
  :mnemonic ?D
  :charset-list '(cp862)
  :mime-charset 'cp862)
(define-coding-system-alias 'ibm862 'cp862)

;; Return a nested alist of Hebrew character sequences vs the
;; corresponding glyph of FONT-OBJECT.
(defun hebrew-font-get-precomposed (font-object)
  (let ((precomposed (font-get font-object 'hebrew-precomposed))
	;; Vector of Hebrew precomposed charaters.
	(chars [#xFB2A #xFB2B #xFB2C #xFB2D #xFB2E #xFB2F #xFB30 #xFB31
		#xFB32 #xFB33 #xFB34 #xFB35 #xFB36 #xFB38 #xFB39 #xFB3A
		#xFB3B #xFB3C #xFB3E #xFB40 #xFB41 #xFB43 #xFB44 #xFB46
		#xFB47 #xFB48 #xFB49 #xFB4A #xFB4B #xFB4C #xFB4D #xFB4E])
	;; Vector of decomposition character sequences corresponding
	;; to the above vector.
	(decomposed 
	 [[#x05E9 #x05C1]
	  [#x05E9 #x05C2]
	  [#x05E9 #x05BC #x05C1]
	  [#x05E9 #x05BC #x05C2]
	  [#x05D0 #x05B7]
	  [#x05D0 #x05B8]
	  [#x05D0 #x05BC]
	  [#x05D1 #x05BC]
	  [#x05D2 #x05BC]
	  [#x05D3 #x05BC]
	  [#x05D4 #x05BC]
	  [#x05D5 #x05BC]
	  [#x05D6 #x05BC]
	  [#x05D8 #x05BC]
	  [#x05D9 #x05BC]
	  [#x05DA #x05BC]
	  [#x05DB #x05BC]
	  [#x05DC #x05BC]
	  [#x05DE #x05BC]
	  [#x05E0 #x05BC]
	  [#x05E1 #x05BC]
	  [#x05E3 #x05BC]
	  [#x05E4 #x05BC]
	  [#x05E6 #x05BC]
	  [#x05E7 #x05BC]
	  [#x05E8 #x05BC]
	  [#x05E9 #x05BC]
	  [#x05EA #x05BC]
	  [#x05D5 #x05B9]
	  [#x05D1 #x05BF]
	  [#x05DB #x05BF]
	  [#x05E4 #x05BF]]))
    (unless precomposed
      (setq precomposed (list t))
      (let ((gvec (font-get-glyphs font-object 0 (length chars) chars)))
	(dotimes (i (length chars))
	  (if (aref gvec i)
	      (set-nested-alist (aref decomposed i) (aref gvec i)
				precomposed))))
      ;; Cache the result in FONT-OBJECT's property.
      (font-put font-object 'hebrew-precomposed precomposed))
    precomposed))

;; Composition function for hebrew.  GSTRING is made of a Hebrew base
;; character followed by Hebrew diacritical marks, or is made of
;; single Hebrew diacritical mark.  Adjust GSTRING to display that
;; sequence properly.  The basic strategy is:
;;
;; (1) If there's single diacritical, add padding space to the left
;; and right of the glyph.
;;
;; (2) If the font has OpenType features for Hebrew, ask the OTF
;; driver the whole work.
;;
;; (3) If the font has precomposed glyphs, use them as far as
;; possible.  Adjust the remaining glyphs artificially.

(defun hebrew-shape-gstring (gstring)
  (let* ((font (lgstring-font gstring))
	 (otf (font-get font :otf))
	 (nchars (lgstring-char-len gstring))
	 header nglyphs base-width glyph precomposed val idx)
    (cond
     ((= nchars 1)
      ;; Independent diacritical mark.  Add padding space to left or
      ;; right so that the glyph doesn't overlap with the surrounding
      ;; chars.
      (setq glyph (lgstring-glyph gstring 0))
      (let ((width (lglyph-width glyph))
	    bearing)
	(if (< (setq bearing (lglyph-lbearing glyph)) 0)
	    (lglyph-set-adjustment glyph bearing 0 (- width bearing)))
	(if (> (setq bearing (lglyph-rbearing glyph)) width)
	    (lglyph-set-adjustment glyph 0 0 bearing))))

     ((or (assq 'hebr (car otf)) (assq 'hebr (cdr otf)))
      ;; FONT has OpenType features for Hebrew.
      (font-shape-gstring gstring))

     (t
      ;; FONT doesn't have OpenType features for Hebrew.
      ;; Try a precomposed glyph.
      ;; Now GSTRING is in this form:
      ;;   [[FONT CHAR1 CHAR2 ... CHARn] nil GLYPH1 GLYPH2 ... GLYPHn nil ...]
      (setq precomposed (hebrew-font-get-precomposed font)
	    header (lgstring-header gstring)
	    val (lookup-nested-alist header precomposed nil 1))
      (if (and (consp val) (vectorp (car val)))
	  ;; All characters can be displayed by a single precomposed glyph.
	  ;; Reform GSTRING to [HEADER nil PRECOMPOSED-GLYPH nil ...]
	  (let ((glyph (copy-sequence (car val))))
	    (lglyph-set-from-to glyph 0 (1- nchars))
	    (lgstring-set-glyph gstring 0 glyph)
	    (lgstring-set-glyph gstring 1 nil))
	(if (and (integerp val) (> val 2)
		 (setq glyph (lookup-nested-alist header precomposed val 1))
		 (consp glyph) (vectorp (car glyph)))
	    ;; The first (1- VAL) characters can be displayed by a
	    ;; precomposed glyph.  Provided that VAL is 3, the first
	    ;; two glyphs should be replaced by the precomposed glyph.
	    ;; In that case, reform GSTRING to:
	    ;;   [HEADER nil PRECOMPOSED-GLYPH GLYPH3 ... GLYPHn nil ...]
	    (let* ((ncmp (1- val))	; number of composed glyphs
		   (diff (1- ncmp)))	; number of reduced glyphs
	      (setq glyph (copy-sequence (car glyph)))
	      (lglyph-set-from-to glyph 0 (1- nchars))
	      (lgstring-set-glyph gstring 0 glyph)
	      (setq idx ncmp)
	      (while (< idx nchars)
		(setq glyph (lgstring-glyph gstring idx))
		(lglyph-set-from-to glyph 0 (1- nchars))
		(lgstring-set-glyph gstring (- idx diff) glyph)
		(setq idx (1+ idx)))
	      (lgstring-set-glyph gstring (- idx diff) nil)
	      (setq idx (- ncmp diff)
		    nglyphs (- nchars diff)))
	  (setq glyph (lgstring-glyph gstring 0))
	  (lglyph-set-from-to glyph 0 (1- nchars))
	  (setq idx 1 nglyphs nchars))
	;; Now IDX is an index to the first non-precomposed glyph.
	;; Adjust positions of the remaining glyphs artificially.
	(setq base-width (lglyph-width (lgstring-glyph gstring 0)))
	(while (< idx nglyphs)
	  (setq glyph (lgstring-glyph gstring idx))
	  (lglyph-set-from-to glyph 0 (1- nchars))
	  (if (>= (lglyph-lbearing glyph) (lglyph-width glyph))
	      ;; It seems that this glyph is designed to be rendered
	      ;; before the base glyph.
	      (lglyph-set-adjustment glyph (- base-width) 0 0)
	    (if (>= (lglyph-lbearing glyph) 0)
		;; Align the horizontal center of this glyph to the
		;; horizontal center of the base glyph.
		(let ((width (- (lglyph-rbearing glyph)
				(lglyph-lbearing glyph))))
		  (lglyph-set-adjustment glyph
					 (- (/ (- base-width width) 2)
					    (lglyph-lbearing glyph)
					    base-width) 0 0))))
	  (setq idx (1+ idx))))))
    gstring))

;; For automatic composition.
(defconst hebrew-composable-pattern
  (concat
   "\\("
   "[\u05D6-\u05D9\u05DC-\u05E2\u05E5-\u05E8]" ;; base
   "\u05BC?"                        ;; 0-1 marks of 1st class (dagesh)
   "[\u05B0-\u05B9\u05BB\u05C7]?"   ;; 0-1 marks of 3rd class (niqqud)
   "[\u0591-\u05AF\u05BD]*"         ;; 0-2 (possibly 3) marks of 4th class
   "\\|"
   "[\u05D0-\u05D4\u05DA\u05DB\u05E4\u05E5-\u05EA]" 
                                    ;; base (allows rafe)
   "[\u05BC\u05BF]?"                ;; 0-1 marks of 1st class (dagesh/rafe)
   "[\u05B0-\u05B9\u05BB\u05C7]?"   ;; 0-1 marks of 3rd class (niqqud)
   "[\u0591-\u05AF\u05BD]*"         ;; 0-2 (possibly 3) marks of 4th class
   "\\|"
   "\u05D5"                         ;; base (vav)
   "\u05BC?"                        ;; 0-1 marks of 1st class (dagesh)
   "[\u05B0-\u05BB\u05C7]?"         ;; 0-1 marks of extended 3rd class (niqqud)
   "[\u0591-\u05AF\u05BD]*"         ;; 0-2 (possibly 3) marks of 4th class
   "\\|"
   "\u05E9"                         ;; base (shin)
   "\u05BC?"                        ;; 0-1 marks of 1st class (dagesh)
   "[\u05C1\u05C2]?"                ;; 0-1 marks of 2nd class (shin dot)
   "[\u05B0-\u05B9\u05BB\u05C7]?"   ;; 0-1 marks of 3rd class (niqqud)
   "[\u0591-\u05AF\u05BD]*"         ;; 0-2 (possibly 3) marks of 4th class
   "\\|"
   "[\u05F1-\u05F3]"                ;; base (yidish ligatures)
   "[\u05B0-\u05B9\u05BB\u05C7]?"   ;; 0-1 marks of 3rd class (niqqud)
   "[\u0591-\u05AF\u05BD]*"         ;; 0-2 (possibly 3) marks of 4th class
   "\\)")
  "Regexp matching a composable sequence of Hebrew characters.")

(let ((pattern1 "[\u05D0-\u05F2][\u0591-\u05BF\u05C1-\u05C5\u05C7]+")
      (pattern2 "[\u05D0-\u05F2]\u200D[\u0591-\u05BF\u05C1-\u05C5\u05C7]+"))
  (set-char-table-range
   composition-function-table '(#x591 . #x5C7)
   (list (vector pattern2 3 'hebrew-shape-gstring)
	 (vector pattern2 2 'hebrew-shape-gstring)
	 (vector pattern1 1 'hebrew-shape-gstring)
	 [nil 0 hebrew-shape-gstring]))
  (set-char-table-range
   composition-function-table #x5C0 nil)
  (set-char-table-range
   composition-function-table #x5C6 nil))

;;(set-char-table-range 
;; composition-function-table '(#x591 . #x5F4)
;; (list (vector hebrew-composable-pattern 0 'font-shape-gstring)))
;;
(provide 'hebrew)

;; arch-tag: 3ca04f32-3f1e-498e-af46-8267498ba5d9
;;; hebrew.el ends here

  parent reply	other threads:[~2010-07-14 17:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-12 21:55 bug#6621: Emacs crash when trying to report emacs crash Yair F
2010-07-13 12:17 ` Eli Zaretskii
2010-07-13 16:15   ` Yair F
2010-07-13 17:57     ` Eli Zaretskii
2010-07-13 18:29       ` Yair F
2010-07-14  8:32         ` Eli Zaretskii
2010-07-14 11:10           ` Eli Zaretskii
2010-07-14 17:54           ` Yair F [this message]
2010-07-14 20:42             ` Eli Zaretskii
2010-07-16  6:00               ` Kenichi Handa
2010-07-22 19:55                 ` Yair F
2010-07-23 12:38                   ` Kenichi Handa
2010-07-24 22:05                     ` Yair F
2010-07-26  4:30                       ` Kenichi Handa
2010-07-26 10:12                         ` Juanma Barranquero

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTik7VukD8sPqm7BoO8K7yi7pkS-47uXHLgcqPQiF@mail.gmail.com \
    --to=yair.f.lists@gmail.com \
    --cc=6621@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.