annotate lisp/help-nomule.el @ 209:41ff10fd062f r20-4b3

Import from CVS: tag r20-4b3
author cvs
date Mon, 13 Aug 2007 10:04:58 +0200
parents
children 1f0dabaa0855
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1 ;;; help-nomule.el --- Help functions when not in Mule
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3 ;; Copyright (C) 1997 by Free Software Foundation, Inc.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
4
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
5 ;; Maintainer: XEmacs Development Team
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
6 ;; Keywords: help, internal, dumped
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
7
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
8 ;; This file is part of XEmacs.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
9
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
10 ;; XEmacs is free software; you can redistribute it and/or modify it
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
11 ;; under the terms of the GNU General Public License as published by
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
13 ;; any later version.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
14
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
15 ;; XEmacs is distributed in the hope that it will be useful, but
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
18 ;; General Public License for more details.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
19
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
21 ;; along with XEmacs; see the file COPYING. If not, write to the Free
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
22 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
23 ;; 02111-1307, USA.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
24
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
25 ;;; Synched up with: Not in FSF
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
26
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
27 ;;; Commentary:
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
28
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
29 ;; This file is dumped with XEmacs.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
30
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
31 ;;; Code:
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
32
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
33 (defconst tutorial-supported-languages
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
34 '(("French" fr iso-8859-1)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
35 ("German" de iso-8859-1)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
36 ("Norwegian" no iso-8859-1)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
37 ("Croatian" hr iso-8859-2))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
38 "Alist of supported languages in TUTORIAL files.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
39 Add languages here, as more are translated.")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
40
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
41 ;; TUTORIAL arg is XEmacs addition
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
42 (defun help-with-tutorial (&optional tutorial language)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
43 "Select the XEmacs learn-by-doing tutorial.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
44 Optional arg TUTORIAL specifies the tutorial file; default is \"TUTORIAL\".
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
45 With a prefix argument, choose the language."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
46 (interactive "i\nP")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
47 (or tutorial
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
48 (setq tutorial "TUTORIAL"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
49 (when (and language (consp language))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
50 (let ((completion-ignore-case t))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
51 (setq language (assoc (completing-read "Language: "
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
52 tutorial-supported-languages
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
53 nil t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
54 tutorial-supported-languages))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
55 (when language
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
56 (setq tutorial (format "%s.%s" tutorial (cadr language))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
57 (let ((file (expand-file-name tutorial "~")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
58 (delete-other-windows)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
59 (let ((buffer (or (get-file-buffer file)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
60 (create-file-buffer file)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
61 (window-configuration (current-window-configuration)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
62 (condition-case error-data
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
63 (progn
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
64 (switch-to-buffer buffer)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
65 (setq buffer-file-name file)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
66 (setq default-directory (expand-file-name "~/"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
67 (setq buffer-auto-save-file-name nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
68 ;; Because of non-Mule users, TUTORIALs are not coded
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
69 ;; independently, so we must guess the coding according to
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
70 ;; the language.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
71 (let ((coding-system-for-read (nth 2 language)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
72 (insert-file-contents (expand-file-name tutorial
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
73 data-directory)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
74 (goto-char (point-min))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
75 ;; The 'didactic' blank lines: possibly insert blank lines
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
76 ;; around <<nya nya nya>> and replace << >> with [ ].
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
77 (if (re-search-forward "^<<.+>>")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
78 (let ((n (- (window-height (selected-window))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
79 (count-lines (point-min) (point-at-bol))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
80 6)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
81 (if (< n 12)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
82 (progn (beginning-of-line) (kill-line))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
83 ;; Some people get confused by the large gap
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
84 (delete-backward-char 2)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
85 (insert "]")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
86 (beginning-of-line)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
87 (save-excursion
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
88 (delete-char 2)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
89 (insert "["))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
90 (newline (/ n 2))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
91 (next-line 1)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
92 (newline (- n (/ n 2))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
93 (goto-char (point-min))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
94 (set-buffer-modified-p nil))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
95 ;; TUTORIAL was not found: kill the buffer and restore the
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
96 ;; window configuration.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
97 (file-error (kill-buffer buffer)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
98 (set-window-configuration window-configuration)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
99 ;; Now, signal the error
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
100 (signal (car error-data) (cdr error-data)))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
101
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
102
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
103 (provide 'help-nomule)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
104
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
105 ;;; help-nomule.el ends here