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
35 ("Croatian" hr iso-8859-2)
36 ("French" fr iso-8859-1)
37 ("German" de iso-8859-1)
38 ("Norwegian" no iso-8859-1)
39 ("Polish" pl iso-8859-2)
40 ("Romanian" ro iso-8859-2)
41 ("Swedish" se iso-8859-1)
43 "Alist of supported languages in TUTORIAL files.
44 Add languages here, as more are translated.")
46 ;; TUTORIAL arg is XEmacs addition
47 (defun help-with-tutorial (&optional tutorial language)
48 "Select the XEmacs learn-by-doing tutorial.
49 Optional arg TUTORIAL specifies the tutorial file; default is \"TUTORIAL\".
50 With a prefix argument, choose the language."
53 (setq tutorial "TUTORIAL"))
54 (when (and language (consp language))
55 (let ((completion-ignore-case t))
56 (setq language (assoc (completing-read "Language: "
57 tutorial-supported-languages
59 tutorial-supported-languages))))
61 (setq tutorial (format "%s.%s" tutorial (cadr language))))
62 (let ((file (expand-file-name tutorial "~")))
63 (delete-other-windows)
64 (let ((buffer (or (get-file-buffer file)
65 (create-file-buffer file)))
66 (window-configuration (current-window-configuration)))
67 (condition-case error-data
69 (switch-to-buffer buffer)
70 (setq buffer-file-name file)
71 (setq default-directory (expand-file-name "~/"))
72 (setq buffer-auto-save-file-name nil)
73 ;; Because of non-Mule users, TUTORIALs are not coded
74 ;; independently, so we must guess the coding according to
76 (let ((coding-system-for-read (nth 2 language)))
77 (insert-file-contents (locate-data-file tutorial)))
78 (goto-char (point-min))
79 ;; The 'didactic' blank lines: possibly insert blank lines
80 ;; around <<nya nya nya>> and replace << >> with [ ].
81 (if (re-search-forward "^<<.+>>")
82 (let ((n (- (window-height (selected-window))
83 (count-lines (point-min) (point-at-bol))
86 (progn (beginning-of-line) (kill-line))
87 ;; Some people get confused by the large gap
88 (delete-backward-char 2)
96 (newline (- n (/ n 2))))))
97 (goto-char (point-min))
98 (set-buffer-modified-p nil))
99 ;; TUTORIAL was not found: kill the buffer and restore the
100 ;; window configuration.
101 (file-error (kill-buffer buffer)
102 (set-window-configuration window-configuration)
103 ;; Now, signal the error
104 (signal (car error-data) (cdr error-data)))))))
106 ;; General Mule-compatibility stuffs
107 (define-function 'string-width 'length)
109 ;; The following was originally in subr.el
110 (defun make-char (charset &optional arg1 arg2)
111 "Make a character from CHARSET and octets ARG1 and ARG2.
112 This function is available for compatibility with Mule-enabled XEmacsen.
113 When CHARSET is `ascii', return (int-char ARG1). Otherwise, return
114 that value with the high bit set. ARG2 is always ignored."
115 (int-char (if (eq charset 'ascii)
117 (logior arg1 #x80))))
120 (provide 'help-nomule)
122 ;;; help-nomule.el ends here