Function: batch-tit-dic-convert

batch-tit-dic-convert is a byte-compiled function defined in titdic-cnv.el.gz.

Signature

(batch-tit-dic-convert &optional FORCE)

Documentation

Run tit-dic-convert on the files remaining on the command line.

Use this from the command line, with -batch; it won't work in an interactive Emacs. For example, invoke "emacs -batch -f batch-tit-dic-convert XXX.tit" to
 generate Quail package file "xxx.el" from TIT dictionary file "XXX.tit".
To get complete usage, invoke "emacs -batch -f batch-tit-dic-convert -h".

Source Code

;; Defined in /usr/src/emacs/lisp/international/titdic-cnv.el.gz
(defun batch-tit-dic-convert (&optional force)
  "Run `tit-dic-convert' on the files remaining on the command line.
Use this from the command line, with `-batch';
it won't work in an interactive Emacs.
For example, invoke \"emacs -batch -f batch-tit-dic-convert XXX.tit\" to
 generate Quail package file \"xxx.el\" from TIT dictionary file \"XXX.tit\".
To get complete usage, invoke \"emacs -batch -f batch-tit-dic-convert -h\"."
  (defvar command-line-args-left)	; Avoid compiler warning.
  (if (not noninteractive)
      (error "`batch-tit-dic-convert' should be used only with -batch"))
  (if (string= (car command-line-args-left) "-h")
      (progn
	(message "To convert XXX.tit and YYY.tit into xxx.el and yyy.el:")
	(message "  %% emacs -batch -l titdic-cnv -f batch-tit-dic-convert XXX.tit YYY.tit")
	(message "To convert XXX.tit into DIR/xxx.el:")
	(message "  %% emacs -batch -l titdic-cnv -f batch-tit-dic-convert -dir DIR XXX.tit"))
    (let (targetdir filename files file)
      (if (string= (car command-line-args-left) "-dir")
	  (progn
	    (setq command-line-args-left (cdr command-line-args-left))
	    (setq targetdir (car command-line-args-left))
	    (setq command-line-args-left (cdr command-line-args-left))))
      (while command-line-args-left
	(setq filename (expand-file-name (car command-line-args-left)))
	(if (file-directory-p filename)
	    (progn
	      (message "Converting all tit files in the directory %s" filename)
	      (setq files (directory-files filename t "\\.tit\\'")))
	  (setq files (list filename)))
	(while files
	  (setq file (expand-file-name (car files)))
	  (when (or force
		    (file-newer-than-file-p
		     file (tit-make-quail-package-file-name file targetdir)))
	    (tit-dic-convert file targetdir))
	  (setq files (cdr files)))
	(setq command-line-args-left (cdr command-line-args-left)))))
  (kill-emacs 0))