aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/textmodes/table.el106
1 files changed, 21 insertions, 85 deletions
diff --git a/lisp/textmodes/table.el b/lisp/textmodes/table.el
index 256fac63421..ef688f129fa 100644
--- a/lisp/textmodes/table.el
+++ b/lisp/textmodes/table.el
@@ -1202,35 +1202,13 @@ This is always set to nil at the entry to `table-with-cache-buffer' before execu
1202 :help "Move point backward by cell(s)"]) 1202 :help "Move point backward by cell(s)"])
1203 )) 1203 ))
1204 1204
1205;; XEmacs causes an error when encountering unknown keywords in the
1206;; menu definition. Specifically the :help keyword is new in Emacs 21
1207;; and causes error for the XEmacs function `check-menu-syntax'. IMHO
1208;; it is unwise to generate an error for unknown keywords because it
1209;; kills the nice backward compatible extensibility of keyword use.
1210;; Unknown keywords should be quietly ignore so that future extension
1211;; does not cause a problem in the old implementation. Sigh...
1212(when (featurep 'xemacs)
1213 (defun table--tweak-menu-for-xemacs (menu)
1214 (cond
1215 ((listp menu)
1216 (mapcar #'table--tweak-menu-for-xemacs menu))
1217 ((vectorp menu)
1218 (let ((len (length menu)))
1219 (dotimes (i len)
1220 ;; replace :help with something harmless.
1221 (if (eq (aref menu i) :help) (aset menu i :included)))))))
1222 (mapcar #'table--tweak-menu-for-xemacs
1223 (list table-global-menu table-cell-menu))
1224 (defvar mark-active t))
1225
1226;; register table menu under global tools menu 1205;; register table menu under global tools menu
1227(unless table-disable-menu 1206(unless table-disable-menu
1228 (easy-menu-define table-global-menu-map nil "Table global menu" table-global-menu) 1207 (easy-menu-define table-global-menu-map nil
1229 (if (featurep 'xemacs) 1208 "Table global menu" table-global-menu)
1230 (progn 1209 (easy-menu-add-item (current-global-map) '("menu-bar" "tools") "--")
1231 (easy-menu-add-item nil '("Tools") table-global-menu-map)) 1210 (easy-menu-add-item (current-global-map)
1232 (easy-menu-add-item (current-global-map) '("menu-bar" "tools") "--") 1211 '("menu-bar" "tools") table-global-menu-map))
1233 (easy-menu-add-item (current-global-map) '("menu-bar" "tools") table-global-menu-map)))
1234 1212
1235;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1213;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1236;; 1214;;
@@ -1310,8 +1288,8 @@ the last cache point coordinate."
1310 ;; set up the update timer unless it is explicitly inhibited. 1288 ;; set up the update timer unless it is explicitly inhibited.
1311 (unless table-inhibit-update 1289 (unless table-inhibit-update
1312 (table--update-cell))))) 1290 (table--update-cell)))))
1313(if (or (featurep 'xemacs) 1291(if (null (fboundp 'font-lock-add-keywords))
1314 (null (fboundp 'font-lock-add-keywords))) nil 1292 nil
1315 ;; Color it as a keyword. 1293 ;; Color it as a keyword.
1316 (font-lock-add-keywords 1294 (font-lock-add-keywords
1317 'emacs-lisp-mode 1295 'emacs-lisp-mode
@@ -2046,8 +2024,6 @@ plain text and loses all the table specific features."
2046 (erase-buffer) 2024 (erase-buffer)
2047 (table--insert-rectangle rectangle))))) 2025 (table--insert-rectangle rectangle)))))
2048 (restore-buffer-modified-p modified-flag)) 2026 (restore-buffer-modified-p modified-flag))
2049 (if (featurep 'xemacs)
2050 (table--warn-incompatibility))
2051 cell))) 2027 cell)))
2052 2028
2053;;;###autoload 2029;;;###autoload
@@ -3878,9 +3854,7 @@ converts a table into plain text without frames. It is a companion to
3878 ;; Add menu for table cells. 3854 ;; Add menu for table cells.
3879 (unless table-disable-menu 3855 (unless table-disable-menu
3880 (easy-menu-define table-cell-menu-map table-cell-map 3856 (easy-menu-define table-cell-menu-map table-cell-map
3881 "Table cell menu" table-cell-menu) 3857 "Table cell menu" table-cell-menu))
3882 (if (featurep 'xemacs)
3883 (easy-menu-add table-cell-menu)))
3884 (run-hooks 'table-cell-map-hook)) 3858 (run-hooks 'table-cell-map-hook))
3885 3859
3886;; Create the keymap after running the user init file so that the user 3860;; Create the keymap after running the user init file so that the user
@@ -4093,7 +4067,7 @@ When the optional parameter NOW is nil it only sets up the update
4093timer. If it is non-nil the function copies the contents of the cell 4067timer. If it is non-nil the function copies the contents of the cell
4094cache buffer into the designated cell in the table buffer." 4068cache buffer into the designated cell in the table buffer."
4095 (if (null table-update-timer) nil 4069 (if (null table-update-timer) nil
4096 (table--cancel-timer table-update-timer) 4070 (cancel-timer table-update-timer)
4097 (setq table-update-timer nil)) 4071 (setq table-update-timer nil))
4098 (if (or (not now) 4072 (if (or (not now)
4099 (and (boundp 'quail-converting) 4073 (and (boundp 'quail-converting)
@@ -4136,7 +4110,7 @@ cache buffer into the designated cell in the table buffer."
4136(defun table--update-cell-widened (&optional now) 4110(defun table--update-cell-widened (&optional now)
4137 "Update the contents of the cells that are affected by widening operation." 4111 "Update the contents of the cells that are affected by widening operation."
4138 (if (null table-widen-timer) nil 4112 (if (null table-widen-timer) nil
4139 (table--cancel-timer table-widen-timer) 4113 (cancel-timer table-widen-timer)
4140 (setq table-widen-timer nil)) 4114 (setq table-widen-timer nil))
4141 (if (not now) 4115 (if (not now)
4142 (setq table-widen-timer 4116 (setq table-widen-timer
@@ -4175,7 +4149,7 @@ cache buffer into the designated cell in the table buffer."
4175(defun table--update-cell-heightened (&optional now) 4149(defun table--update-cell-heightened (&optional now)
4176 "Update the contents of the cells that are affected by heightening operation." 4150 "Update the contents of the cells that are affected by heightening operation."
4177 (if (null table-heighten-timer) nil 4151 (if (null table-heighten-timer) nil
4178 (table--cancel-timer table-heighten-timer) 4152 (cancel-timer table-heighten-timer)
4179 (setq table-heighten-timer nil)) 4153 (setq table-heighten-timer nil))
4180 (if (not now) 4154 (if (not now)
4181 (setq table-heighten-timer 4155 (setq table-heighten-timer
@@ -4270,10 +4244,6 @@ cdr is the history symbol."
4270 (read-from-minibuffer 4244 (read-from-minibuffer
4271 (format "%s (default %s): " (car prompt-history) default) 4245 (format "%s (default %s): " (car prompt-history) default)
4272 "" nil nil (cdr prompt-history) default)) 4246 "" nil nil (cdr prompt-history) default))
4273 (and (featurep 'xemacs)
4274 (equal (car (symbol-value (cdr prompt-history))) "")
4275 (set (cdr prompt-history)
4276 (cdr (symbol-value (cdr prompt-history)))))
4277 (car (symbol-value (cdr prompt-history)))) 4247 (car (symbol-value (cdr prompt-history))))
4278 4248
4279(defun table--buffer-substring-and-trim (beg end) 4249(defun table--buffer-substring-and-trim (beg end)
@@ -4584,10 +4554,7 @@ of line."
4584 4554
4585(defun table--untabify (beg end) 4555(defun table--untabify (beg end)
4586 "Wrapper to raw untabify." 4556 "Wrapper to raw untabify."
4587 (untabify beg end) 4557 (untabify beg end))
4588 (if (featurep 'xemacs)
4589 ;; Cancel strange behavior of xemacs
4590 (message "")))
4591 4558
4592(defun table--multiply-string (string multiplier) 4559(defun table--multiply-string (string multiplier)
4593 "Multiply string and return it." 4560 "Multiply string and return it."
@@ -5208,9 +5175,7 @@ instead of the current buffer and returns the OBJECT."
5208 5175
5209(defun table--update-cell-face () 5176(defun table--update-cell-face ()
5210 "Update cell face according to the current mode." 5177 "Update cell face according to the current mode."
5211 (if (featurep 'xemacs) 5178 (set-face-inverse-video 'table-cell table-fixed-width-mode))
5212 (set-face-property 'table-cell 'underline table-fixed-width-mode)
5213 (set-face-inverse-video 'table-cell table-fixed-width-mode)))
5214 5179
5215(table--update-cell-face) 5180(table--update-cell-face)
5216 5181
@@ -5263,27 +5228,12 @@ This feature is disabled when `table-disable-incompatibility-warning'
5263is non-nil. The warning is done only once per session for each item." 5228is non-nil. The warning is done only once per session for each item."
5264 (unless (and table-disable-incompatibility-warning 5229 (unless (and table-disable-incompatibility-warning
5265 (not (called-interactively-p 'interactive))) 5230 (not (called-interactively-p 'interactive)))
5266 (cond ((and (featurep 'xemacs) 5231 (when (and (boundp 'flyspell-mode)
5267 (not (get 'table-disable-incompatibility-warning 'xemacs))) 5232 flyspell-mode
5268 (put 'table-disable-incompatibility-warning 'xemacs t) 5233 (not (get 'table-disable-incompatibility-warning 'flyspell)))
5269 (display-warning 'table 5234 (put 'table-disable-incompatibility-warning 'flyspell t)
5270 " 5235 (display-warning 'table
5271*** Warning *** 5236 "
5272
5273Table package mostly works fine under XEmacs, however, due to the
5274peculiar implementation of text property under XEmacs, cell splitting
5275and any undo operation of table exhibit some known strange problems,
5276such that a border characters dissolve into adjacent cells. Please be
5277aware of this.
5278
5279"
5280 :warning))
5281 ((and (boundp 'flyspell-mode)
5282 flyspell-mode
5283 (not (get 'table-disable-incompatibility-warning 'flyspell)))
5284 (put 'table-disable-incompatibility-warning 'flyspell t)
5285 (display-warning 'table
5286 "
5287*** Warning *** 5237*** Warning ***
5288 5238
5289Flyspell minor mode is known to be incompatible with this table 5239Flyspell minor mode is known to be incompatible with this table
@@ -5291,8 +5241,7 @@ package. The flyspell version 1.5d at URL `http://kaolin.unice.fr/~serrano'
5291works better than the previous versions however not fully compatible. 5241works better than the previous versions however not fully compatible.
5292 5242
5293" 5243"
5294 :warning)) 5244 :warning))))
5295 )))
5296 5245
5297(defun table--cell-blank-str (&optional n) 5246(defun table--cell-blank-str (&optional n)
5298 "Return blank table cell string of length N." 5247 "Return blank table cell string of length N."
@@ -5338,7 +5287,6 @@ Current buffer must already be set to the cache buffer."
5338 (setq justify (or justify table-cell-info-justify)) 5287 (setq justify (or justify table-cell-info-justify))
5339 (and justify 5288 (and justify
5340 (not (eq justify 'left)) 5289 (not (eq justify 'left))
5341 (not (featurep 'xemacs))
5342 (set-marker-insertion-type marker-point t)) 5290 (set-marker-insertion-type marker-point t))
5343 (table--remove-eol-spaces (point-min) (point-max)) 5291 (table--remove-eol-spaces (point-min) (point-max))
5344 (if table-fixed-width-mode 5292 (if table-fixed-width-mode
@@ -5486,19 +5434,7 @@ It returns COLUMN unless STR contains some wide characters."
5486 5434
5487(defun table--set-timer (seconds func args) 5435(defun table--set-timer (seconds func args)
5488 "Generic wrapper for setting up a timer." 5436 "Generic wrapper for setting up a timer."
5489 (if (featurep 'xemacs) 5437 (run-with-idle-timer seconds nil func args))
5490 ;; the picky xemacs refuses to accept zero
5491 (add-timeout (if (zerop seconds) 0.01 seconds) func args nil)
5492 ;;(run-at-time seconds nil func args)))
5493 ;; somehow run-at-time causes strange problem under Emacs 20.7
5494 ;; this problem does not show up under Emacs 21.0.90
5495 (run-with-idle-timer seconds nil func args)))
5496
5497(defun table--cancel-timer (timer)
5498 "Generic wrapper for canceling a timer."
5499 (if (featurep 'xemacs)
5500 (disable-timeout timer)
5501 (cancel-timer timer)))
5502 5438
5503(defun table--get-last-command () 5439(defun table--get-last-command ()
5504 "Generic wrapper for getting the real last command." 5440 "Generic wrapper for getting the real last command."