diff options
| author | Gerd Moellmann | 2000-11-28 11:49:05 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-11-28 11:49:05 +0000 |
| commit | 7cb668991105849ed4561b102d8550ff7f519583 (patch) | |
| tree | 5f6ef4632239c77c38e8c5f290f71949f4e60a63 /src | |
| parent | a6b8df2fd76d81378aaa87c3ac7fc575cac07746 (diff) | |
| download | emacs-7cb668991105849ed4561b102d8550ff7f519583.tar.gz emacs-7cb668991105849ed4561b102d8550ff7f519583.zip | |
(text_read_only): New function.
(verify_interval_modification): Use it instead of signaling
`text-read-only'. This makes it easier to catch this error
with a breakpoint.:
Diffstat (limited to 'src')
| -rw-r--r-- | src/textprop.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/textprop.c b/src/textprop.c index 03e4b477b35..5342cc2380f 100644 --- a/src/textprop.c +++ b/src/textprop.c | |||
| @@ -75,6 +75,18 @@ Lisp_Object Vtext_property_default_nonsticky; | |||
| 75 | to be run later by report_interval_modification. */ | 75 | to be run later by report_interval_modification. */ |
| 76 | Lisp_Object interval_insert_behind_hooks; | 76 | Lisp_Object interval_insert_behind_hooks; |
| 77 | Lisp_Object interval_insert_in_front_hooks; | 77 | Lisp_Object interval_insert_in_front_hooks; |
| 78 | |||
| 79 | |||
| 80 | /* Signal a `text-read-only' error. This function makes it easier | ||
| 81 | to capture that error in GDB by putting a breakpoint on it. */ | ||
| 82 | |||
| 83 | static void | ||
| 84 | text_read_only () | ||
| 85 | { | ||
| 86 | Fsignal (Qtext_read_only, Qnil); | ||
| 87 | } | ||
| 88 | |||
| 89 | |||
| 78 | 90 | ||
| 79 | /* Extract the interval at the position pointed to by BEGIN from | 91 | /* Extract the interval at the position pointed to by BEGIN from |
| 80 | OBJECT, a string or buffer. Additionally, check that the positions | 92 | OBJECT, a string or buffer. Additionally, check that the positions |
| @@ -1784,7 +1796,7 @@ verify_interval_modification (buf, start, end) | |||
| 1784 | /* For an insert operation, check the two chars around the position. */ | 1796 | /* For an insert operation, check the two chars around the position. */ |
| 1785 | if (start == end) | 1797 | if (start == end) |
| 1786 | { | 1798 | { |
| 1787 | INTERVAL prev; | 1799 | INTERVAL prev = NULL; |
| 1788 | Lisp_Object before, after; | 1800 | Lisp_Object before, after; |
| 1789 | 1801 | ||
| 1790 | /* Set I to the interval containing the char after START, | 1802 | /* Set I to the interval containing the char after START, |
| @@ -1828,7 +1840,7 @@ verify_interval_modification (buf, start, end) | |||
| 1828 | if (TMEM (Qread_only, tem) | 1840 | if (TMEM (Qread_only, tem) |
| 1829 | || (NILP (Fplist_get (i->plist, Qread_only)) | 1841 | || (NILP (Fplist_get (i->plist, Qread_only)) |
| 1830 | && TMEM (Qcategory, tem))) | 1842 | && TMEM (Qcategory, tem))) |
| 1831 | Fsignal (Qtext_read_only, Qnil); | 1843 | text_read_only (); |
| 1832 | } | 1844 | } |
| 1833 | } | 1845 | } |
| 1834 | 1846 | ||
| @@ -1848,7 +1860,7 @@ verify_interval_modification (buf, start, end) | |||
| 1848 | if (! TMEM (Qread_only, tem) | 1860 | if (! TMEM (Qread_only, tem) |
| 1849 | && (! NILP (Fplist_get (prev->plist,Qread_only)) | 1861 | && (! NILP (Fplist_get (prev->plist,Qread_only)) |
| 1850 | || ! TMEM (Qcategory, tem))) | 1862 | || ! TMEM (Qcategory, tem))) |
| 1851 | Fsignal (Qtext_read_only, Qnil); | 1863 | text_read_only (); |
| 1852 | } | 1864 | } |
| 1853 | } | 1865 | } |
| 1854 | } | 1866 | } |
| @@ -1867,13 +1879,13 @@ verify_interval_modification (buf, start, end) | |||
| 1867 | if (TMEM (Qread_only, tem) | 1879 | if (TMEM (Qread_only, tem) |
| 1868 | || (NILP (Fplist_get (i->plist, Qread_only)) | 1880 | || (NILP (Fplist_get (i->plist, Qread_only)) |
| 1869 | && TMEM (Qcategory, tem))) | 1881 | && TMEM (Qcategory, tem))) |
| 1870 | Fsignal (Qtext_read_only, Qnil); | 1882 | text_read_only (); |
| 1871 | 1883 | ||
| 1872 | tem = textget (prev->plist, Qrear_nonsticky); | 1884 | tem = textget (prev->plist, Qrear_nonsticky); |
| 1873 | if (! TMEM (Qread_only, tem) | 1885 | if (! TMEM (Qread_only, tem) |
| 1874 | && (! NILP (Fplist_get (prev->plist, Qread_only)) | 1886 | && (! NILP (Fplist_get (prev->plist, Qread_only)) |
| 1875 | || ! TMEM (Qcategory, tem))) | 1887 | || ! TMEM (Qcategory, tem))) |
| 1876 | Fsignal (Qtext_read_only, Qnil); | 1888 | text_read_only (); |
| 1877 | } | 1889 | } |
| 1878 | } | 1890 | } |
| 1879 | } | 1891 | } |
| @@ -1895,7 +1907,7 @@ verify_interval_modification (buf, start, end) | |||
| 1895 | do | 1907 | do |
| 1896 | { | 1908 | { |
| 1897 | if (! INTERVAL_WRITABLE_P (i)) | 1909 | if (! INTERVAL_WRITABLE_P (i)) |
| 1898 | Fsignal (Qtext_read_only, Qnil); | 1910 | text_read_only (); |
| 1899 | 1911 | ||
| 1900 | mod_hooks = textget (i->plist, Qmodification_hooks); | 1912 | mod_hooks = textget (i->plist, Qmodification_hooks); |
| 1901 | if (! NILP (mod_hooks) && ! EQ (mod_hooks, prev_mod_hooks)) | 1913 | if (! NILP (mod_hooks) && ! EQ (mod_hooks, prev_mod_hooks)) |