1;;; i18n-man-de.el --- browse UNIX German manual pages
2;;; $Id: i18n-man-de.el,v 1.1 1998/09/20 16:29:09 iwasaki Exp $:
3
4;;;  This file part of i18n-man - i18nized man,
5;;;  a GNU Emacs front end to browse the UNIX manual pages in various languages.
6
7;;; Everyone is granted permission to copy, modify and redistribute
8;;; this program.
9
10;;; HISTORY
11;;;
12;;;	Written by Mitsuru IWASAKI 14 Sep, 1998 (FreeBSD Japanese man Project)
13;;;
14
15;;; Suggested USAGE
16;;;
17;;;  In your ~/.emacs
18;;;(autoload 'dman "i18n-man-de" nil t)
19;;;(autoload 'eman "i18n-man-en" nil t)
20;;;  then
21;;;  M-x dman
22;;;    to get a German manual page thru man(1) and put it in a buffer.
23;;;  M-x eman
24;;;    to get a English manual page thru man(1) and put it in a buffer.
25
26;;; NOTE: This code requires FreeBSD ports/german/manpages (or packages de-manpages-1.0)
27;;; installed on your system, GNU troff version 1.10, man(1) of FreeBSD.
28;;; To format manpages, this code setting several environment variables,
29;;; (setenv GROFF_TYPESETTER latin1, setenv MANPATH /usr/local/man/de_DE.ISO_8859-1:$MANPATH),
30;;; and invoking man with -t to use /usr/bin/groff -man in current implementation.
31;;; Other man(1) optoins (like -a, -k) may be ignored because of -t option.
32;;; I'm not sure that this is the correct way to format the german manpages, and
33;;; works well on other systems as well.  Please let me informed better solution if you know.
34;;; iwasaki@jp.FreeBSD.org
35
36
37(require 'i18n-man)
38
39(defun i18n-Man-de-init-defvars ()
40  "Used for initialising variables for German i18n-man."
41  (i18n-Man-init-lang-depend-variables)
42  (setq i18n-manual-lang-depend-program "man -t")
43  (setq i18n-Man-lang-depend-language-string "German")
44  (setq i18n-Man-lang-depend-heading-regexp
45	"^\\([A-Z][A-Z ]+\\)$")
46  (setq i18n-Man-lang-depend-see-also-regexp
47	"SIEHE AUCH\\|^SEE ALSO")
48  (setq i18n-Man-lang-depend-first-heading-regexp
49	"^[ \t]*BEZEICHNUNG$\\|^[ \t]*NAME$\\|^[ \t]*No manual entry fo.*$")
50
51  (setq i18n-Man-lang-depend-cooked-hook
52	'i18n-Man-de-depend-softhyphen-to-minus)
53  (setq i18n-Man-lang-depend-process-starting-hook
54	'i18n-Man-de-depend-process-starting-hook)
55  (setq i18n-Man-lang-depend-process-started-hook
56	'i18n-Man-de-depend-process-started-hook))
57
58(defun i18n-Man-de-depend-softhyphen-to-minus ()
59  ;; \201\255 is some kind of dash in Latin-1.
60  (goto-char (point-min))
61  (if (i18n-Man-multibyteb-characters-enablep)
62      (while (search-forward "\201\255" nil t)
63	(let ((p (get-text-property (- (point) 3) 'face)))
64	  (replace-match "-")
65	  (put-text-property (- (point) 1) (point) 'face p)))))
66
67;; for temporary use.
68(defvar i18n-Man-de-depend-process-coding-system-alist nil)
69(defvar i18n-Man-de-depend-default-process-coding-system nil)
70
71(require 'cl)
72(defun i18n-Man-de-depend-process-starting-hook ()
73  "Hook for the German manpage depend man command and troff formatter setting.
74Also save original values of variable to the local variable temporary."
75  (setenv "MANPATH" (format "%s:%s" "/usr/local/man/de_DE.ISO_8859-1" (getenv "MANPATH")))
76  (setenv "GROFF_TYPESETTER" "latin1")
77  (if (featurep 'mule)
78      (case emacs-major-version
79	(20 ;; XEmacs or Emacs-20.x (Mule-2.4, 3.0 or later)
80	 (setq i18n-Man-de-depend-process-coding-system-alist process-coding-system-alist)
81	 (if (and (boundp 'mule-version)
82		  (string-match "2.4" mule-version))
83	     ;; Mule-2.4
84	     (setq process-coding-system-alist '(("sh" coding-system-iso-8859-1 . coding-system-iso-8859-1)))
85	   ;; XEmacs , Mule-3.0 or later
86	     (setq process-coding-system-alist '(("sh" iso-8859-1 . iso-8859-1)))
87	     ))
88	(19 ;; Emacs-19.x (Mule-2.3)
89	 (setq i18n-Man-de-depend-default-process-coding-system default-process-coding-system)
90	 (setq default-process-coding-system (cons '*ctext* '*ctext*))))))
91
92(defun i18n-Man-de-depend-process-started-hook (process)
93  "Hook for global variable restoring."
94  (if (featurep 'mule)
95      (case emacs-major-version
96	(20 ;; XEmacs or Emacs-20.x (Mule-2.4, 3.0 or later)
97	 (setq process-coding-system-alist i18n-Man-de-depend-process-coding-system-alist))
98	(19 ;; Emacs-19.x (Mule-2.3)
99	 (setq default-process-coding-system i18n-Man-de-depend-default-process-coding-system))
100	)))
101
102;;;###autoload
103(defun dman ()
104  "i18n-man for German manpage."
105  (interactive)
106  (i18n-Man-de-init-defvars)
107  (call-interactively 'i18n-man))
108
109(provide 'dman)
110
111;;; i18n-man-de.el ends here
112