From: morioka Date: Tue, 10 Mar 1998 11:28:01 +0000 (+0000) Subject: tm 7.102. X-Git-Tag: tm-7_102 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf65572f1d6e9bb321ab10c9374ee4fb44a033d0;p=elisp%2Fmu-cite.git tm 7.102. --- diff --git a/latex-math-symbol.el b/latex-math-symbol.el index b8970ef..31e37d0 100644 --- a/latex-math-symbol.el +++ b/latex-math-symbol.el @@ -1,11 +1,11 @@ ;;; latex-math-symbol.el --- LaTeX math symbol decoder -;; Copyright (C) 1996 MORIOKA Tomohiko +;; Copyright (C) 1996,1997 MORIOKA Tomohiko ;; Author: MORIOKA Tomohiko ;; Created: 1996/7/1 ;; Version: -;; $Id: latex-math-symbol.el,v 1.2 1996/09/02 16:03:43 morioka Exp $ +;; $Id: latex-math-symbol.el,v 2.0 1997/01/17 05:11:03 morioka Exp $ ;; Keywords: LaTeX, math, mule ;; This file is part of MU (Message Utilities). @@ -21,8 +21,8 @@ ;; General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with this program; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Commentary: @@ -39,30 +39,110 @@ ;;; Code: (defvar latex-math-symbol-table-alist - '(("\\pi" . "$B&P(B") + '(("\\alpha" . ",Fa(B") + ("\\beta" . ",Fb(B") + ("\\gamma" . ",Fc(B")("\\Gamma" . "$B&#(B") + ("\\delta" . ",Fd(B")("\\Delta" . "$B&$(B") + ("\\epsilon" . ",Fe(B")("\\varepsilon" . "$B&E(B") + ("\\zeta" . ",Ff(B") + ("\\eta" . ",Fg(B") + ("\\theta" . ",Fh(B")("\\Theta" . "$B&((B") + ("\\iota" . ",Fi(B") + ("\\kappa" . ",Fj(B") + ("\\lambda" . ",Fk(B")("\\Lambda" . "$B&+(B") + ("\\mu" . ",Fl(B") + ("\\nu" . ",Fm(B") + ("\\xi" . ",Fn(B")("\\Xi" . "$B&.(B") + ("\\pi" . ",Fp(B")("\\Pi" . "$B&0(B") + ("\\rho" . ",Fq(B") + ("\\sigma" . ",Fs(B")("\\Sigma" . "$B&2(B") + ("\\varsigma" . ",Fr(B") + ("\\tau" . ",Ft(B") + ("\\upsilon" . ",Fu(B")("\\Upsilon" . "$B&4(B") + ("\\phi" . "$B&U(B")("\\Phi" . "$B&5(B") + ("\\varphi" . ",Fv(B") + ("\\chi" . ",Fw(B") + ("\\psi" . ",Fx(B")("\\Psi" . "$B&7(B") + ("\\omega" . ",Fy(B")("\\Omega" . "$B&8(B") ("\\{" . "$B!P(B")("\\}" . "$B!Q(B") + ("\\langle\\!\\langle" . "$B!T(B")("\\rangle\\!\\rangle" . "$B!U(B") + ("\\langle" . "$B!R(B")("\\rangle" . "$B!S(B") + ("\\cdots" . "$B!D(B") + + ("\\ln" . "$(G"L(B") + ("\\log" . "$(G"K(B") + + ("\\pm" . "$B!^(B") ("\\cdot" . "$B!&(B") - ("\\times" . "$B!_(B") + ("\\times" . "$B!_(B")("\\ast" . "$B!v(B") + ("\\star" . "$B!z(B") + ("\\bullet" . "$B!&(B") + ("\\div" . "$B!`(B") ("\\cap" . "$B"A(B")("\\cup" . "$B"@(B") + ("\\lhd" . "$(C"7(B")("\\rhd" . "$(C"9(B") + ("\\bigcirc" . "$B"~(B") + ("\\vee" . "$B"K(B")("\\lor" . "$B"K(B") + ("\\wedge" . "$B"J(B")("\\land" . "$B"J(B") + ("\\oplus" . "$(G"S(B") + ("\\odot" . "$(G"T(B") + ("\\dagger" . "$B"w(B")("\\ddagger" . "$B"x(B") ("\\leq" . "$(C!B(B")("\\geq" . "$(C!C(B") ("\\le" . "$(C!B(B")("\\ge" . "$(C!C(B") + ("\\ll" . "$B"c(B")("\\gg" . "$B"d(B") ("\\subseteq" . "$B"<(B")("\\supseteq" . "$B"=(B") ("\\subset" . "$B">(B")("\\supset" . "$B"?(B") - ("\\in" . "$B":(B")("\\ni" . "$B";(B") - ("\\mid" . "$B!C(B") + ("\\in" . "$B":(B") + ("\\ni" . "$B";(B")("\\owns" . "$B";(B") + ("\\frown" . "$B"^(B") + ("\\mid" . "$B!C(B")("\\parallel" . "$B!B(B") + ("\\sim" . "$B!A(B") + ("\\equiv" . "$B"a(B") + ("\\approx" . "$A!V(B") + ("\\not=" . "$B!b(B") ("\\neq" . "$B!b(B")("\\ne" . "$B!b(B") + ("\\perp" . "$B"](B") + + ("\\triangleup" . "$B"$(B") + ("\\forall" . "$B"O(B") + ("\\hbar" . ",C1(B")("\\imath" . ",C9(B") + ("\\ell" . "$(C'$(B") + ("\\partial" . "$B"_(B") + ("\\infty" . "$B!g(B") + ("\\smallint" . "$B"i(B") + ("\\P" . "$B"y(B") + ("\\prime" . "$B!l(B") + ("\\nabla" . "$B"`(B") + ("\\top" . "$(D0#(B")("\\bot" . "$(D0"(B") + ("\\vert" . "$B!C(B")("\\Vert" . "$B!B(B") + ("\\angle" . "$B"\(B") + ("\\triangle" . "$B"$(B") + ("\\backslash" . "$B!@(B") + ("\\S" . "$B!x(B") ("\\forall" . "$B"O(B") + ("\\exists" . "$B"P(B") + ("\\neg" . "$B"L(B")("\\lnot" . "$B"L(B") + ("\\flat" . "$B"u(B")("\\sharp" . "$B"t(B") + ("\\clubsuit" . "$(C"@(B") + ("\\diamondsuit" . "$B!~(B") + ("\\heartsuit" . "$(C"=(B") + ("\\spadesuit" . "$(C"<(B") ("\\leftarrow" . "$B"+(B")("\\rightarrow" . "$B"*(B") ("\\gets" . "$B"+(B")("\\to" . "$B"*(B") - ("^1" . ",A9(B") - ("^2" . ",A2(B") - ("^3" . ",A3(B") + ("^1" . ",A9(B")("^{1}" . ",A9(B") + ("^2" . ",A2(B")("^{2}" . ",A2(B") + ("^3" . ",A3(B")("^{3}" . ",A3(B") + ("^4" . "$(C)y(B")("^{4}" . "$(C)y(B") + ("^n" . "$(C)z(B")("^{n}" . "$(C)z(B") + ("_1" . "$(C){(B")("_{1}" . "$(C){(B") + ("_2" . "$(C)|(B")("_{2}" . "$(C)|(B") + ("_3" . "$(C)}(B")("_{3}" . "$(C)}(B") + ("_4" . "$(C)~(B")("_{4}" . "$(C)~(B") )) (defun latex-math-decode-region (beg end) @@ -70,12 +150,19 @@ (save-restriction (narrow-to-region beg end) (let ((rest latex-math-symbol-table-alist) + (case-fold-search nil) cell) (while rest (setq cell (car rest)) (goto-char beg) - (while (search-forward (car cell) nil t) - (replace-match (cdr cell)) + (while (re-search-forward + (concat "\\(" + (regexp-quote (car cell)) + "\\)\\([^a-zA-Z]\\|$\\)") + nil t) + (delete-region (match-beginning 1)(match-end 1)) + (goto-char (match-beginning 0)) + (insert (cdr cell)) ) (setq rest (cdr rest)) )))) diff --git a/mu-cite.el b/mu-cite.el index 09dcca8..51bff27 100644 --- a/mu-cite.el +++ b/mu-cite.el @@ -1,15 +1,15 @@ ;;; mu-cite.el --- yet another citation tool for GNU Emacs -;; Copyright (C) 1995,1996 Free Software Foundation, Inc. +;; Copyright (C) 1995,1996,1997 Free Software Foundation, Inc. ;; Author: MORIOKA Tomohiko ;; MINOURA Makoto ;; Shuhei KOBAYASHI ;; Maintainer: Shuhei KOBAYASHI -;; Version: $Revision: 7.42 $ +;; Version: $Revision: 7.44 $ ;; Keywords: mail, news, citation -;; This file is part of tl (Tiny Library). +;; This file is part of MU (Message Utilities). ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as @@ -54,7 +54,7 @@ ;;; (defconst mu-cite/RCS-ID - "$Id: mu-cite.el,v 7.42 1996/10/03 06:44:24 morioka Exp $") + "$Id: mu-cite.el,v 7.44 1997/01/13 15:49:13 morioka Exp $") (defconst mu-cite/version (get-version-string mu-cite/RCS-ID)) @@ -390,45 +390,71 @@ function according to the agreed upon standard." ;;; @ message editing utilities ;;; + +(defvar citation-mark-chars ">}|" + "*String of characters for citation delimiter. [mu-cite.el]") -(defvar cited-prefix-regexp "^[^ \t>]*[>|]+[ \t#]*" - "*Regexp to match the citation prefix.") +(defun detect-paragraph-cited-prefix () + (save-excursion + (goto-char (point-min)) + (let ((i 0) + (prefix + (buffer-substring + (progn (beginning-of-line)(point)) + (progn (end-of-line)(point)) + )) + str ret) + (while (and (= (forward-line) 0) + (setq str (buffer-substring + (progn (beginning-of-line)(point)) + (progn (end-of-line)(point)))) + (setq ret (string-compare-from-top prefix str)) + ) + (setq prefix (second ret)) + (setq i (1+ i)) + ) + (cond ((> i 1) prefix) + ((> i 0) + (goto-char (point-min)) + (save-restriction + (narrow-to-region (point) + (+ (point)(length prefix))) + (goto-char (point-max)) + (if (re-search-backward + (concat "[" citation-mark-chars "]") nil t) + (progn + (goto-char (match-end 0)) + (if (looking-at "[ \t]+") + (goto-char (match-end 0)) + ) + (buffer-substring (point-min)(point)) + ) + prefix))) + ((progn + (goto-char (point-max)) + (re-search-backward (concat "[" citation-mark-chars "]") + nil t) + ) + (goto-char (match-end 0)) + (if (looking-at "[ \t]+") + (goto-char (match-end 0)) + ) + (buffer-substring (point-min)(point)) + ) + (t "")) + ))) (defun fill-cited-region (beg end) (interactive "*r") (save-excursion (save-restriction (goto-char end) - (while (not (eolp)) - (backward-char) - ) - (setq end (point)) + (and (search-backward "\n" nil t) + (setq end (match-end 0)) + ) (narrow-to-region beg end) - (goto-char (point-min)) - (let* ((fill-prefix - (let* ((str1 (buffer-substring - (progn (beginning-of-line)(point)) - (progn (end-of-line)(point)) - )) - (str2 (let ((p0 (point))) - (forward-line) - (if (> (count-lines p0 (point)) 0) - (buffer-substring - (progn (beginning-of-line)(point)) - (progn (end-of-line)(point)) - )))) - (ret (string-compare-from-top str1 str2)) - ) - (if ret - (let ((prefix (nth 1 ret))) - (if (string-match cited-prefix-regexp prefix) - (substring prefix 0 (match-end 0)) - prefix)) - (goto-char (point-min)) - (if (re-search-forward cited-prefix-regexp nil t) - (buffer-substring (match-beginning 0) (match-end 0)) - )))) - (pat (concat "\n" fill-prefix)) + (let* ((fill-prefix (detect-paragraph-cited-prefix)) + (pat (concat fill-prefix "\n")) ) (goto-char (point-min)) (while (search-forward pat nil t) @@ -450,8 +476,6 @@ function according to the agreed upon standard." (fill-region (point-min) (point-max)) )))) -(defvar citation-mark-chars ">}|") - (defun compress-cited-prefix () (interactive) (save-excursion