annotate lisp/x11/x-menubar.el @ 0:376386a54a3c r19-14

Import from CVS: tag r19-14
author cvs
date Mon, 13 Aug 2007 08:45:50 +0200
parents
children ac2d302a0011
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; x-menubar.el --- Menubar and popup-menu support for X.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; Copyright (C) 1995 Tinker Systems and INS Engineering Corp.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Copyright (C) 1995 Sun Microsystems.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; Copyright (C) 1995, 1996 Ben Wing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; XEmacs is distributed in the hope that it will be useful, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;; along with Xmacs; see the file COPYING. If not, write to the Free
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;;; Commentary:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 (defconst default-menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 (purecopy-menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;; note backquote.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 `(
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ("File"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 :filter file-menu-filter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ["Open..." find-file t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ["Open in Other Window..." find-file-other-window t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 ["Open in New Frame..." find-file-other-frame t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 ["Insert File..." insert-file t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ["View File..." view-file t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 "------"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 ["Save" save-buffer t nil]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 ["Save As..." write-file t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ["Save Some Buffers" save-some-buffers t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 ["Print Buffer" lpr-buffer t nil]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 ["Pretty-Print Buffer" ps-print-buffer-with-faces t nil]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 ["New Frame" make-frame t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 ["Frame on Other Display..."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 make-frame-on-display t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 ["Delete Frame" delete-frame t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 ["Split Window" split-window-vertically t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 ["Un-Split (Keep This)" delete-other-windows (not (one-window-p t))]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 ["Un-Split (Keep Others)" delete-window (not (one-window-p t))]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 ["Revert Buffer" revert-buffer t nil]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 ["Delete Buffer" kill-this-buffer t nil]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 ["Exit XEmacs" save-buffers-kill-emacs t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 ("Edit"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 :filter edit-menu-filter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 ["Undo" advertised-undo t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 ["Cut" x-kill-primary-selection t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 ["Copy" x-copy-primary-selection t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 ["Paste" x-yank-clipboard-selection t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 ["Clear" x-delete-primary-selection t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 "----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 ["Search..." isearch-forward t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 ["Search Backward..." isearch-backward t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 ["Replace..." query-replace t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 "----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 ["Search (Regexp)..." isearch-forward-regexp t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 ["Search Backward (Regexp)..." isearch-backward-regexp t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 ["Replace (Regexp)..." query-replace-regexp t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 "----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 ("Bookmarks"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 ["Jump to bookmark" bookmark-menu-jump t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 ["Set bookmark" bookmark-set t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 "---"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 ["Insert contents" bookmark-menu-insert t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 ["Insert location" bookmark-menu-locate t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 "---"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 ["Rename bookmark" bookmark-menu-rename t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 ["Delete bookmark" bookmark-menu-delete t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 ["Edit Bookmark List" bookmark-bmenu-list t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 "---"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 ["Save bookmarks" bookmark-save t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 ["Save bookmarks as..." bookmark-write t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 ["Load a bookmark file" bookmark-load t])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 "----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 ["Goto Line..." goto-line t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 ["What Line" what-line t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 "----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 ["Start Macro Recording" start-kbd-macro (not defining-kbd-macro)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 ["End Macro Recording" end-kbd-macro defining-kbd-macro]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 ["Execute Last Macro" call-last-kbd-macro last-kbd-macro]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 ("Apps"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 ["Read Mail (VM)..." vm t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 ["Read Mail (MH)..." (mh-rmail t) t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 ["Send mail..." mail t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 ["Usenet News" gnus t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 ["Browse the Web" w3 t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 ["Gopher" gopher t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 ["Hyperbole..." hyperbole t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 "----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 ["Spell-Check Buffer" ispell-buffer t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 ["Emulate VI" viper-mode t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 "----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 ("Calendar"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 ["3-Month Calendar" calendar t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 ["Diary" diary t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 ["Holidays" holidays t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 ;; we're all pagans at heart ...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 ["Phases of the Moon" phases-of-moon t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 ["Sunrise/Sunset" sunrise-sunset t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 ("Games"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 ["Quote from Zippy" yow t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 ["Psychoanalyst" doctor t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 ["Psychoanalyze Zippy!" psychoanalyze-pinhead t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 ["Random Flames" flame t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 ["Dunnet (Adventure)" dunnet t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 ["Towers of Hanoi" hanoi t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 ["Game of Life" life t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 ["Multiplication Puzzle" mpuz t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 ("Options"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 ["Read Only" (toggle-read-only)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 :style toggle :selected buffer-read-only]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 ("Editing Options"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 ["Overstrike" (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 (overwrite-mode current-prefix-arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 (setq-default overwrite-mode overwrite-mode))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 :style toggle :selected overwrite-mode]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 ["Case Sensitive Search" (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 (setq case-fold-search (not case-fold-search))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 (setq-default case-fold-search
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 case-fold-search))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 :style toggle :selected (not case-fold-search)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 ["Case Matching Replace" (setq case-replace (not case-replace))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 :style toggle :selected case-replace]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 ["Auto Delete Selection" (if (memq 'pending-delete-pre-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 pre-command-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 (pending-delete-off nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 (pending-delete-on nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 :style toggle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 :selected (memq 'pending-delete-pre-hook pre-command-hook)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 ["Active Regions" (setq zmacs-regions (not zmacs-regions))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 :style toggle :selected zmacs-regions]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 ["Mouse Paste At Text Cursor" (setq mouse-yank-at-point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 (not mouse-yank-at-point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 :style toggle :selected mouse-yank-at-point]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 ("General Options"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 ["Teach Extended Commands" (setq teach-extended-commands-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 (not teach-extended-commands-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 :style toggle :selected teach-extended-commands-p]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 ["Debug On Error" (setq debug-on-error (not debug-on-error))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 :style toggle :selected debug-on-error]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 ["Debug On Quit" (setq debug-on-quit (not debug-on-quit))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 :style toggle :selected debug-on-quit]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 ("Printing Options"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 ["Command-Line Switches for `lpr'/`lp'..."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 (setq lpr-switches (read-string "Switches for `lpr'/`lp': "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 lpr-switches))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 ["Pretty-Print With Color"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 (setq ps-print-color-p (not ps-print-color-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 :style toggle :selected ps-print-color-p]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 ("Pretty-Print Paper Size"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 ["Letter"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 (setq ps-paper-type 'ps-letter)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 :style radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 :selected (eq ps-paper-type 'ps-letter)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 ["Legal"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 (setq ps-paper-type 'ps-legal)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 :style radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 :selected (eq ps-paper-type 'ps-legal)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 ["A4"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 (setq ps-paper-type 'ps-a4)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 :style radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 :selected (eq ps-paper-type 'ps-a4)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 ("\"Other Window\" Location"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 ["Always in Same Frame"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (setq get-frame-for-buffer-default-instance-limit nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 :style radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 :selected (null get-frame-for-buffer-default-instance-limit)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 ["Other Frame (2 Frames Max)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (setq get-frame-for-buffer-default-instance-limit 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 :style radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 :selected (eq 2 get-frame-for-buffer-default-instance-limit)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 ["Other Frame (3 Frames Max)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 (setq get-frame-for-buffer-default-instance-limit 3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 :style radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 :selected (eq 3 get-frame-for-buffer-default-instance-limit)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 ["Other Frame (4 Frames Max)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 (setq get-frame-for-buffer-default-instance-limit 4)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 :style radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 :selected (eq 4 get-frame-for-buffer-default-instance-limit)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 ["Other Frame (5 Frames Max)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 (setq get-frame-for-buffer-default-instance-limit 5)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 :style radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 :selected (eq 5 get-frame-for-buffer-default-instance-limit)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 ["Always Create New Frame"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (setq get-frame-for-buffer-default-instance-limit 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 :style radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 :selected (eq 0 get-frame-for-buffer-default-instance-limit)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 ["Temp Buffers Always in Same Frame"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 (setq temp-buffer-show-function 'show-temp-buffer-in-current-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 :style radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 :selected (eq temp-buffer-show-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 'show-temp-buffer-in-current-frame)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 ["Temp Buffers Like Other Buffers"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (setq temp-buffer-show-function nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 :style radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 :selected (null temp-buffer-show-function)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 ("Syntax Highlighting"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 ["In This Buffer" (font-lock-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 :style toggle :selected font-lock-mode]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 ["Automatic" (if (not (featurep 'font-lock))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 (setq font-lock-auto-fontify t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 (require 'font-lock))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (setq font-lock-auto-fontify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (not font-lock-auto-fontify)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 :style toggle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 :selected (and (featurep 'font-lock) font-lock-auto-fontify)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 ["Fonts" (progn (require 'font-lock)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 (font-lock-use-default-fonts)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 (setq font-lock-use-fonts t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 font-lock-use-colors nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 (font-lock-mode 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 :style radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 :selected (and font-lock-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 font-lock-use-fonts)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 ["Colors" (progn (require 'font-lock)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 (font-lock-use-default-colors)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 (setq font-lock-use-colors t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 font-lock-use-fonts nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 (font-lock-mode 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 :style radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 :selected (and font-lock-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 font-lock-use-colors)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 ["Least" (if (or (and (not (integerp font-lock-maximum-decoration))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 (not (eq t font-lock-maximum-decoration)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 (and (integerp font-lock-maximum-decoration)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 (<= font-lock-maximum-decoration 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 (setq font-lock-maximum-decoration nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 (font-lock-recompute-variables))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 :style radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 :active font-lock-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 :selected (and font-lock-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 (or (and (not (integerp font-lock-maximum-decoration))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 (not (eq t font-lock-maximum-decoration)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 (and (integerp font-lock-maximum-decoration)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 (<= font-lock-maximum-decoration 0))))]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 ["More" (if (and (integerp font-lock-maximum-decoration)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 (= 1 font-lock-maximum-decoration))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 (setq font-lock-maximum-decoration 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 (font-lock-recompute-variables))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 :style radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 :active font-lock-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 :selected (and font-lock-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (integerp font-lock-maximum-decoration)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 (= 1 font-lock-maximum-decoration))]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 ["Even More" (if (and (integerp font-lock-maximum-decoration)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 (= 2 font-lock-maximum-decoration))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 (setq font-lock-maximum-decoration 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (font-lock-recompute-variables))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 :style radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 :active font-lock-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 :selected (and font-lock-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 (integerp font-lock-maximum-decoration)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 (= 2 font-lock-maximum-decoration))]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 ["Most" (if (or (eq font-lock-maximum-decoration t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 (and (integerp font-lock-maximum-decoration)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 (>= font-lock-maximum-decoration 3)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 (setq font-lock-maximum-decoration t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 (font-lock-recompute-variables))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 :style radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 :active font-lock-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 :selected (and font-lock-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 (or (eq font-lock-maximum-decoration t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 (and (integerp font-lock-maximum-decoration)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 (>= font-lock-maximum-decoration 3))))]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 ["Lazy" (progn (require 'lazy-lock)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 (if (and (boundp 'lazy-lock-mode) lazy-lock-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 (lazy-lock-mode 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 ;; this shouldn't be necessary so there has to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 ;; be a redisplay bug lurking somewhere (or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 ;; possibly another event handler bug)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (redraw-modeline))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (if font-lock-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (lazy-lock-mode 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (redraw-modeline)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 :active font-lock-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 :style toggle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 :selected (and (boundp 'lazy-lock-mode) lazy-lock-mode)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 ["Caching" (progn (require 'fast-lock)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 (if fast-lock-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 (fast-lock-mode 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 ;; this shouldn't be necessary so there has to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 ;; be a redisplay bug lurking somewhere (or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 ;; possibly another event handler bug)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 (redraw-modeline))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 (if font-lock-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 (fast-lock-mode 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 (redraw-modeline)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 :active font-lock-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 :style toggle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 :selected fast-lock-mode]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 ("Paren Highlighting"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 ["None" (paren-set-mode -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 :style radio :selected (not paren-mode)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 ["Blinking Paren" (paren-set-mode 'blink-paren)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 :style radio :selected (eq paren-mode 'blink-paren)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 ["Steady Paren" (paren-set-mode 'paren)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 :style radio :selected (eq paren-mode 'paren)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 ["Expression" (paren-set-mode 'sexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 :style radio :selected (eq paren-mode 'sexp)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 ;;; ["Nested Shading" (paren-set-mode 'nested)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 ;;; :style radio :selected (eq paren-mode 'nested)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 ("Frame Appearance"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 ,@(if (featurep 'scrollbar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 '(["Scrollbars" (if (= (specifier-instance scrollbar-width) 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (set-specifier scrollbar-width 15)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 (set-specifier scrollbar-height 15))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (set-specifier scrollbar-width 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (set-specifier scrollbar-height 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 :style toggle :selected (> (specifier-instance scrollbar-width) 0)]))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 ["3D Modeline"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 (if (zerop (specifier-instance modeline-shadow-thickness))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (set-specifier modeline-shadow-thickness 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 (set-specifier modeline-shadow-thickness 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (redraw-modeline t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 :style toggle :selected
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 (let ((thickness
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (specifier-instance modeline-shadow-thickness)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 (and (integerp thickness)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 (> thickness 0)))]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 ["Truncate Lines" (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (setq truncate-lines (not truncate-lines))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 (setq-default truncate-lines truncate-lines))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 :style toggle :selected truncate-lines]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 ["Bar Cursor" (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (setq bar-cursor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 (if (not bar-cursor) 2 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 (force-cursor-redisplay))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 :style toggle :selected bar-cursor]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 ["Blinking Cursor" (blink-cursor-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 :style toggle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 :selected (and (boundp 'blink-cursor-mode) blink-cursor-mode)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 ; ["Line Numbers" (line-number-mode nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 ; :style toggle :selected line-number-mode]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 ("Menubar Appearance"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 ["Buffers Menu Length..."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 (setq buffers-menu-max-size
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 (read-number
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 "Enter number of buffers to display (or 0 for unlimited): "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 (if (eq buffers-menu-max-size 0) (setq buffers-menu-max-size nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 ["Multi-Operation Buffers Sub-Menus"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 (setq complex-buffers-menu-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 (not complex-buffers-menu-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 :style toggle :selected complex-buffers-menu-p]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 ("Buffers Menu Sorting"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 ["Most Recently Used"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 (setq buffers-menu-sort-function nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 (setq buffers-menu-grouping-function nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 :style radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 :selected (null buffers-menu-sort-function)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 ["Alphabetically"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 (setq buffers-menu-sort-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 'sort-buffers-menu-alphabetically)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 (setq buffers-menu-grouping-function nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 :style radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 :selected (eq 'sort-buffers-menu-alphabetically
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 buffers-menu-sort-function)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 ["By Major Mode, Then Alphabetically"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 (setq buffers-menu-sort-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 'sort-buffers-menu-by-mode-then-alphabetically)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 (setq buffers-menu-grouping-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 'group-buffers-menu-by-mode-then-alphabetically))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 :style radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 :selected (eq 'sort-buffers-menu-by-mode-then-alphabetically
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 buffers-menu-sort-function)])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 ["Submenus for Buffer Groups"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 (setq buffers-menu-submenus-for-groups-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 (not buffers-menu-submenus-for-groups-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 :style toggle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 :selected buffers-menu-submenus-for-groups-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 :active (not (null buffers-menu-grouping-function))]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 "---"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 ["Frame-Local Font Menu" (setq font-menu-this-frame-only-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 (not font-menu-this-frame-only-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 :style toggle :selected font-menu-this-frame-only-p]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 ["Ignore Scaled Fonts" (setq font-menu-ignore-scaled-fonts
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 (not font-menu-ignore-scaled-fonts))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 :style toggle :selected font-menu-ignore-scaled-fonts]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 ,@(if (featurep 'toolbar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 '(("Toolbar Appearance"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 ["Visible" (set-specifier default-toolbar-visible-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 (not (specifier-instance
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 default-toolbar-visible-p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 :style toggle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 :selected (specifier-instance default-toolbar-visible-p)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 ["Captioned" (set-specifier toolbar-buttons-captioned-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 (not (specifier-instance
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 toolbar-buttons-captioned-p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 :style toggle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 :selected
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 (specifier-instance toolbar-buttons-captioned-p)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 ("Default Location"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 ["Top" (set-default-toolbar-position 'top)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 :style radio :selected (eq (default-toolbar-position) 'top)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 ["Bottom" (set-default-toolbar-position 'bottom)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 :style radio :selected (eq (default-toolbar-position) 'bottom)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 ["Left" (set-default-toolbar-position 'left)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 :style radio :selected (eq (default-toolbar-position) 'left)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 ["Right" (set-default-toolbar-position 'right)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 :style radio :selected (eq (default-toolbar-position) 'right)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 ("Open URLs With"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 ["Emacs-W3" (setq browse-url-browser-function 'browse-url-w3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 :style radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 :selected (eq browse-url-browser-function 'browse-url-w3)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 ["Netscape" (setq browse-url-browser-function 'browse-url-netscape)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 :style radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 :selected (eq browse-url-browser-function 'browse-url-netscape)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 ["Mosaic" (setq browse-url-browser-function 'browse-url-mosaic)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 :style radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 :selected (eq browse-url-browser-function 'browse-url-mosaic)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 ["Mosaic (CCI)" (setq browse-url-browser-function 'browse-url-cci)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 :style radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 :selected (eq browse-url-browser-function 'browse-url-iximosaic)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 ["IXI Mosaic" (setq browse-url-browser-function 'browse-url-iximosaic)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 :style radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 :selected (eq browse-url-browser-function 'browse-url-iximosaic)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 ["Lynx (xterm)" (setq browse-url-browser-function 'browse-url-lynx-xterm)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 :style radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 :selected (eq browse-url-browser-function 'browse-url-lynx-xterm)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 ["Lynx (xemacs)" (setq browse-url-browser-function 'browse-url-lynx-emacs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 :style radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 :selected (eq browse-url-browser-function 'browse-url-lynx-emacs)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 ["Grail" (setq browse-url-browser-function 'browse-url-grail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 :style radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 :selected (eq browse-url-browser-function 'browse-url-grail)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 ["Edit Faces..." edit-faces t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 ("Font" :filter font-menu-family-constructor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 ("Size" :filter font-menu-size-constructor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 ("Weight" :filter font-menu-weight-constructor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 ["Save Options" save-options-menu-settings t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 ("Buffers"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 :filter buffers-menu-filter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 ["List All Buffers" list-buffers t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 "--"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 ("Tools"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 ["Grep..." grep t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 ["Compile..." compile t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 ["Shell Command..." shell-command t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 ["Shell Command on Region..."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 shell-command-on-region (region-exists-p)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 ["Debug (GDB)..." gdb t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 ["Debug (DBX)..." dbx t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 ["OO-Browser..." oobr t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 ("Tags"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 ["Find..." find-tag t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 ["Find Other Window..." find-tag-other-window t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 ["Tags Search..." tags-search t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 ["Tags Replace..." tags-query-replace t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 ["Continue" tags-loop-continue t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 ["Pop stack" pop-tag-mark t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 ["Apropos..." tags-apropos t]))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 nil ; the partition: menus after this are flushright
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 ("Help"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 ["About XEmacs..." about-xemacs t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 ["XEmacs WWW Page" xemacs-www-page t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 ["Newest XEmacs FAQ via WWW" xemacs-www-faq t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 ["XEmacs FAQ (local)" xemacs-local-faq t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 ["XEmacs Tutorial" help-with-tutorial t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 ["XEmacs News" view-emacs-news t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 ["Sample .emacs" (find-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 (expand-file-name "sample.emacs"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 data-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 ["Info (Detailed Docs)" info t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 ("Lookup in Info"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 ["Key/Mouse Binding..." Info-goto-emacs-key-command-node t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 ["Command..." Info-goto-emacs-command-node t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 ["Elisp Function..." Info-elisp-ref t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 ["Topic..." Info-query t])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 ["Package Browser" finder-by-keyword t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 ["Describe Mode" describe-mode t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 ["Apropos..." hyper-apropos t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 ["Apropos Documentation..." apropos-documentation t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 ["Recent Keystrokes/Messages" view-lossage t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 ["Describe Key/Mouse..." describe-key t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 ["List Key Bindings" describe-bindings t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 ["List Mouse Bindings" describe-pointer t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 ["Describe Function..." describe-function t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 ["Describe Variable..." describe-variable t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 ["Where Is Command..." where-is t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 ["Unix Manual..." manual-entry t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 ("Misc"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 ["Describe No Warranty" describe-no-warranty t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 ["Describe XEmacs License" describe-copying t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 ["Getting the Latest Version" describe-distribution t])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 ;;; Add Load Init button to menubar when starting up with -q
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 (defun maybe-add-init-button ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 ;; by Stig@hackvan.com
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 (init-file-user nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 ((file-exists-p (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 ((eq system-type 'ms-dos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 (concat "~" (user-login-name) "/_emacs"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 ((eq system-type 'vax-vms)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 "sys$login:.emacs")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 (concat "~" (user-login-name) "/.emacs"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 (add-menu-button nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 ["Load .emacs"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 (progn (delete-menu-item '("Load .emacs"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 (load-user-init-file (user-login-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 "Help"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 (t nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 (add-hook 'before-init-hook 'maybe-add-init-button)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 ;;; The File and Edit menus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 (defvar put-buffer-names-in-file-menu t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 ;; The sensitivity part of this function could be done by just adding forms
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 ;; to evaluate to the menu items themselves; that would be marginally less
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 ;; efficient but not perceptibly so (I think). But in order to change the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 ;; names of the Undo menu item and the various things on the File menu item,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 ;; we need to use a hook.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 (defun file-menu-filter (menu-items)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 "Incrementally update the file menu.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 This function changes the arguments and sensitivity of these File menu items:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 Delete Buffer has the name of the current buffer appended to it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 Print Buffer has the name of the current buffer appended to it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 Pretty-Print Buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 has the name of the current buffer appended to it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 Save has the name of the current buffer appended to it, and is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 sensitive only when the current buffer is modified.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 Revert Buffer has the name of the current buffer appended to it, and is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 sensitive only when the current buffer has a file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 Delete Frame sensitive only when there is more than one frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 The name of the current buffer is only appended to the menu items if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 `put-buffer-names-in-file-menu' is non-nil. This behavior is the default."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 (let* ((bufname (buffer-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 (result menu-items) ; save pointer to start of menu.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 item)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 ;; the contents of the menu items in the file menu are destructively
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 ;; modified so that there is as little consing as possible. This is okay.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 ;; As soon as the result is returned, it is converted to widget_values
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 ;; inside lwlib and the lisp menu-items can be safely modified again.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 (while (setq item (pop menu-items))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 (if (vectorp item)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 (setq name (aref item 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 (and put-buffer-names-in-file-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 (member name '("Save" "Revert Buffer" "Print Buffer"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 "Pretty-Print Buffer" "Delete Buffer"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 (>= 4 (length item))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 (aset item 3 bufname))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 (and (string= "Save" name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 (aset item 2 (buffer-modified-p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 (and (string= "Revert Buffer" name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 (aset item 2 (not (not (or buffer-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 revert-buffer-function)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 (and (string= "Delete Frame" name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 (aset item 2 (not (eq (next-frame) (selected-frame)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 result))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 (defun edit-menu-filter (menu-items)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 "For use as an incremental menu construction filter.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 This function changes the sensitivity of these Edit menu items:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 Cut sensitive only when emacs owns the primary X Selection.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 Copy sensitive only when emacs owns the primary X Selection.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 Clear sensitive only when emacs owns the primary X Selection.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 Paste sensitive only when there is an owner for the X Clipboard Selection.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 Undo sensitive only when there is undo information.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 While in the midst of an undo, this is changed to \"Undo More\"."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 (let* (item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 (result menu-items) ; save pointer to head of list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 (x-dev (eq 'x (device-type (selected-device))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 (emacs-owns-selection-p (and x-dev (x-selection-owner-p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 (clipboard-exists-p (and x-dev (x-selection-exists-p 'CLIPBOARD)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 ;;; undo-available undoing-more
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 ;;; (undo-info-available (not (null (and (not (eq t buffer-undo-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 ;;; (if (eq last-command 'undo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 ;;; (setq undoing-more
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 ;;; (and (boundp 'pending-undo-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 ;;; pending-undo-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 ;;; buffer-undo-list))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 undo-name undo-state
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 ;; As with file-menu-filter, menu-items are destructively modified.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 ;; This is OK.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 (while (setq item (pop menu-items))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 (if (vectorp item)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 (setq name (aref item 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 (and (member name '("Cut" "Copy" "Clear"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 (aset item 2 emacs-owns-selection-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 (and (string= name "Paste")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 (aset item 2 clipboard-exists-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 (and (member name '("Undo" "Undo More"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 ;; we could also do this with the third field of the item.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 (if (eq last-command 'undo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 (setq undo-name "Undo More"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 undo-state (not (null (and (boundp 'pending-undo-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 pending-undo-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 (setq undo-name "Undo"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 undo-state (and (not (eq buffer-undo-list t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 (not (null
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 (or buffer-undo-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 (and (boundp 'pending-undo-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 pending-undo-list)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 (if buffer-read-only (setq undo-state nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 (aset item 0 undo-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 (aset item 2 undo-state)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 result))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 ;;; The Buffers menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 (defvar buffers-menu-max-size 25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 "*Maximum number of entries which may appear on the \"Buffers\" menu.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 If this is 10, then only the ten most-recently-selected buffers will be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 shown. If this is nil, then all buffers will be shown. Setting this to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 a large number or nil will slow down menu responsiveness.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 (defvar complex-buffers-menu-p nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 "*If true, the buffers menu will contain several commands, as submenus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 of each buffer line. If this is false, then there will be only one command:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 select that buffer.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 (defvar buffers-menu-submenus-for-groups-p nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 "*If true, the buffers menu will contain one submenu per group of buffers,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 if a grouping function is specified in `buffers-menu-grouping-function'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 (defvar buffers-menu-switch-to-buffer-function 'switch-to-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 "*The function to call to select a buffer from the buffers menu.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 `switch-to-buffer' is a good choice, as is `pop-to-buffer'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 (defvar buffers-menu-omit-function 'buffers-menu-omit-invisible-buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 "*If non-nil, a function specifying the buffers to omit from the buffers menu.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 This is passed a buffer and should return non-nil if the buffer should be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 omitted. The default value `buffers-menu-omit-invisible-buffers' omits
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 buffers that are normally considered \"invisible\" (those whose name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 begins with a space).")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 (defvar buffers-menu-format-buffer-line-function 'format-buffers-menu-line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 "*The function to call to return a string to represent a buffer in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 buffers menu. The function is passed a buffer and should return a string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 The default value `format-buffers-menu-line' just returns the name of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 the buffer. Also check out `slow-format-buffers-menu-line' which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 returns a whole bunch of info about a buffer.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 (defvar buffers-menu-sort-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 'sort-buffers-menu-by-mode-then-alphabetically
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 "*If non-nil, a function to sort the list of buffers in the buffers menu.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 It will be passed two arguments (two buffers to compare) and should return
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 T if the first is \"less\" than the second. One possible value is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 `sort-buffers-menu-alphabetically'; another is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 `sort-buffers-menu-by-mode-then-alphabetically'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 (defvar buffers-menu-grouping-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 'group-buffers-menu-by-mode-then-alphabetically
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 "*If non-nil, a function to group buffers in the buffers menu together.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 It will be passed two arguments, successive members of the sorted buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 list after being passed through `buffers-menu-sort-function'. It should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 return non-nil if the second buffer begins a new group. The return value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 should be the name of the old group, which may be used in hierarchical
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 buffers menus. The last invocation of the function contains nil as the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 second argument, so that the name of the last group can be determined.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 The sensible values of this function are dependent on the value specified
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 for `buffers-menu-sort-function'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 (defun buffers-menu-omit-invisible-buffers (buf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 "For use as a value of `buffers-menu-omit-function'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 Omits normally invisible buffers (those whose name begins with a space)."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 (not (null (string-match "\\` " (buffer-name buf)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 (defun sort-buffers-menu-alphabetically (buf1 buf2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 "For use as a value of `buffers-menu-sort-function'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 Sorts the buffers in alphabetical order by name, but puts buffers beginning
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 with a star at the end of the list."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761 (let* ((nam1 (buffer-name buf1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 (nam2 (buffer-name buf2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 (star1p (not (null (string-match "\\`*" nam1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 (star2p (not (null (string-match "\\`*" nam2)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 (if (not (eq star1p star2p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 (not star1p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 (string-lessp nam1 nam2))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769 (defun sort-buffers-menu-by-mode-then-alphabetically (buf1 buf2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 "For use as a value of `buffers-menu-sort-function'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 Sorts first by major mode and then alphabetically by name, but puts buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 beginning with a star at the end of the list."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 (let* ((nam1 (buffer-name buf1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774 (nam2 (buffer-name buf2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 (star1p (not (null (string-match "\\`*" nam1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776 (star2p (not (null (string-match "\\`*" nam2))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 (mode1 (symbol-value-in-buffer 'major-mode buf1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 (mode2 (symbol-value-in-buffer 'major-mode buf2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 (cond ((not (eq star1p star2p)) (not star1p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 ((and star1p star2p (string-lessp nam1 nam2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 ((string-lessp mode1 mode2) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 ((string-lessp mode2 mode1) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 (t (string-lessp nam1 nam2)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 ;; this version is too slow on some machines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 (defun slow-format-buffers-menu-line (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787 "For use as a value of `buffers-menu-format-buffer-line-function'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 This returns a string containing a bunch of info about the buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 (format "%s%s %-19s %6s %-15s %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 (if (buffer-modified-p buffer) "*" " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 (if (symbol-value-in-buffer 'buffer-read-only buffer) "%" " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 (buffer-name buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793 (buffer-size buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 (symbol-value-in-buffer 'mode-name buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 (or (buffer-file-name buffer) "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797 (defun format-buffers-menu-line (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 "For use as a value of `buffers-menu-format-buffer-line-function'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799 This just returns the buffer's name."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 (buffer-name buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 (defun group-buffers-menu-by-mode-then-alphabetically (buf1 buf2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803 "For use as a value of `buffers-menu-grouping-function'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 This groups buffers by major mode. It only really makes sense if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 `buffers-menu-sorting-function' is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806 `sort-buffers-menu-by-mode-then-alphabetically'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 (cond ((string-match "\\`*" (buffer-name buf1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 (and (null buf2) "*Misc*"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 ((or (null buf2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 (string-match "\\`*" (buffer-name buf2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 (not (eq (symbol-value-in-buffer 'major-mode buf1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 (symbol-value-in-buffer 'major-mode buf2))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 (symbol-value-in-buffer 'mode-name buf1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 (t nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 (defun buffer-menu-save-buffer (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 (save-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 (defun buffer-menu-write-file (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 (write-file (read-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 (format "Write %s to file: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 (buffer-name (current-buffer)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 (defsubst build-buffers-menu-internal (buffers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 (let (name line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 (mapcar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 #'(lambda (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 (if (eq buffer t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 "---"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 (setq line (funcall buffers-menu-format-buffer-line-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 (if complex-buffers-menu-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 (delq nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 (list line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 (vector "Switch to Buffer"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 (list buffers-menu-switch-to-buffer-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 (setq name (buffer-name buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 (if (eq buffers-menu-switch-to-buffer-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 'switch-to-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 (vector "Switch to Buffer, Other Frame"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 (list 'switch-to-buffer-other-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 (setq name (buffer-name buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 (if (and (buffer-modified-p buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 (buffer-file-name buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 (vector "Save Buffer"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 (list 'buffer-menu-save-buffer name) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 ["Save Buffer" nil nil]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856 (vector "Save As..."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 (list 'buffer-menu-write-file name) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 (vector "Delete Buffer" (list 'kill-buffer name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 (vector line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 (list buffers-menu-switch-to-buffer-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 (buffer-name buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 buffers)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 (defun buffers-menu-filter (menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 "This is the menu filter for the top-level buffers \"Buffers\" menu.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 It dynamically creates a list of buffers to use as the contents of the menu.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 Only the most-recently-used few buffers will be listed on the menu, for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 efficiency reasons. You can control how many buffers will be shown by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 setting `buffers-menu-max-size'. You can control the text of the menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 items by redefining the function `format-buffers-menu-line'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 (let ((buffers (delete-if buffers-menu-omit-function (buffer-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 (and (integerp buffers-menu-max-size)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 (> buffers-menu-max-size 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 (> (length buffers) buffers-menu-max-size)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 ;; shorten list of buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 (setcdr (nthcdr buffers-menu-max-size buffers) nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 (if buffers-menu-sort-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 (setq buffers (sort buffers buffers-menu-sort-function)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 (if (and buffers-menu-grouping-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 buffers-menu-submenus-for-groups-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 (let (groups groupnames current-group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 (mapl
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 #'(lambda (sublist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 (let ((groupname (funcall buffers-menu-grouping-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 (car sublist) (cadr sublist))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 (setq current-group (cons (car sublist) current-group))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 (if groupname
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 (setq groups (cons (nreverse current-group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 groups))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 (setq groupnames (cons groupname groupnames))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 (setq current-group nil)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 buffers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 (setq buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 (mapcar*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 #'(lambda (groupname group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 (cons groupname (build-buffers-menu-internal group)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 (nreverse groupnames)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 (nreverse groups))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 (if buffers-menu-grouping-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 (setq buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 (mapcon
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 #'(lambda (sublist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907 (cond ((funcall buffers-menu-grouping-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 (car sublist) (cadr sublist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 (list (car sublist) t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 (t (list (car sublist)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911 buffers))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 ;; remove a trailing separator.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 (and (>= (length buffers) 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 (let ((lastcdr (nthcdr (- (length buffers) 2) buffers)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 (if (eq t (cadr lastcdr))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 (setcdr lastcdr nil))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 (setq buffers (build-buffers-menu-internal buffers)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 (append menu buffers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 ;;; The Options menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 (defconst options-menu-saved-forms
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 ;; This is really quite a kludge, but it gets the job done.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 ;; remember that we have to conditionalize on default features
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 ;; both in the forms to evaluate and in the forms output to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 ;; .emacs, in case the .emacs is loaded into an XEmacs with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 ;; different features.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 (purecopy
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 '(
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 ;; Editing Options menu.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 ;; put case-fold-search first to defeat a bug in the backquote
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 ;; processing mechanism. Feh!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 case-fold-search
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 `(setq-default overwrite-mode ,(default-value 'overwrite-mode))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 (if (default-value 'overwrite-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 '(overwrite-mode 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 `(setq-default case-fold-search ,(default-value 'case-fold-search))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 case-replace
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 (if (memq 'pending-delete-pre-hook pre-command-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 '(progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945 (require 'pending-del)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 (pending-delete-on nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 zmacs-regions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 mouse-yank-at-point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 ;; General Options menu.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 teach-extended-commands-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 ;; (#### not actually on Options menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 teach-extended-commands-timeout
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 debug-on-error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 debug-on-quit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 ;; Printing Options menu.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958 lpr-switches
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 ps-print-color-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 ps-paper-type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 ;; Other Window Location
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 get-frame-for-buffer-default-instance-limit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 temp-buffer-show-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966 ;; Syntax Highlighting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967 font-lock-auto-fontify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 font-lock-use-fonts
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 font-lock-use-colors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 font-lock-maximum-decoration
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 font-lock-maximum-size
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 ;; (#### the next two not on Options menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 font-lock-mode-enable-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 font-lock-mode-disable-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 ;; #### - this structure is clearly broken. There's no way to ever
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 ;; un-require font-lock via the menus. --Stig
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977 (if (featurep 'font-lock)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 '(require 'font-lock))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979 (if (and (boundp 'font-lock-mode-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 (memq 'turn-on-fast-lock font-lock-mode-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 '(add-hook 'font-lock-mode-hook 'turn-on-fast-lock)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 '(remove-hook 'font-lock-mode-hook 'turn-on-fast-lock))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 (if (and (boundp 'font-lock-mode-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984 (memq 'turn-on-lazy-lock font-lock-mode-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985 '(add-hook 'font-lock-mode-hook 'turn-on-lazy-lock)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 '(remove-hook 'font-lock-mode-hook 'turn-on-lazy-lock))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 ;; Paren Highlighting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 (if paren-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 `(progn (require 'paren) (paren-set-mode ',paren-mode)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 ;; For specifiers, we only save global settings since the others
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 ;; will belong to objects which only exist during this session.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995 ;; Frame Appearance
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 (if (featurep 'scrollbar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 `(if (featurep 'scrollbar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 (add-spec-list-to-specifier
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 scrollbar-width
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001 ',(specifier-spec-list scrollbar-width 'global))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002 (add-spec-list-to-specifier
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 scrollbar-height
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 ',(specifier-spec-list scrollbar-height 'global)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 `(add-spec-list-to-specifier
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 modeline-shadow-thickness
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 ',(specifier-spec-list modeline-shadow-thickness 'global))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 `(setq-default truncate-lines ,(default-value 'truncate-lines))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009 bar-cursor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010 (if (and (boundp 'blink-cursor-mode) blink-cursor-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 '(blink-cursor-mode t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013 ;; Menubar Appearance
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 buffers-menu-max-size
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 complex-buffers-menu-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016 buffers-menu-sort-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 buffers-menu-grouping-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 buffers-menu-submenus-for-groups-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 font-menu-ignore-scaled-fonts
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 font-menu-this-frame-only-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 ;; Toolbar Appearance
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 (if (featurep 'toolbar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 `(if (featurep 'toolbar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 (set-default-toolbar-position
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 ',(default-toolbar-position))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 (add-spec-list-to-specifier
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 default-toolbar-visible-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 ',(specifier-spec-list default-toolbar-visible-p 'global))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 (add-spec-list-to-specifier
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032 toolbar-buttons-captioned-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033 ',(specifier-spec-list toolbar-buttons-captioned-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 'global)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036 ;; Open URLs With
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 browse-url-browser-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 ;; Now save all faces.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 ;; Setting this in lisp conflicts with X resources. Bad move. --Stig
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 ;; (list 'set-face-font ''default (face-font-name 'default))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043 ;; (list 'set-face-font ''modeline (face-font-name 'modeline))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 (cons 'progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 (mapcar #'(lambda (face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 `(make-face ',face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048 (face-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050 (cons 'progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051 (apply 'nconc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 (mapcar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053 #'(lambda (face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 (delq nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055 (mapcar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 #'(lambda (property)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1057 (if (specifier-spec-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058 (face-property face property))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059 `(add-spec-list-to-specifier
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 (face-property ',face ',property)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 ',(save-options-specifier-spec-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062 face property))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 built-in-face-specifiers)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064 (face-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 "The variables to save; or forms to evaluate to get forms to write out.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068 This is used by `save-options-menu-settings' and should mirror the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 options listed in the Options menu.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1071 (defun save-options-specifier-spec-list (face property)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072 (if (not (or (eq property 'font) (eq property 'color)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 (specifier-spec-list (face-property face property) 'global)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074 (let* ((retlist (specifier-spec-list (face-property face property)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075 'global))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1076 (entry (cdr (car retlist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077 item)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078 (while entry
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079 (setq item (car entry))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080 (if (eq property 'font)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 (if (font-instance-p (cdr item))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082 (setcdr item (font-instance-name (cdr item))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 (if (color-instance-p (cdr item))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084 (setcdr item (color-instance-name (cdr item)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085 (setq entry (cdr entry)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 retlist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 (defvar save-options-init-file nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089 "File into which to save forms to load the options file (nil for .emacs).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090 Normally this is nil, which means save into your .emacs file (the value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091 of `user-init-file'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093 (defvar save-options-file ".xemacs-options"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094 "File to save options into.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095 This file is loaded from your .emacs file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096 If this is a relative filename, it is put into the same directory as your
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097 .emacs file.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 (defun save-options-menu-settings ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100 "Saves the current settings of the `Options' menu to your `.emacs' file."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102 ;; we compute the actual filenames now because x-menubar is loaded
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103 ;; at dump time, when the identity of the user running XEmacs is not known.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104 (let* ((actual-save-options-init-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105 (or save-options-init-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106 (and (not (equal user-init-file ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107 user-init-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108 (and (eq system-type 'ms-dos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109 (concat "~" (user-login-name) "/_emacs"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110 (concat "~" (user-login-name) "/.emacs")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1111 (actual-save-options-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1112 (abbreviate-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113 (expand-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114 save-options-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115 (file-name-directory actual-save-options-init-file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1116 t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 (init-output-buffer (find-file-noselect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1118 actual-save-options-init-file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1119 init-output-marker
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1120 (options-output-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1121 (find-file-noselect actual-save-options-file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1122 options-output-marker)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1123
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1124 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1125 (set-buffer options-output-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1126 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1127 (setq options-output-marker (point-marker)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1128
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1129 ;; run with current-buffer unchanged so that variables are evaluated in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1130 ;; the current context, instead of in the context of the ".emacs" buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1131 ;; or the ".xemacs-options" buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1132
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133 ;; first write out .xemacs-options.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135 (let ((standard-output options-output-marker))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136 (princ ";; -*- Mode: Emacs-Lisp -*-\n\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137 (princ "(setq options-file-xemacs-version '(")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138 (princ emacs-major-version)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139 (princ " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140 (princ emacs-minor-version)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1141 (princ "))\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1142 (let ((print-readably t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1143 (print-escape-newlines t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1144 (mapcar #'(lambda (var)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1145 (princ " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1146 (if (symbolp var)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147 (prin1 (list 'setq-default var
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1148 (let ((val (symbol-value var)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1149 (if (or (memq val '(t nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1150 (and (not (symbolp val))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1151 (not (consp val))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1152 val
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153 (list 'quote val)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1154 (setq var (eval var))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1155 (cond ((eq (car-safe var) 'progn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1156 (while (setq var (cdr var))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1157 (prin1 (car var))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1158 (princ "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159 (if (cdr var) (princ " "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1161 (var
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1162 (prin1 var))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1163 (if var (princ "\n")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1164 options-menu-saved-forms)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1165 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1166 (set-marker options-output-marker nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1167 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1168 (set-buffer options-output-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1169 (save-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1170
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1171 ;; then fix .emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1172
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1173 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1174 (set-buffer init-output-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1175 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1176 ;; Find and delete the previously saved data, and position to write.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1177 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1178 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1179 (if (re-search-forward "^;; Options Menu Settings *\n" nil 'move)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1180 (let ((p (match-beginning 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1181 (goto-char p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1182 (or (re-search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1183 "^;; End of Options Menu Settings *\\(\n\\|\\'\\)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1184 nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1185 (error "can't find END of saved state in .emacs"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1186 (delete-region p (match-end 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1187 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1188 (insert "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1189 (setq init-output-marker (point-marker)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1190
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1191 (let ((standard-output init-output-marker))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1192 (princ ";; Options Menu Settings\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1193 (princ ";; =====================\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1194 (princ "(cond\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1195 (princ " ((and (string-match \"XEmacs\" emacs-version)\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1196 (princ " (boundp 'emacs-major-version)\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1197 (princ " (or (and\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1198 (princ " (= emacs-major-version 19)\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1199 (princ " (>= emacs-minor-version 14))\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1200 (princ " (= emacs-major-version 20))\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1201 (princ " (fboundp 'load-options-file))\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1202 (princ " (load-options-file \"")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1203 (princ actual-save-options-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1204 (princ "\")))\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1205 (princ ";; ============================\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1206 (princ ";; End of Options Menu Settings\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1207
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1208 (set-marker init-output-marker nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1209 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1210 (set-buffer init-output-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1211 (save-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1212 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1213
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1214
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1215 (set-menubar default-menubar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1216
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1217
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1218 ;;; Popup menus.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1219
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1220 (defconst default-popup-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1221 '("XEmacs Commands"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1222 :filter edit-menu-filter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1223 ["Undo" advertised-undo t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1224 ["Cut" x-kill-primary-selection t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1225 ["Copy" x-copy-primary-selection t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1226 ["Paste" x-yank-clipboard-selection t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1227 ["Clear" x-delete-primary-selection t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1228 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1229 ["Select Block" mark-paragraph t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1230 ["Split Window" (split-window) t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1231 ["Unsplit Window" delete-other-windows t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1232 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1233
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1234 (defvar global-popup-menu nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1235 "The global popup menu. This is present in all modes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1236 See the function `popup-menu' for a description of menu syntax.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1237
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1238 (defvar mode-popup-menu nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1239 "The mode-specific popup menu. Automatically buffer local.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1240 This is appended to the default items in `global-popup-menu'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1241 See the function `popup-menu' for a description of menu syntax.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1242 (make-variable-buffer-local 'mode-popup-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1243
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1244 ;; In an effort to avoid massive menu clutter, this mostly worthless menu is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1245 ;; superceded by any local popup menu...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1246 (setq-default mode-popup-menu default-popup-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1247
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1248 (defvar activate-popup-menu-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1249 "Function or functions run before a mode-specific popup menu is made visible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1250 These functions are called with no arguments, and should interrogate and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1251 modify the value of `global-popup-menu' or `mode-popup-menu' as desired.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1252 Note: this hook is only run if you use `popup-mode-menu' for activating the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1253 global and mode-specific commands; if you have your own binding for button3,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1254 this hook won't be run.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1255
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1256 (defun popup-mode-menu ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1257 "Pop up a menu of global and mode-specific commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1258 The menu is computed by combining `global-popup-menu' and `mode-popup-menu'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1259 (interactive "@_")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1260 (run-hooks 'activate-popup-menu-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1261 (popup-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1262 (cond ((and global-popup-menu mode-popup-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1263 (check-menu-syntax mode-popup-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1264 (let ((title (car mode-popup-menu))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1265 (items (cdr mode-popup-menu)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1266 (append global-popup-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1267 '("---" "---")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268 (if popup-menu-titles (list title))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269 (if popup-menu-titles '("---" "---"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1270 items)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1271 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272 (or mode-popup-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1273 global-popup-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1274 (error "No menu here."))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1275
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1276 (defun popup-buffer-menu (event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1277 "Pop up a copy of the Buffers menu (from the menubar) where the mouse is clicked."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1278 (interactive "e")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279 (let ((window (and (event-over-text-area-p event) (event-window event)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1280 (bmenu nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1281 (or window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1282 (error "Pointer must be in a normal window"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1283 (select-window window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1284 (if current-menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1285 (setq bmenu (assoc "Buffers" current-menubar)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1286 (if (null bmenu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287 (setq bmenu (assoc "Buffers" default-menubar)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288 (if (null bmenu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1289 (error "Can't find the Buffers menu"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1290 (popup-menu bmenu)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292 (defun popup-menubar-menu (event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1293 "Pop up a copy of menu that also appears in the menubar"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1294 ;; by Stig@hackvan.com
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1295 (interactive "e")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1296 (let ((window (and (event-over-text-area-p event) (event-window event)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1297 popup-menubar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1298 (or window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1299 (error "Pointer must be in a normal window"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1300 (select-window window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1301 (and current-menubar (run-hooks 'activate-menubar-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1302 ;; ##### Instead of having to copy this just to safely get rid of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1303 ;; any nil what we should really do is fix up the internal menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1304 ;; code to just ignore nil if generating a popup menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1305 (setq popup-menubar (delete nil (copy-sequence (or current-menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1306 default-menubar))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1307 (popup-menu (cons "Menubar Menu" popup-menubar))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1308 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1309
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1310 (global-set-key 'button3 'popup-mode-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1311 ;; shift button3 and shift button2 are reserved for Hyperbole
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1312 (global-set-key '(meta control button3) 'popup-buffer-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1313 (global-set-key '(meta shift button3) 'popup-menubar-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1314
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1315 ;; Here's a test of the cool new menu features (from Stig).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1316
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1317 ;(setq mode-popup-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1318 ; '("Test Popup Menu"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1319 ; :filter cdr
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1320 ; ["this item won't appear because of the menu filter" ding t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1321 ; "--:singleLine"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1322 ; "singleLine"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1323 ; "--:doubleLine"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1324 ; "doubleLine"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1325 ; "--:singleDashedLine"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1326 ; "singleDashedLine"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1327 ; "--:doubleDashedLine"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1328 ; "doubleDashedLine"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1329 ; "--:noLine"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1330 ; "noLine"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1331 ; "--:shadowEtchedIn"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1332 ; "shadowEtchedIn"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1333 ; "--:shadowEtchedOut"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1334 ; "shadowEtchedOut"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1335 ; "--:shadowDoubleEtchedIn"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1336 ; "shadowDoubleEtchedIn"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1337 ; "--:shadowDoubleEtchedOut"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1338 ; "shadowDoubleEtchedOut"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1339 ; "--:shadowEtchedInDash"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1340 ; "shadowEtchedInDash"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1341 ; "--:shadowEtchedOutDash"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1342 ; "shadowEtchedOutDash"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1343 ; "--:shadowDoubleEtchedInDash"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1344 ; "shadowDoubleEtchedInDash"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1345 ; "--:shadowDoubleEtchedOutDash"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1346 ; "shadowDoubleEtchedOutDash"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1347 ; ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1348
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1349
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1350 (provide 'x-menubar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1351
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1352 ;;; x-menubar.el ends here.