>>>> "sjt" == Stephen J Turnbull
<stephen(a)xemacs.org> writes:
>>>> "Tak" == Tak Ota
<Takaaki.Ota(a)am.sony.com> writes:
Tak> I haven't extracted a stand-alone test case. The problem
Tak> seen when using table.el is when cells in a table like below
Tak> are merged, for example like this undoing reproduces the
Tak> original table below.
sjt> By "undoing" you mean M-x undo, and not M-x table-split-cell?
sjt> But you imply that table-split-cell also fails to work
sjt> correctly?
OK, it turns out that the Info manual is only half true; it says it
implements the API, which is true in the sense that you won't get
errors, but it does not implement the semantics.
Try the following as a partial implementation of a work-around (I
don't have time to do a better job, sorry). I don't know yet whether
we'll try to make the text property emulation accurate or not; it
won't happen for months in 21.4 for sure.
;; This code is part of XEmacs, licensed under the GNU GPL v2 or
;; later at your option.
;; Copyright 2003 Free Software Foundation
;; Author: Stephen J. Turnbull <stephen(a)xemacs.org>
;; (assign.future for XEmacs on file at FSF)
(defun split-text-property-internal (pos ignored prop)
"Don't call this.
Splits the extent at POS if PROP is set.
Use this to implement a split-text-property hook function for a given
property for use in `before-change-functions'.
IGNORED is present so that you can't accidentally use this function itself
in `before-change-functions'.
Change hook functions that call this should wrap it in a condition-case!
Breakage in the change functions can make XEmacs totally unusable.
#### This function has not been checked for sane behavior at extent
boundaries."
(let ((x (extent-at pos nil 'text-prop)))
(when x
(let ((s (extent-start-position x))
(e (extent-end-position x)))
(message "start %d end %d" s e)
(let ((y (copy-extent x)))
(set-extent-endpoints y pos e)
(set-extent-endpoints x s pos))))))
(defun table-split-table-cell-extent (pos ignored)
"Don't call this.
Splits the extent at POS if it represents the `table-cell' text property.
This improves the emulation of GNU Emacs text properties in that respect.
Add this hook function to `before-change-functions'.
IGNORED is present to satisfy the `before-change-functions' API."
;; justified paranoia -- errors here mean you can't even exit!!
;; gnuclient -batch -eval "(remove-hook 'before-change-functions \
;; #'table-split-table-cell-extent)"
;; may save your bacon
(condition-case nil
(split-text-property-internal pos ignored 'table-cell)
error
(warn "split-text-property is borked; remove the hook!")))
;; (add-hook 'before-change-functions #'table-split-table-cell-extent)
--
Institute of Policy and Planning Sciences
http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
Ask not how you can "do" free software business;
ask what your business can "do for" free software.