New files
Showing
2 changed files
with
103 additions
and
0 deletions
doc/texinfo/mastermenu.el
0 → 100644
1 | ;;; mastermenu.el --- Redefinition of texinfo-master-menu-list | ||
2 | |||
3 | ;; Copyright (C) 2006, 2007 Free Software Foundation, Inc. | ||
4 | |||
5 | ;; Author: Sergey Poznyakoff | ||
6 | ;; Maintainer: bug-tar@gnu.org | ||
7 | ;; Keywords: maint, tex, docs | ||
8 | |||
9 | ;; This file is part of GNU tar documentation suite | ||
10 | |||
11 | ;; This program is free software; you can redistribute it and/or modify | ||
12 | ;; it under the terms of the GNU General Public License as published by | ||
13 | ;; the Free Software Foundation; either version 3, or (at your option) | ||
14 | ;; any later version. | ||
15 | |||
16 | ;; This program is distributed in the hope that it will be useful, | ||
17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
19 | ;; GNU General Public License for more details. | ||
20 | |||
21 | ;; You should have received a copy of the GNU General Public License | ||
22 | ;; along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
23 | |||
24 | ;;; Commentary: | ||
25 | |||
26 | ;; This file redefines texinfo-master-menu-list so that it takes into | ||
27 | ;; account included files. | ||
28 | |||
29 | ;; Known bugs: @menu without previous sectioning command will inherit | ||
30 | ;; documentation string from the previous menu. However, since such a | ||
31 | ;; menu is illegal in a texinfo file, we can live with it. | ||
32 | |||
33 | (require 'texinfo) | ||
34 | (require 'texnfo-upd) | ||
35 | |||
36 | (defun texinfo-master-menu-list-recursive (title) | ||
37 | "Auxiliary function used by `texinfo-master-menu-list'." | ||
38 | (save-excursion | ||
39 | (let (master-menu-list) | ||
40 | (while (re-search-forward "\\(^@menu\\|^@include\\)" nil t) | ||
41 | (cond | ||
42 | ((string= (match-string 0) "@include") | ||
43 | (skip-chars-forward " \t") | ||
44 | (let ((included-name (let ((start (point))) | ||
45 | (end-of-line) | ||
46 | (skip-chars-backward " \t") | ||
47 | (buffer-substring start (point))))) | ||
48 | (end-of-line) | ||
49 | (let ((prev-title (texinfo-copy-menu-title))) | ||
50 | (save-excursion | ||
51 | (set-buffer (find-file-noselect included-name)) | ||
52 | (setq master-menu-list | ||
53 | (append (texinfo-master-menu-list-recursive prev-title) | ||
54 | master-menu-list)))))) | ||
55 | (t | ||
56 | (setq master-menu-list | ||
57 | (cons (list | ||
58 | (texinfo-copy-menu) | ||
59 | (let ((menu-title (texinfo-copy-menu-title))) | ||
60 | (if (string= menu-title "") | ||
61 | title | ||
62 | menu-title))) | ||
63 | master-menu-list))))) | ||
64 | master-menu-list))) | ||
65 | |||
66 | (defun texinfo-master-menu-list () | ||
67 | "Return a list of menu entries and header lines for the master menu, | ||
68 | recursing into included files. | ||
69 | |||
70 | Start with the menu for chapters and indices and then find each | ||
71 | following menu and the title of the node preceding that menu. | ||
72 | |||
73 | The master menu list has this form: | ||
74 | |||
75 | \(\(\(... \"entry-1-2\" \"entry-1\"\) \"title-1\"\) | ||
76 | \(\(... \"entry-2-2\" \"entry-2-1\"\) \"title-2\"\) | ||
77 | ...\) | ||
78 | |||
79 | However, there does not need to be a title field." | ||
80 | |||
81 | (reverse (texinfo-master-menu-list-recursive ""))) | ||
82 | |||
83 | (defun make-master-menu () | ||
84 | "Create master menu in the first Emacs argument." | ||
85 | (find-file (car command-line-args-left)) | ||
86 | (texinfo-master-menu nil) | ||
87 | (save-buffer)) | ||
88 | |||
89 | |||
90 | ;;; mastermenu.el ends here |
doc/texinfo/untabify.el
0 → 100644
1 | ;;;; Untabify the sources. | ||
2 | ;;;; Usage: emacs -batch -l untabify.el [file ...] | ||
3 | |||
4 | (defun global-untabify (buflist) | ||
5 | (mapcar | ||
6 | (lambda (bufname) | ||
7 | (set-buffer (find-file bufname)) | ||
8 | (untabify (point-min) (point-max)) | ||
9 | (save-buffer) | ||
10 | (kill-buffer (current-buffer))) | ||
11 | buflist)) | ||
12 | |||
13 | (global-untabify command-line-args-left) |
-
Please register or sign in to post a comment