yatex

changeset 156:9b5c19e860d8 dev

Simplify codes.
author yuuji@gentei.org
date Thu, 09 Dec 2010 14:41:57 +0900
parents 4fd09665b2be
children e3d7307f71e0
files yahtml.el
diffstat 1 files changed, 17 insertions(+), 17 deletions(-) [+]
line diff
     1.1 --- a/yahtml.el	Thu Dec 09 13:51:20 2010 +0900
     1.2 +++ b/yahtml.el	Thu Dec 09 14:41:57 2010 +0900
     1.3 @@ -1,6 +1,6 @@
     1.4  ;;; -*- Emacs-Lisp -*-
     1.5  ;;; (c) 1994-2010 by HIROSE Yuuji [yuuji(@)yatex.org]
     1.6 -;;; Last modified Thu Dec  9 13:50:21 2010 on firestorm
     1.7 +;;; Last modified Thu Dec  9 14:40:52 2010 on firestorm
     1.8  ;;; $Id$
     1.9  
    1.10  (defconst yahtml-revision-number "1.74.2"
    1.11 @@ -2338,7 +2338,10 @@
    1.12    "Enclose each item in a region with <td>..</td>.
    1.13  Interactive prefix argument consults enclosing element other than td."
    1.14    (interactive "P\nsDelimiter(s): \nr")
    1.15 -  (let ((e (if (and e (listp e)) (read-string "Enclose with : " "td") "td"))
    1.16 +  (let ((e (cond
    1.17 +	    ((null e) "td")
    1.18 +	    ((stringp e) e)
    1.19 +	    (t (read-string "Enclose with: " "td"))))
    1.20  	p q (ws "[ \t]"))
    1.21      (if (string= delim "") (setq delim " \t\n"))
    1.22      (setq delim (concat "[" delim "]+"))
    1.23 @@ -2363,21 +2366,18 @@
    1.24  (defun yahtml-tr-region (e delim beg end)
    1.25    "Enclose lines in a form tab-sv/csv with <tr><td>..</td></tr>."
    1.26    (interactive "P\nsDelimiter(s): \nr")
    1.27 -  (let ((e (if (and e (listp e)) (read-string "Enclose with : " "td") "td"))
    1.28 -	p q)
    1.29 -    (if (string= delim "") (setq delim " \t\n"))
    1.30 -    ;; (setq delim (concat "[" delim "]+")) ;unnecessary here
    1.31 -    (save-excursion
    1.32 -      (save-restriction
    1.33 -	(narrow-to-region (point) (mark))
    1.34 -	(goto-char (point-min))
    1.35 -	(while (not (eobp))
    1.36 -	  (insert "<tr>")
    1.37 -	  (yahtml-td-region e delim (point) (point-end-of-line))
    1.38 -	  (end-of-line)
    1.39 -	  (insert "</tr>")
    1.40 -	  (yahtml-indent-line)
    1.41 -	  (forward-line 1))))))
    1.42 +  (setq e (if (and e (listp e)) (read-string "Enclose with: " "th")))
    1.43 +  (save-excursion
    1.44 +    (save-restriction
    1.45 +      (narrow-to-region (point) (mark))
    1.46 +      (goto-char (point-min))
    1.47 +      (while (not (eobp))
    1.48 +	(insert "<tr>")
    1.49 +	(yahtml-td-region e delim (point) (point-end-of-line))
    1.50 +	(end-of-line)
    1.51 +	(insert "</tr>")
    1.52 +	(yahtml-indent-line)
    1.53 +	(forward-line 1)))))
    1.54  	
    1.55  ;;; ---------- filling ----------
    1.56  (defvar yahtml-saved-move-to-column (symbol-function 'move-to-column))