207
|
1 ;;; mule-help.el --- Mule-ized Help functions
|
|
2
|
|
3 ;; Copyright (C) 1997 by Free Software Foundation, Inc.
|
|
4
|
|
5 ;; Author: SL Baur <steve@altair.xemacs.org>
|
|
6 ;; Keywords: help, internal
|
|
7
|
|
8 ;; This file is part of XEmacs.
|
|
9
|
|
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)
|
|
13 ;; any later version.
|
|
14
|
|
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.
|
|
19
|
|
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
|
|
23 ;; 02111-1307, USA.
|
|
24
|
|
25 ;;; Synched up with: Emacs 20.1
|
|
26
|
|
27 ;;; Commentary:
|
|
28
|
|
29 ;;
|
|
30
|
|
31 ;;; Code:
|
|
32
|
|
33 ;; TUTORIAL arg is XEmacs addition
|
|
34 (defun help-with-tutorial (&optional arg tutorial)
|
|
35 "Select the Emacs learn-by-doing tutorial.
|
|
36 If there is a tutorial version written in the language
|
|
37 of the selected language environment, that version is used.
|
|
38 If there's no tutorial in that language, `TUTORIAL' is selected.
|
|
39 With arg, you are asked to select which language."
|
|
40 (interactive "P")
|
|
41 (let (lang filename file)
|
|
42 (if arg
|
|
43 (or (setq lang (read-language-name 'tutorial "Language: "))
|
|
44 (error "No tutorial file of the specified language"))
|
|
45 (setq lang current-language-environment))
|
|
46 (setq filename (or (get-language-info lang 'tutorial)
|
|
47 (or tutorial "TUTORIAL")))
|
|
48 (setq file (expand-file-name (concat "~/" filename)))
|
|
49 (delete-other-windows)
|
|
50 (if (get-file-buffer file)
|
|
51 (switch-to-buffer (get-file-buffer file))
|
|
52 (switch-to-buffer (create-file-buffer file))
|
|
53 (setq buffer-file-name file)
|
|
54 (setq default-directory (expand-file-name "~/"))
|
|
55 (setq buffer-auto-save-file-name nil)
|
|
56 (insert-file-contents (expand-file-name filename data-directory))
|
|
57 (goto-char (point-min))
|
|
58 (search-forward "\n<<")
|
|
59 (beginning-of-line)
|
|
60 (delete-region (point) (progn (end-of-line) (point)))
|
|
61 (let ((n (- (window-height (selected-window))
|
|
62 (count-lines (point-min) (point))
|
|
63 6)))
|
|
64 (if (< n 12)
|
|
65 (newline n)
|
|
66 ;; Some people get confused by the large gap.
|
|
67 (newline (/ n 2))
|
|
68 (insert "[Middle of page left blank for didactic purposes. "
|
|
69 "Text continues below]")
|
|
70 (newline (- n (/ n 2)))))
|
|
71 (goto-char (point-min))
|
|
72 (set-buffer-modified-p nil))))
|
|
73
|
|
74
|
|
75 (provide 'mule-help)
|
|
76
|
|
77 ;;; mule-help.el ends here |