1 ;;; help-nomule.el --- Help functions when not in Mule
3 ;; Copyright (C) 1997 by Free Software Foundation, Inc.
5 ;; Maintainer: XEmacs Development Team
6 ;; Keywords: help, internal, dumped
8 ;; This file is part of XEmacs.
10 ;; XEmacs is free software; you can redistribute it and/or modify it
11 ;; under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; XEmacs is distributed in the hope that it will be useful, but
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ;; General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with XEmacs; see the file COPYING. If not, write to the Free
22 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
25 ;;; Synched up with: Not in FSF
29 ;; This file is dumped with XEmacs.
33 (defconst tutorial-supported-languages
34 '(("French" fr iso-8859-1)
35 ("German" de iso-8859-1)
36 ("Norwegian" no iso-8859-1)
37 ("Croatian" hr iso-8859-2)
38 ("Polish" pl iso-8859-2)
39 ("Romanian" ro iso-8859-2))
40 "Alist of supported languages in TUTORIAL files.
41 Add languages here, as more are translated.")
43 ;; TUTORIAL arg is XEmacs addition
44 (defun help-with-tutorial (&optional tutorial language)
45 "Select the XEmacs learn-by-doing tutorial.
46 Optional arg TUTORIAL specifies the tutorial file; default is \"TUTORIAL\".
47 With a prefix argument, choose the language."
50 (setq tutorial "TUTORIAL"))
51 (when (and language (consp language))
52 (let ((completion-ignore-case t))
53 (setq language (assoc (completing-read "Language: "
54 tutorial-supported-languages
56 tutorial-supported-languages))))
58 (setq tutorial (format "%s.%s" tutorial (cadr language))))
59 (let ((file (expand-file-name tutorial "~")))
60 (delete-other-windows)
61 (let ((buffer (or (get-file-buffer file)
62 (create-file-buffer file)))
63 (window-configuration (current-window-configuration)))
64 (condition-case error-data
66 (switch-to-buffer buffer)
67 (setq buffer-file-name file)
68 (setq default-directory (expand-file-name "~/"))
69 (setq buffer-auto-save-file-name nil)
70 ;; Because of non-Mule users, TUTORIALs are not coded
71 ;; independently, so we must guess the coding according to
73 (let ((coding-system-for-read (nth 2 language)))
74 (insert-file-contents (locate-data-file tutorial)))
75 (goto-char (point-min))
76 ;; The 'didactic' blank lines: possibly insert blank lines
77 ;; around <<nya nya nya>> and replace << >> with [ ].
78 (if (re-search-forward "^<<.+>>")
79 (let ((n (- (window-height (selected-window))
80 (count-lines (point-min) (point-at-bol))
83 (progn (beginning-of-line) (kill-line))
84 ;; Some people get confused by the large gap
85 (delete-backward-char 2)
93 (newline (- n (/ n 2))))))
94 (goto-char (point-min))
95 (set-buffer-modified-p nil))
96 ;; TUTORIAL was not found: kill the buffer and restore the
97 ;; window configuration.
98 (file-error (kill-buffer buffer)
99 (set-window-configuration window-configuration)
100 ;; Now, signal the error
101 (signal (car error-data) (cdr error-data)))))))
103 ;; General Mule-compatibility stuffs
104 (define-function 'string-width 'length)
106 ;; The following was originally in subr.el
107 (defun make-char (charset &optional arg1 arg2)
108 "Make a character from CHARSET and octets ARG1 and ARG2.
109 This function is available for compatibility with Mule-enabled XEmacsen.
110 When CHARSET is `ascii', return (int-char ARG1). Otherwise, return
111 that value with the high bit set. ARG2 is always ignored."
112 (int-char (if (eq charset 'ascii)
114 (logior arg1 #x80))))
117 (provide 'help-nomule)
119 ;;; help-nomule.el ends here