diff options
| author | Gerd Moellmann | 2000-07-11 19:59:06 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-07-11 19:59:06 +0000 |
| commit | 11f9d6e1a398a3b762d077388332c77b33f14c5d (patch) | |
| tree | fd0ea58984310732be5e40afbdaefdb7c2635281 /src | |
| parent | 64f26cf542f0c0231461c3a80af4cc812dfb1edd (diff) | |
| download | emacs-11f9d6e1a398a3b762d077388332c77b33f14c5d.tar.gz emacs-11f9d6e1a398a3b762d077388332c77b33f14c5d.zip | |
(Fsubstitute_command_keys): Handle case that a GC
in Fwhere_is_internal or get_keymap_1 relocates string contents.
Diffstat (limited to 'src')
| -rw-r--r-- | src/doc.c | 16 |
1 files changed, 15 insertions, 1 deletions
| @@ -648,10 +648,12 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int | |||
| 648 | else if (strp[0] == '\\' && strp[1] == '[') | 648 | else if (strp[0] == '\\' && strp[1] == '[') |
| 649 | { | 649 | { |
| 650 | Lisp_Object firstkey; | 650 | Lisp_Object firstkey; |
| 651 | int start_idx; | ||
| 651 | 652 | ||
| 652 | changed = 1; | 653 | changed = 1; |
| 653 | strp += 2; /* skip \[ */ | 654 | strp += 2; /* skip \[ */ |
| 654 | start = strp; | 655 | start = strp; |
| 656 | start_idx = start - XSTRING (string)->data; | ||
| 655 | 657 | ||
| 656 | while ((strp - (unsigned char *) XSTRING (string)->data | 658 | while ((strp - (unsigned char *) XSTRING (string)->data |
| 657 | < STRING_BYTES (XSTRING (string))) | 659 | < STRING_BYTES (XSTRING (string))) |
| @@ -664,7 +666,12 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int | |||
| 664 | /* Save STRP in IDX. */ | 666 | /* Save STRP in IDX. */ |
| 665 | idx = strp - (unsigned char *) XSTRING (string)->data; | 667 | idx = strp - (unsigned char *) XSTRING (string)->data; |
| 666 | tem = Fintern (make_string (start, length_byte), Qnil); | 668 | tem = Fintern (make_string (start, length_byte), Qnil); |
| 669 | |||
| 670 | /* Note the Fwhere_is_internal can GC, so we have to take | ||
| 671 | relocation of string contents into account. */ | ||
| 667 | tem = Fwhere_is_internal (tem, keymap, Qt, Qnil); | 672 | tem = Fwhere_is_internal (tem, keymap, Qt, Qnil); |
| 673 | strp = XSTRING (string)->data + idx; | ||
| 674 | start = XSTRING (string)->data + start_idx; | ||
| 668 | 675 | ||
| 669 | /* Disregard menu bar bindings; it is positively annoying to | 676 | /* Disregard menu bar bindings; it is positively annoying to |
| 670 | mention them when there's no menu bar, and it isn't terribly | 677 | mention them when there's no menu bar, and it isn't terribly |
| @@ -701,10 +708,12 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int | |||
| 701 | else if (strp[0] == '\\' && (strp[1] == '{' || strp[1] == '<')) | 708 | else if (strp[0] == '\\' && (strp[1] == '{' || strp[1] == '<')) |
| 702 | { | 709 | { |
| 703 | struct buffer *oldbuf; | 710 | struct buffer *oldbuf; |
| 711 | int start_idx; | ||
| 704 | 712 | ||
| 705 | changed = 1; | 713 | changed = 1; |
| 706 | strp += 2; /* skip \{ or \< */ | 714 | strp += 2; /* skip \{ or \< */ |
| 707 | start = strp; | 715 | start = strp; |
| 716 | start_idx = start - XSTRING (string)->data; | ||
| 708 | 717 | ||
| 709 | while ((strp - (unsigned char *) XSTRING (string)->data | 718 | while ((strp - (unsigned char *) XSTRING (string)->data |
| 710 | < XSTRING (string)->size) | 719 | < XSTRING (string)->size) |
| @@ -726,7 +735,12 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int | |||
| 726 | { | 735 | { |
| 727 | tem = Fsymbol_value (name); | 736 | tem = Fsymbol_value (name); |
| 728 | if (! NILP (tem)) | 737 | if (! NILP (tem)) |
| 729 | tem = get_keymap_1 (tem, 0, 1); | 738 | { |
| 739 | tem = get_keymap_1 (tem, 0, 1); | ||
| 740 | /* Note that get_keymap_1 can GC. */ | ||
| 741 | strp = XSTRING (string)->data + idx; | ||
| 742 | start = XSTRING (string)->data + start_idx; | ||
| 743 | } | ||
| 730 | } | 744 | } |
| 731 | 745 | ||
| 732 | /* Now switch to a temp buffer. */ | 746 | /* Now switch to a temp buffer. */ |