aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Kangas2020-11-23 13:46:21 +0100
committerStefan Kangas2020-11-23 13:46:21 +0100
commit613dd41769ab9953c50645983a4e91e09b16b6bf (patch)
tree77c3ebf0c8c5f7211a345f3ca0bb0fbabc99b52a
parent781dd876e432b2ed1e2198ea12c10b122ace1c91 (diff)
downloademacs-613dd41769ab9953c50645983a4e91e09b16b6bf.tar.gz
emacs-613dd41769ab9953c50645983a4e91e09b16b6bf.zip
Remove Emacs 19 and 20 compat code from table.el
* lisp/textmodes/table.el: (table-recognize-cell, table--make-cell-map) (*table--present-cell-popup-menu, table--update-cell) (table--update-cell-widened, table--update-cell-heightened) (table--cell-insert-char, table--warn-incompatibility): Remove Emacs 19 and 20 compat code. * lisp/textmodes/table.el (table-disable-menu) (table--set-timer, table--get-last-command): Declare obsolete.
-rw-r--r--lisp/textmodes/table.el101
1 files changed, 45 insertions, 56 deletions
diff --git a/lisp/textmodes/table.el b/lisp/textmodes/table.el
index 065fdd09ccb..984cc08de85 100644
--- a/lisp/textmodes/table.el
+++ b/lisp/textmodes/table.el
@@ -620,13 +620,6 @@
620(defvar flyspell-mode) 620(defvar flyspell-mode)
621(defvar real-last-command) 621(defvar real-last-command)
622(defvar delete-selection-mode) 622(defvar delete-selection-mode)
623;; This is evil!!
624;; (eval-when-compile
625;; (unless (fboundp 'set-face-property)
626;; (defun set-face-property (face prop value)))
627;; (unless (fboundp 'unibyte-char-to-multibyte)
628;; (defun unibyte-char-to-multibyte (char)))
629;; (defun table--point-in-cell-p (&optional location)))
630 623
631;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 624;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
632;;; 625;;;
@@ -811,13 +804,6 @@ simply by any key input."
811 804
812(setplist 'table-disable-incompatibility-warning nil) 805(setplist 'table-disable-incompatibility-warning nil)
813 806
814(defvar table-disable-menu (null (and (locate-library "easymenu")
815 (require 'easymenu)
816 (fboundp 'easy-menu-add-item)))
817 "When non-nil, use of menu by table package is disabled.
818It must be set before loading this package `table.el' for the first
819time.")
820
821 807
822;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 808;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
823;;; 809;;;
@@ -1202,12 +1188,11 @@ This is always set to nil at the entry to `table-with-cache-buffer' before execu
1202 )) 1188 ))
1203 1189
1204;; register table menu under global tools menu 1190;; register table menu under global tools menu
1205(unless table-disable-menu 1191(easy-menu-define table-global-menu-map nil
1206 (easy-menu-define table-global-menu-map nil 1192 "Table global menu" table-global-menu)
1207 "Table global menu" table-global-menu) 1193(easy-menu-add-item (current-global-map) '("menu-bar" "tools") "--")
1208 (easy-menu-add-item (current-global-map) '("menu-bar" "tools") "--") 1194(easy-menu-add-item (current-global-map)
1209 (easy-menu-add-item (current-global-map) 1195 '("menu-bar" "tools") table-global-menu-map)
1210 '("menu-bar" "tools") table-global-menu-map))
1211 1196
1212;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1197;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1213;; 1198;;
@@ -1287,12 +1272,8 @@ the last cache point coordinate."
1287 ;; set up the update timer unless it is explicitly inhibited. 1272 ;; set up the update timer unless it is explicitly inhibited.
1288 (unless table-inhibit-update 1273 (unless table-inhibit-update
1289 (table--update-cell))))) 1274 (table--update-cell)))))
1290(if (null (fboundp 'font-lock-add-keywords)) 1275;; Color it as a keyword.
1291 nil 1276(font-lock-add-keywords 'emacs-lisp-mode '("\\<table-with-cache-buffer\\>"))
1292 ;; Color it as a keyword.
1293 (font-lock-add-keywords
1294 'emacs-lisp-mode
1295 '("\\<table-with-cache-buffer\\>")))
1296 1277
1297(defmacro table-put-source-info (prop value) 1278(defmacro table-put-source-info (prop value)
1298 "Register source generation information." 1279 "Register source generation information."
@@ -1975,7 +1956,7 @@ is negative the cell becomes inactive, meaning that the cell becomes
1975plain text and loses all the table specific features." 1956plain text and loses all the table specific features."
1976 (interactive "i\ni\np") 1957 (interactive "i\ni\np")
1977 (table--make-cell-map) 1958 (table--make-cell-map)
1978 (if (or force (not (memq (table--get-last-command) table-command-list))) 1959 (if (or force (not (memq real-last-command table-command-list)))
1979 (let* ((cell (table--probe-cell (called-interactively-p 'interactive))) 1960 (let* ((cell (table--probe-cell (called-interactively-p 'interactive)))
1980 (cache-buffer (get-buffer-create table-cache-buffer-name)) 1961 (cache-buffer (get-buffer-create table-cache-buffer-name))
1981 (modified-flag (buffer-modified-p)) 1962 (modified-flag (buffer-modified-p))
@@ -3863,9 +3844,8 @@ converts a table into plain text without frames. It is a companion to
3863 (setq table-cell-map map) 3844 (setq table-cell-map map)
3864 (fset 'table-cell-map map))) 3845 (fset 'table-cell-map map)))
3865 ;; Add menu for table cells. 3846 ;; Add menu for table cells.
3866 (unless table-disable-menu 3847 (easy-menu-define table-cell-menu-map table-cell-map
3867 (easy-menu-define table-cell-menu-map table-cell-map 3848 "Table cell menu" table-cell-menu)
3868 "Table cell menu" table-cell-menu))
3869 (run-hooks 'table-cell-map-hook)) 3849 (run-hooks 'table-cell-map-hook))
3870 3850
3871;; Create the keymap after running the user init file so that the user 3851;; Create the keymap after running the user init file so that the user
@@ -4056,16 +4036,15 @@ key binding
4056(defun *table--present-cell-popup-menu (event) 4036(defun *table--present-cell-popup-menu (event)
4057 "Present and handle cell popup menu." 4037 "Present and handle cell popup menu."
4058 (interactive "e") 4038 (interactive "e")
4059 (unless table-disable-menu 4039 (select-window (posn-window (event-start event)))
4060 (select-window (posn-window (event-start event))) 4040 (goto-char (posn-point (event-start event)))
4061 (goto-char (posn-point (event-start event))) 4041 (let ((item-list (x-popup-menu event table-cell-menu-map))
4062 (let ((item-list (x-popup-menu event table-cell-menu-map)) 4042 (func table-cell-menu-map))
4063 (func table-cell-menu-map)) 4043 (while item-list
4064 (while item-list 4044 (setq func (nth 3 (assoc (car item-list) func)))
4065 (setq func (nth 3 (assoc (car item-list) func))) 4045 (setq item-list (cdr item-list)))
4066 (setq item-list (cdr item-list))) 4046 (if (and (symbolp func) (fboundp func))
4067 (if (and (symbolp func) (fboundp func)) 4047 (call-interactively func))))
4068 (call-interactively func)))))
4069 4048
4070;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 4049;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4071;; 4050;;
@@ -4086,9 +4065,10 @@ cache buffer into the designated cell in the table buffer."
4086 (and (boundp 'quail-translating) 4065 (and (boundp 'quail-translating)
4087 quail-translating)) 4066 quail-translating))
4088 (setq table-update-timer 4067 (setq table-update-timer
4089 (table--set-timer table-time-before-update 4068 (run-with-idle-timer table-time-before-update
4090 (function table--update-cell) 4069 nil
4091 'now)) 4070 (function table--update-cell)
4071 'now))
4092 (save-current-buffer 4072 (save-current-buffer
4093 (set-buffer table-cell-buffer) 4073 (set-buffer table-cell-buffer)
4094 (let ((cache-buffer (get-buffer-create table-cache-buffer-name)) 4074 (let ((cache-buffer (get-buffer-create table-cache-buffer-name))
@@ -4125,9 +4105,10 @@ cache buffer into the designated cell in the table buffer."
4125 (setq table-widen-timer nil)) 4105 (setq table-widen-timer nil))
4126 (if (not now) 4106 (if (not now)
4127 (setq table-widen-timer 4107 (setq table-widen-timer
4128 (table--set-timer (+ table-time-before-update table-time-before-reformat) 4108 (run-with-idle-timer (+ table-time-before-update table-time-before-reformat)
4129 (function table--update-cell-widened) 4109 nil
4130 'now)) 4110 (function table--update-cell-widened)
4111 'now))
4131 (save-current-buffer 4112 (save-current-buffer
4132 (if table-update-timer 4113 (if table-update-timer
4133 (table--update-cell 'now)) 4114 (table--update-cell 'now))
@@ -4164,9 +4145,10 @@ cache buffer into the designated cell in the table buffer."
4164 (setq table-heighten-timer nil)) 4145 (setq table-heighten-timer nil))
4165 (if (not now) 4146 (if (not now)
4166 (setq table-heighten-timer 4147 (setq table-heighten-timer
4167 (table--set-timer (+ table-time-before-update table-time-before-reformat) 4148 (run-with-idle-timer (+ table-time-before-update table-time-before-reformat)
4168 (function table--update-cell-heightened) 4149 nil
4169 'now)) 4150 (function table--update-cell-heightened)
4151 'now))
4170 (save-current-buffer 4152 (save-current-buffer
4171 (if table-update-timer 4153 (if table-update-timer
4172 (table--update-cell 'now)) 4154 (table--update-cell 'now))
@@ -4710,8 +4692,7 @@ in the list."
4710 4692
4711(defun table--cell-insert-char (char &optional overwrite) 4693(defun table--cell-insert-char (char &optional overwrite)
4712 "Insert CHAR inside a table cell." 4694 "Insert CHAR inside a table cell."
4713 (let ((delete-selection-p (and (boundp 'delete-selection-mode) 4695 (let ((delete-selection-p (and delete-selection-mode
4714 delete-selection-mode
4715 transient-mark-mode mark-active 4696 transient-mark-mode mark-active
4716 (not buffer-read-only))) 4697 (not buffer-read-only)))
4717 (mark-coordinate (table--transcoord-table-to-cache (table--get-coordinate (mark t))))) 4698 (mark-coordinate (table--transcoord-table-to-cache (table--get-coordinate (mark t)))))
@@ -5239,8 +5220,7 @@ This feature is disabled when `table-disable-incompatibility-warning'
5239is non-nil. The warning is done only once per session for each item." 5220is non-nil. The warning is done only once per session for each item."
5240 (unless (and table-disable-incompatibility-warning 5221 (unless (and table-disable-incompatibility-warning
5241 (not (called-interactively-p 'interactive))) 5222 (not (called-interactively-p 'interactive)))
5242 (when (and (boundp 'flyspell-mode) 5223 (when (and flyspell-mode
5243 flyspell-mode
5244 (not (get 'table-disable-incompatibility-warning 'flyspell))) 5224 (not (get 'table-disable-incompatibility-warning 'flyspell)))
5245 (put 'table-disable-incompatibility-warning 'flyspell t) 5225 (put 'table-disable-incompatibility-warning 'flyspell t)
5246 (display-warning 'table 5226 (display-warning 'table
@@ -5443,15 +5423,24 @@ It returns COLUMN unless STR contains some wide characters."
5443 idx 5423 idx
5444 nil))) 5424 nil)))
5445 5425
5426
5427;;;; Obsolete.
5428
5429(defvar table-disable-menu nil
5430 "When non-nil, use of menu by table package is disabled.
5431It must be set before loading this package `table.el' for the first
5432time.")
5433(make-obsolete-variable 'table-disable-menu "no longer used." "28.1")
5434
5446(defun table--set-timer (seconds func args) 5435(defun table--set-timer (seconds func args)
5447 "Generic wrapper for setting up a timer." 5436 "Generic wrapper for setting up a timer."
5437 (declare (obsolete run-with-idle-timer "28.1"))
5448 (run-with-idle-timer seconds nil func args)) 5438 (run-with-idle-timer seconds nil func args))
5449 5439
5450(defun table--get-last-command () 5440(defun table--get-last-command ()
5451 "Generic wrapper for getting the real last command." 5441 "Generic wrapper for getting the real last command."
5452 (if (boundp 'real-last-command) 5442 (declare (obsolete real-last-command "28.1"))
5453 real-last-command 5443 real-last-command)
5454 last-command))
5455 5444
5456(run-hooks 'table-load-hook) 5445(run-hooks 'table-load-hook)
5457 5446