]> code.delx.au - gnu-emacs/blobdiff - lisp/textmodes/tildify.el
Merge from emacs--rel--22
[gnu-emacs] / lisp / textmodes / tildify.el
index f9ec25721b1d1f4c1330332e36c458598e9a7fb3..9e282792dd5f81507a6fe503e8fadc24da841135 100644 (file)
@@ -1,10 +1,11 @@
 ;;; tildify.el --- adding hard spaces into texts
 
-;; Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+;;   2005, 2006, 2007 Free Software Foundation, Inc.
 
-;; Author:     Milan Zamazal <pdm@freesoft.cz>
-;; Version:    4.4
-;; Keywords:   text, TeX, SGML
+;; Author:     Milan Zamazal <pdm@zamazal.org>
+;; Version:    4.5
+;; Keywords:   text, TeX, SGML, wp
 
 ;; This file is part of GNU Emacs.
 
 
 ;; You should have received a copy of the GNU General Public License
 ;; 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.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
 ;; This package can be typically used for adding forgotten tildes in TeX
 ;; sources or adding `&nbsp;' sequences in SGML (e.g. HTML) texts.
 ;;
-;; For example, the Czech ortography requires to avoid one letter prepositions
-;; at line endings.  So they should be connected with following words by tilde.
-;; Some users forget to do this all the time.  Purpose of this program is to
-;; check the text and suggest adding of missing tildes on some places.  It
-;; works in similar manner like `query-replace-regexp'.
+;; For example, the Czech orthography requires avoiding one letter
+;; prepositions at line endings.  So they should be connected with the
+;; following words by a tilde.  Some users forget to do this all the
+;; time.  The purpose of this program is to check the text and suggest
+;; adding of missing tildes on some places.  It works in a similar
+;; manner to `query-replace-regexp'.
 ;;
-;; Functionality of this program is actually performing query replace on
-;; certain regions.  But from historical reasons explained above it is called
-;; `tildify'.
+;; The functionality of this program is actually performing query
+;; replace on certain regions, but for historical reasons explained
+;; above it is called `tildify'.
 ;;
 ;; The default variable settings are suited for Czech, so do not try to
 ;; understand them if you are not familiar with Czech grammar and spelling.
 ;;
-;; The algorithm was inspired by Petr Ol¹ák's program `vlna'.  Abbilities of
+;; The algorithm was inspired by Petr Ol¹ák's program `vlna'.  Abilities of
 ;; `tildify.el' are a little limited; if you have improvement suggestions, let
 ;; me know.
 
@@ -53,6 +55,7 @@
 
 (defgroup tildify nil
   "Adding missing hard spaces or other text fragments into texts."
+  :version "21.1"
   :group 'wp)
 
 (defcustom tildify-pattern-alist
@@ -60,7 +63,7 @@
   "Alist specifying where to insert hard spaces.
 
 Each alist item is of the form (MAJOR-MODE REGEXP NUMBER) or
-(MAJOR-MODE . SYMBOL).
+\(MAJOR-MODE . SYMBOL).
 
 MAJOR-MODE defines major mode, for which the item applies.  It can be either:
 - a symbol equal to the major mode of the buffer to be fixed
@@ -75,21 +78,22 @@ NUMBER defines the number of the REGEXP subexpression which should be replaced
 by the hard space character.
 
 The form (MAJOR-MODE . SYMBOL) defines alias item for MAJOR-MODE.  For this
-mode, the item for the mode SYMBOL is looked up in the alist instead.
-"
+mode, the item for the mode SYMBOL is looked up in the alist instead."
   :group 'tildify
   :type '(repeat (choice (list symbol regexp integer) (cons symbol symbol))))
 
 (defcustom tildify-string-alist
   '((latex-mode . "~")
     (tex-mode . latex-mode)
+    (plain-tex-mode . latex-mode)
     (sgml-mode . "&nbsp;")
+    (xml-mode . sgml-mode)
     (html-mode . sgml-mode)
     (t . " "))
   "Alist specifying what is a hard space in the current major mode.
 
 Each alist item is of the form (MAJOR-MODE . STRING) or
-(MAJOR-MODE . SYMBOL).
+\(MAJOR-MODE . SYMBOL).
 
 MAJOR-MODE defines major mode, for which the item applies.  It can be either:
 - a symbol equal to the major mode of the buffer to be fixed
@@ -101,16 +105,15 @@ STRING defines the hard space, which is inserted at places defined by
 for SGML.
 
 The form (MAJOR-MODE . SYMBOL) defines alias item for MAJOR-MODE.  For this
-mode, the item for the mode SYMBOL is looked up in the alist instead.
-"
+mode, the item for the mode SYMBOL is looked up in the alist instead."
   :group 'tildify
   :type '(repeat (cons symbol (choice string symbol))))
-     
+
 (defcustom tildify-ignored-environments-alist
   '((latex-mode
      ("\\\\\\\\" . "")         ; do not remove this
      ("\\\\begin{verbatim}" . "\\\\end{verbatim}")
-     ("\\\\verb\\(.\\)" . (1))
+     ("\\\\verb\\*?\\(.\\)" . (1))
      ("\\$\\$" . "\\$\\$")
      ("\\$" . "\\$")
      ("\\\\(" . "\\\\)")
@@ -158,8 +161,7 @@ END-REGEX defines end of the corresponding text part and can be either:
 - a list of regexps and numbers, which will compose the ending regexp by
   concatenating themselves, while replacing the numbers with corresponding
   subexpressions of BEG-REGEX (this is used to solve cases like
-  \\\\verb<character> in TeX)
-"
+  \\\\verb<character> in TeX)."
   :group 'tildify
   :type '(repeat (cons symbol (choice symbol (repeat sexp)))))
 
@@ -211,7 +213,7 @@ This function performs no refilling of the changed text."
                        (setq ask nil)
                      (if (eq aux nil)
                          (setq finish t)))))
-             (if (>= (marker-position z) (marker-position marker-end)) 
+             (if (>= (marker-position z) (marker-position marker-end))
                  (setq finish t))
              (or (>= (point) (marker-position z))
                  (goto-char (marker-position z)))
@@ -220,12 +222,12 @@ This function performs no refilling of the changed text."
                      (if (> (point) (marker-position marker-end))
                          (setq finish t))
                    (message
-                    (format "End of environment not found: %s" end-env))
+                    "End of environment not found: %s" end-env)
                    (setq finish t))))))
       ;; No ignored environments, tildify directly
       (tildify-tildify beg end ask)))
-  (message (format "%d spaces replaced." tildify-count)))
-             
+  (message "%d spaces replaced." tildify-count))
+
 ;;;###autoload
 (defun tildify-buffer ()
   "Add hard spaces in the current buffer.
@@ -261,7 +263,7 @@ This function performs no refilling of the changed text."
             (symbolp alist))
        (tildify-mode-alist mode-alist alist)
       alist)))
-  
+
 (defun tildify-find-env (regexp)
   "Find environment using REGEXP.
 Return regexp for the end of the environment or nil if no environment was
@@ -353,7 +355,5 @@ further questions)."
 ;; coding: iso-latin-2
 ;; End:
 
+;;; arch-tag: fc9b05a6-7355-4639-8170-dcf57853ba22
 ;;; tildify.el ends here
-
-
-