Commit 951f97e6 authored by Stefan Monnier's avatar Stefan Monnier
Browse files

(table--line-column-position): New idiom.

(table--row-column-insertion-point-p): New function to test
validity of row and column insertion operation at a location.
(table-global-menu, table-cell-menu): Use above functions for
deterministic test operation.
(table--editable-cell-p): Behave in deterministic fashion.
parent 9188be47
2005-03-18 Tak Ota <Takaaki.Ota@am.sony.com>
* textmodes/table.el (table--line-column-position): New idiom.
(table--row-column-insertion-point-p): New function to test
validity of row and column insertion operation at a location.
(table-global-menu, table-cell-menu): Use above functions for
deterministic test operation.
(table--editable-cell-p): Behave in deterministic fashion.
2005-03-18 Juri Linkov <juri@jurta.org> 2005-03-18 Juri Linkov <juri@jurta.org>
   
* isearch.el (isearch-lazy-highlight-new-loop): * isearch.el (isearch-lazy-highlight-new-loop):
...@@ -7,8 +16,8 @@ ...@@ -7,8 +16,8 @@
(isearch-lazy-highlight-search): Let-bind case-fold-search to (isearch-lazy-highlight-search): Let-bind case-fold-search to
isearch-lazy-highlight-case-fold-search instead of isearch-lazy-highlight-case-fold-search instead of
isearch-case-fold-search, and let-bind isearch-regexp to isearch-case-fold-search, and let-bind isearch-regexp to
isearch-lazy-highlight-regexp. Use isearch-lazy-highlight-regexp.
isearch-lazy-highlight-last-string instead of isearch-string. Use isearch-lazy-highlight-last-string instead of isearch-string.
   
* replace.el (perform-replace): Remove bindings of global * replace.el (perform-replace): Remove bindings of global
variables isearch-string, isearch-regexp, isearch-case-fold-search. variables isearch-string, isearch-regexp, isearch-case-fold-search.
...@@ -16,7 +25,7 @@ ...@@ -16,7 +25,7 @@
(replace-highlight): Add arguments string, regexp, case-fold. (replace-highlight): Add arguments string, regexp, case-fold.
Let-bind isearch-string, isearch-regexp, isearch-case-fold-search Let-bind isearch-string, isearch-regexp, isearch-case-fold-search
to allow isearch-lazy-highlight-new-loop to use these values to allow isearch-lazy-highlight-new-loop to use these values
to set corresponding isearch-lazy-highlight-... internal to set corresponding isearch-lazy-highlight-* internal
variables whose values lazy highlighting will use regardless of variables whose values lazy highlighting will use regardless of
changes to global variables isearch-string, isearch-regexp, changes to global variables isearch-string, isearch-regexp,
isearch-case-fold-search during lazy highlighting loop. isearch-case-fold-search during lazy highlighting loop.
...@@ -41,13 +50,13 @@ ...@@ -41,13 +50,13 @@
* isearch.el (lazy-highlight-cleanup) <command>: Rename from * isearch.el (lazy-highlight-cleanup) <command>: Rename from
`isearch-lazy-highlight-cleanup', add alias to old name and `isearch-lazy-highlight-cleanup', add alias to old name and
declare obsolete. Add release numbers to other obsolete vars. declare obsolete. Add release numbers to other obsolete vars.
(isearch-done, isearch-lazy-highlight-new-loop): Rename (isearch-done, isearch-lazy-highlight-new-loop):
`isearch-lazy-highlight-cleanup' to `lazy-highlight-cleanup'. Rename `isearch-lazy-highlight-cleanup' to `lazy-highlight-cleanup'.
(lazy-highlight-cleanup) <variable>: Doc fix. (lazy-highlight-cleanup) <variable>: Doc fix.
(isearch-lazy-highlight-update): Rename obsolete (isearch-lazy-highlight-update): Rename obsolete
`isearch-lazy-highlight-face' to `lazy-highlight-face'. `isearch-lazy-highlight-face' to `lazy-highlight-face'.
   
2005-03-18 handa <handa@m17n.org> 2005-03-18 Kenichi Handa <handa@m17n.org>
   
* language/thai-util.el: Fix categorization of Thai characters in * language/thai-util.el: Fix categorization of Thai characters in
thai-category-table. thai-category-table.
...@@ -74,7 +83,7 @@ ...@@ -74,7 +83,7 @@
(rmail-pop-password-required, rmail-remote-password): Doc fixes. (rmail-pop-password-required, rmail-remote-password): Doc fixes.
(rmail-preserve-inbox, rmail-probe, rmail-autodetect): Doc fix. (rmail-preserve-inbox, rmail-probe, rmail-autodetect): Doc fix.
   
* mail/sendmail.el (sendmail-send-it): Reenaable the code * mail/sendmail.el (sendmail-send-it): Reenable the code
to compute resend-to-address and use it. to compute resend-to-address and use it.
   
* tar-mode.el (tar-mode): Turn off undo unconditionally. * tar-mode.el (tar-mode): Turn off undo unconditionally.
...@@ -89,8 +98,6 @@ ...@@ -89,8 +98,6 @@
* bindings.el (esc-map): Make M-g a prefix. * bindings.el (esc-map): Make M-g a prefix.
Bind M-g g and M-g M-g to goto-line. Bind M-g g and M-g M-g to goto-line.
   
* progmodes/perl-mode.el (perl-mode): Use run-mode-hooks.
* faces.el (face-id): Doc fix. * faces.el (face-id): Doc fix.
   
2005-03-17 Frederik Fouvry <fouvry@CoLi.Uni-SB.DE> 2005-03-17 Frederik Fouvry <fouvry@CoLi.Uni-SB.DE>
......
;;; table.el --- create and edit WYSIWYG text based embedded tables ;;; table.el --- create and edit WYSIWYG text based embedded tables
;; Copyright (C) 2000, 01, 02, 03, 04 Free Software Foundation, Inc. ;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005
;; Free Software Foundation, Inc.
;; Keywords: wp, convenience ;; Keywords: wp, convenience
;; Author: Takaaki Ota <Takaaki.Ota@am.sony.com> ;; Author: Takaaki Ota <Takaaki.Ota@am.sony.com>
;; Created: Sat Jul 08 2000 13:28:45 (PST) ;; Created: Sat Jul 08 2000 13:28:45 (PST)
;; Revised: Tue Jun 01 2004 11:36:39 (PDT) ;; Revised: Fri Mar 18 2005 13:50:13 (PST)
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
...@@ -1024,16 +1025,10 @@ This is always set to nil at the entry to `table-with-cache-buffer' before execu ...@@ -1024,16 +1025,10 @@ This is always set to nil at the entry to `table-with-cache-buffer' before execu
:active (and (not buffer-read-only) (not (table--probe-cell))) :active (and (not buffer-read-only) (not (table--probe-cell)))
:help "Insert a text based table at point"] :help "Insert a text based table at point"]
["Row" table-insert-row ["Row" table-insert-row
:active (and (not buffer-read-only) :active (table--row-column-insertion-point-p)
(or (table--probe-cell)
(save-excursion
(table--find-row-column nil t))))
:help "Insert row(s) of cells in table"] :help "Insert row(s) of cells in table"]
["Column" table-insert-column ["Column" table-insert-column
:active (and (not buffer-read-only) :active (table--row-column-insertion-point-p 'column)
(or (table--probe-cell)
(save-excursion
(table--find-row-column 'column t))))
:help "Insert column(s) of cells in table"]) :help "Insert column(s) of cells in table"])
"----" "----"
("Recognize" ("Recognize"
...@@ -1076,16 +1071,10 @@ This is always set to nil at the entry to `table-with-cache-buffer' before execu ...@@ -1076,16 +1071,10 @@ This is always set to nil at the entry to `table-with-cache-buffer' before execu
'("Table" '("Table"
("Insert" ("Insert"
["Row" table-insert-row ["Row" table-insert-row
:active (and (not buffer-read-only) :active (table--row-column-insertion-point-p)
(or (table--probe-cell)
(save-excursion
(table--find-row-column nil t))))
:help "Insert row(s) of cells in table"] :help "Insert row(s) of cells in table"]
["Column" table-insert-column ["Column" table-insert-column
:active (and (not buffer-read-only) :active (table--row-column-insertion-point-p 'column)
(or (table--probe-cell)
(save-excursion
(table--find-row-column 'column t))))
:help "Insert column(s) of cells in table"]) :help "Insert column(s) of cells in table"])
("Delete" ("Delete"
["Row" table-delete-row ["Row" table-delete-row
...@@ -4698,6 +4687,30 @@ of line." ...@@ -4698,6 +4687,30 @@ of line."
(setq multiplier (1- multiplier))) (setq multiplier (1- multiplier)))
ret-str)) ret-str))
(defun table--line-column-position (line column)
"Return the location of LINE forward at COLUMN."
(save-excursion
(forward-line line)
(move-to-column column)
(point)))
(defun table--row-column-insertion-point-p (&optional columnp)
"Return non nil if it makes sense to insert a row or a column at point."
(and (not buffer-read-only)
(or (get-text-property (point) 'table-cell)
(let ((column (current-column)))
(if columnp
(or (text-property-any (line-beginning-position 0)
(table--line-column-position -1 column)
'table-cell t)
(text-property-any (line-beginning-position) (point) 'table-cell t)
(text-property-any (line-beginning-position 2)
(table--line-column-position 1 column)
'table-cell t))
(text-property-any (table--line-column-position -2 column)
(table--line-column-position -2 (+ 2 column))
'table-cell t))))))
(defun table--find-row-column (&optional columnp no-error) (defun table--find-row-column (&optional columnp no-error)
"Search table and return a cell coordinate list of row or column." "Search table and return a cell coordinate list of row or column."
(let ((current-coordinate (table--get-coordinate))) (let ((current-coordinate (table--get-coordinate)))
...@@ -5136,7 +5149,7 @@ Focus only on the corner pattern. Further cell validity check is required." ...@@ -5136,7 +5149,7 @@ Focus only on the corner pattern. Further cell validity check is required."
(defun table--editable-cell-p (&optional abort-on-error) (defun table--editable-cell-p (&optional abort-on-error)
(and (not buffer-read-only) (and (not buffer-read-only)
(table--probe-cell abort-on-error))) (get-text-property (point) 'table-cell)))
(defun table--probe-cell (&optional abort-on-error) (defun table--probe-cell (&optional abort-on-error)
"Probes a table cell around the point. "Probes a table cell around the point.
...@@ -5603,5 +5616,5 @@ It returns COLUMN unless STR contains some wide characters." ...@@ -5603,5 +5616,5 @@ It returns COLUMN unless STR contains some wide characters."
;; End: *** ;; End: ***
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; arch-tag: 0d69b03e-aa5f-4e72-8806-5727217617e0 ;; arch-tag: 0d69b03e-aa5f-4e72-8806-5727217617e0
;;; table.el ends here ;;; table.el ends here
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment