[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/textmodes/table.el
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/textmodes/table.el |
Date: |
Fri, 18 Mar 2005 18:17:05 -0500 |
Index: emacs/lisp/textmodes/table.el
diff -c emacs/lisp/textmodes/table.el:1.11 emacs/lisp/textmodes/table.el:1.12
*** emacs/lisp/textmodes/table.el:1.11 Wed Feb 9 15:50:36 2005
--- emacs/lisp/textmodes/table.el Fri Mar 18 23:17:05 2005
***************
*** 1,11 ****
;;; table.el --- create and edit WYSIWYG text based embedded tables
! ;; Copyright (C) 2000, 01, 02, 03, 04 Free Software Foundation, Inc.
;; Keywords: wp, convenience
;; Author: Takaaki Ota <address@hidden>
;; Created: Sat Jul 08 2000 13:28:45 (PST)
! ;; Revised: Tue Jun 01 2004 11:36:39 (PDT)
;; This file is part of GNU Emacs.
--- 1,12 ----
;;; table.el --- create and edit WYSIWYG text based embedded tables
! ;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005
! ;; Free Software Foundation, Inc.
;; Keywords: wp, convenience
;; Author: Takaaki Ota <address@hidden>
;; Created: Sat Jul 08 2000 13:28:45 (PST)
! ;; Revised: Fri Mar 18 2005 13:50:13 (PST)
;; This file is part of GNU Emacs.
***************
*** 1024,1039 ****
:active (and (not buffer-read-only) (not (table--probe-cell)))
:help "Insert a text based table at point"]
["Row" table-insert-row
! :active (and (not buffer-read-only)
! (or (table--probe-cell)
! (save-excursion
! (table--find-row-column nil t))))
:help "Insert row(s) of cells in table"]
["Column" table-insert-column
! :active (and (not buffer-read-only)
! (or (table--probe-cell)
! (save-excursion
! (table--find-row-column 'column t))))
:help "Insert column(s) of cells in table"])
"----"
("Recognize"
--- 1025,1034 ----
:active (and (not buffer-read-only) (not (table--probe-cell)))
:help "Insert a text based table at point"]
["Row" table-insert-row
! :active (table--row-column-insertion-point-p)
:help "Insert row(s) of cells in table"]
["Column" table-insert-column
! :active (table--row-column-insertion-point-p 'column)
:help "Insert column(s) of cells in table"])
"----"
("Recognize"
***************
*** 1076,1091 ****
'("Table"
("Insert"
["Row" table-insert-row
! :active (and (not buffer-read-only)
! (or (table--probe-cell)
! (save-excursion
! (table--find-row-column nil t))))
:help "Insert row(s) of cells in table"]
["Column" table-insert-column
! :active (and (not buffer-read-only)
! (or (table--probe-cell)
! (save-excursion
! (table--find-row-column 'column t))))
:help "Insert column(s) of cells in table"])
("Delete"
["Row" table-delete-row
--- 1071,1080 ----
'("Table"
("Insert"
["Row" table-insert-row
! :active (table--row-column-insertion-point-p)
:help "Insert row(s) of cells in table"]
["Column" table-insert-column
! :active (table--row-column-insertion-point-p 'column)
:help "Insert column(s) of cells in table"])
("Delete"
["Row" table-delete-row
***************
*** 4698,4703 ****
--- 4687,4716 ----
(setq multiplier (1- multiplier)))
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)
"Search table and return a cell coordinate list of row or column."
(let ((current-coordinate (table--get-coordinate)))
***************
*** 5136,5142 ****
(defun table--editable-cell-p (&optional abort-on-error)
(and (not buffer-read-only)
! (table--probe-cell abort-on-error)))
(defun table--probe-cell (&optional abort-on-error)
"Probes a table cell around the point.
--- 5149,5155 ----
(defun table--editable-cell-p (&optional abort-on-error)
(and (not buffer-read-only)
! (get-text-property (point) 'table-cell)))
(defun table--probe-cell (&optional abort-on-error)
"Probes a table cell around the point.
***************
*** 5603,5607 ****
;; End: ***
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
! ;;; arch-tag: 0d69b03e-aa5f-4e72-8806-5727217617e0
;;; table.el ends here
--- 5616,5620 ----
;; End: ***
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
! ;; arch-tag: 0d69b03e-aa5f-4e72-8806-5727217617e0
;;; table.el ends here
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] Changes to emacs/lisp/textmodes/table.el,
Stefan Monnier <=