unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Tak Ota <Takaaki.Ota@am.sony.com>
Subject: interactive-p fix for table.el
Date: Mon, 15 Nov 2004 10:43:10 -0800 (PST)	[thread overview]
Message-ID: <20041115.104310.34004663.Takaaki.Ota@am.sony.com> (raw)

If the following patch looks OK someone please check it in.  Thanks in
advance.

-Tak


2004-11-15  Takaaki Ota  <Takaaki.Ota@am.sony.com>

	* textmodes/table.el (table-recognize-cell): Use a newly added
	optional argument PROBE-CURRENT-CELL instead of calling
	interactive-p.
	(table-query-dimension): Use a newly added optional argument
	VERBOSE instead of calling interactive-p.
	(table-generate-source): Use called-interactively-p instead of
	interactive-p.
	(table-insert-sequence): Ditto.
	(table--warn-incompatibility): Ditto.


*** pure/emacs-21.3.50/lisp/textmodes/table.el	Thu Nov  4 07:00:34 2004
--- emacs-21.3.50/lisp/textmodes/table.el	Thu Nov 11 16:41:13 2004
***************
*** 5,11 ****
  ;; Keywords: wp, convenience
  ;; Author: Takaaki Ota <Takaaki.Ota@am.sony.com>
  ;; 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.
  
--- 5,11 ----
  ;; Keywords: wp, convenience
  ;; Author: Takaaki Ota <Takaaki.Ota@am.sony.com>
  ;; Created: Sat Jul 08 2000 13:28:45 (PST)
! ;; Revised: Thu Nov 11 2004 16:41:13 (PST)
  
  ;; This file is part of GNU Emacs.
  
***************
*** 2043,2059 ****
    (table-recognize-table -1))
  
  ;;;###autoload
! (defun table-recognize-cell (&optional force no-copy arg)
    "Recognize a table cell that contains current point.
  Probe the cell dimension and prepare the cell information.  The
! optional two arguments FORCE and NO-COPY are for internal use only and
! must not be specified.  When the optional numeric prefix argument ARG
! is negative the cell becomes inactive, meaning that the cell becomes
! plain text and loses all the table specific features."
!   (interactive "i\ni\np")
    (table--make-cell-map)
    (if (or force (not (memq (table--get-last-command) table-command-list)))
!       (let* ((cell (table--probe-cell (interactive-p)))
  	     (cache-buffer (get-buffer-create table-cache-buffer-name))
  	     (modified-flag (buffer-modified-p))
  	     (inhibit-read-only t))
--- 2043,2062 ----
    (table-recognize-table -1))
  
  ;;;###autoload
! (defun table-recognize-cell (&optional force no-copy arg probe-current-cell)
    "Recognize a table cell that contains current point.
  Probe the cell dimension and prepare the cell information.  The
! optional two arguments FORCE and NO-COPY are for internal use
! only and must not be specified.  When the optional numeric prefix
! argument ARG is negative the cell becomes inactive, meaning that
! the cell becomes plain text and loses all the table specific
! features.  If PROBE-CURRENT-CELL is non-nil (which is always,
! when called interactively), the cell at the current point is
! probed and flush the delayed tasks if necessary."
!   (interactive "i\ni\np\np")
    (table--make-cell-map)
    (if (or force (not (memq (table--get-last-command) table-command-list)))
!       (let* ((cell (table--probe-cell probe-current-cell))
  	     (cache-buffer (get-buffer-create table-cache-buffer-name))
  	     (modified-flag (buffer-modified-p))
  	     (inhibit-read-only t))
***************
*** 2947,2964 ****
    (table--update-cell-face))
  
  ;;;###autoload
! (defun table-query-dimension (&optional where)
    "Return the dimension of the current cell and the current table.
  The result is a list (cw ch tw th c r cells) where cw is the cell
! width, ch is the cell height, tw is the table width, th is the table
! height, c is the number of columns, r is the number of rows and cells
! is the total number of cells.  The cell dimension excludes the cell
! frame while the table dimension includes the table frame.  The columns
! and the rows are counted by the number of cell boundaries.  Therefore
! the number tends to be larger than it appears for the tables with
! non-uniform cell structure (heavily spanned and split).  When optional
! WHERE is provided the cell and table at that location is reported."
!   (interactive)
    (save-excursion
      (if where (goto-char where))
      (let ((starting-cell (table--probe-cell))
--- 2950,2971 ----
    (table--update-cell-face))
  
  ;;;###autoload
! (defun table-query-dimension (&optional where verbose)
    "Return the dimension of the current cell and the current table.
  The result is a list (cw ch tw th c r cells) where cw is the cell
! width, ch is the cell height, tw is the table width, th is the
! table height, c is the number of columns, r is the number of rows
! and cells is the total number of cells.  The cell dimension
! excludes the cell frame while the table dimension includes the
! table frame.  The columns and the rows are counted by the number
! of cell boundaries.  Therefore the number tends to be larger than
! it appears for the tables with non-uniform cell
! structure (heavily spanned and split).  When optional WHERE is
! provided the cell and table at that location is reported.  If
! VERBOSE is non-nil (which is always, when called interactively),
! prints the some messages including human friendly result in the
! minibuffer."
!   (interactive "P\np")
    (save-excursion
      (if where (goto-char where))
      (let ((starting-cell (table--probe-cell))
***************
*** 2968,2975 ****
  	(setq table-rb (cdr starting-cell))
  	(setq col-list (cons (car (table--get-coordinate (car starting-cell))) nil))
  	(setq row-list (cons (cdr (table--get-coordinate (car starting-cell))) nil))
! 	(and (interactive-p)
! 	     (message "Computing cell dimension..."))
  	(while
  	    (progn
  	      (table-forward-cell 1 t)
--- 2975,2982 ----
  	(setq table-rb (cdr starting-cell))
  	(setq col-list (cons (car (table--get-coordinate (car starting-cell))) nil))
  	(setq row-list (cons (cdr (table--get-coordinate (car starting-cell))) nil))
! 	(if verbose
! 	    (message "Computing cell dimension..."))
  	(while
  	    (progn
  	      (table-forward-cell 1 t)
***************
*** 2995,3002 ****
  	       (th (+ 3 (- (cdr table-rb-coordinate) (cdr table-lu-coordinate))))
  	       (c (length col-list))
  	       (r (length row-list)))
! 	  (and (interactive-p)
! 	       (message "Cell: (%dw, %dh), Table: (%dw, %dh), Dim: (%dc, %dr), Total Cells: %d" cw ch tw th c r cells))
  	  (list cw ch tw th c r cells))))))
  
  ;;;###autoload
--- 3002,3009 ----
  	       (th (+ 3 (- (cdr table-rb-coordinate) (cdr table-lu-coordinate))))
  	       (c (length col-list))
  	       (r (length row-list)))
! 	  (if verbose
! 	      (message "Cell: (%dw, %dh), Table: (%dw, %dh), Dim: (%dc, %dr), Total Cells: %d" cw ch tw th c r cells))
  	  (list cw ch tw th c r cells))))))
  
  ;;;###autoload
***************
*** 3040,3046 ****
        (read-buffer "Destination buffer: " (concat table-dest-buffer-name "." language))
        (table--read-from-minibuffer '("Table Caption" . table-source-caption-history)))))
    (let ((default-buffer-name (concat table-dest-buffer-name "." (symbol-name language))))
!     (unless (or (interactive-p) (table--probe-cell)) (error "Table not found here"))
      (unless (bufferp dest-buffer)
        (setq dest-buffer (get-buffer-create (or dest-buffer default-buffer-name))))
      (if (string= (buffer-name dest-buffer) default-buffer-name)
--- 3047,3053 ----
        (read-buffer "Destination buffer: " (concat table-dest-buffer-name "." language))
        (table--read-from-minibuffer '("Table Caption" . table-source-caption-history)))))
    (let ((default-buffer-name (concat table-dest-buffer-name "." (symbol-name language))))
!     (unless (or (called-interactively-p) (table--probe-cell)) (error "Table not found here"))
      (unless (bufferp dest-buffer)
        (setq dest-buffer (get-buffer-create (or dest-buffer default-buffer-name))))
      (if (string= (buffer-name dest-buffer) default-buffer-name)
***************
*** 3062,3068 ****
  	(let ((wheel [?- ?\\ ?| ?/]))
  	  (while
  	      (progn
! 		(if (interactive-p)
  		    (progn
  		      (message "Analyzing table...%c" (aref wheel i))
  		      (if (eq (setq i (1+ i)) (length wheel))
--- 3069,3075 ----
  	(let ((wheel [?- ?\\ ?| ?/]))
  	  (while
  	      (progn
! 		(if (called-interactively-p)
  		    (progn
  		      (message "Analyzing table...%c" (aref wheel i))
  		      (if (eq (setq i (1+ i)) (length wheel))
***************
*** 3099,3105 ****
  	;; insert closing
  	(table--generate-source-epilogue dest-buffer language col-list row-list))
        ;; lastly do some convenience work
!       (if (interactive-p)
  	  (save-selected-window
  	    (pop-to-buffer dest-buffer t)
  	    (goto-char (point-min))
--- 3106,3112 ----
  	;; insert closing
  	(table--generate-source-epilogue dest-buffer language col-list row-list))
        ;; lastly do some convenience work
!       (if (called-interactively-p)
  	  (save-selected-window
  	    (pop-to-buffer dest-buffer t)
  	    (goto-char (point-min))
***************
*** 3448,3456 ****
  				(format "Justify (default %s): " default)
  				'(("left") ("center") ("right"))
  				nil t nil 'table-sequence-justify-history default)))))))
!   (unless (or (interactive-p) (table--probe-cell)) (error "Table not found here"))
    (string-match "\\([0-9]*\\)\\([]})>]*\\)\\'" str)
!   (if (interactive-p)
        (message "Sequencing..."))
    (let* ((prefix (substring str 0 (match-beginning 1)))
  	 (index (match-string 1 str))
--- 3455,3463 ----
  				(format "Justify (default %s): " default)
  				'(("left") ("center") ("right"))
  				nil t nil 'table-sequence-justify-history default)))))))
!   (unless (or (called-interactively-p) (table--probe-cell)) (error "Table not found here"))
    (string-match "\\([0-9]*\\)\\([]})>]*\\)\\'" str)
!   (if (called-interactively-p)
        (message "Sequencing..."))
    (let* ((prefix (substring str 0 (match-beginning 1)))
  	 (index (match-string 1 str))
***************
*** 3498,3504 ****
  	       (setq cells (1- cells))
  	       (and (> n 0) (> cells 0)))))
      (table-recognize-cell 'force)
!     (if (interactive-p)
  	(message "Sequencing...done"))
      ))
  
--- 3505,3511 ----
  	       (setq cells (1- cells))
  	       (and (> n 0) (> cells 0)))))
      (table-recognize-cell 'force)
!     (if (called-interactively-p)
  	(message "Sequencing...done"))
      ))
  
***************
*** 5346,5352 ****
  This feature is disabled when `table-disable-incompatibility-warning'
  is non-nil.  The warning is done only once per session for each item."
    (unless (and table-disable-incompatibility-warning
! 	       (not (interactive-p)))
      (cond ((and (featurep 'xemacs)
  		(not (get 'table-disable-incompatibility-warning 'xemacs)))
  	   (put 'table-disable-incompatibility-warning 'xemacs t)
--- 5353,5359 ----
  This feature is disabled when `table-disable-incompatibility-warning'
  is non-nil.  The warning is done only once per session for each item."
    (unless (and table-disable-incompatibility-warning
! 	       (not (called-interactively-p)))
      (cond ((and (featurep 'xemacs)
  		(not (get 'table-disable-incompatibility-warning 'xemacs)))
  	   (put 'table-disable-incompatibility-warning 'xemacs t)

             reply	other threads:[~2004-11-15 18:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-15 18:43 Tak Ota [this message]
2004-11-17  5:04 ` interactive-p fix for table.el Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041115.104310.34004663.Takaaki.Ota@am.sony.com \
    --to=takaaki.ota@am.sony.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).