152 |
'(menu-item "Revert Buffer" revert-buffer |
'(menu-item "Revert Buffer" revert-buffer |
153 |
:enable (or revert-buffer-function |
:enable (or revert-buffer-function |
154 |
revert-buffer-insert-file-contents-function |
revert-buffer-insert-file-contents-function |
155 |
(and (buffer-file-name) |
(and buffer-file-number |
156 |
(or (buffer-modified-p) |
(or (buffer-modified-p) |
157 |
(not (verify-visited-file-modtime |
(not (verify-visited-file-modtime |
158 |
(current-buffer)))))) |
(current-buffer)))))) |
193 |
|
|
194 |
|
|
195 |
;; The "Edit" menu items |
;; The "Edit" menu items |
196 |
|
|
197 |
|
;; The "Edit->Search" submenu |
198 |
|
(defvar menu-bar-last-search-type nil |
199 |
|
"Type of last non-incremental search command called from the menu.") |
200 |
|
|
201 |
|
(defun nonincremental-repeat-search-forward () |
202 |
|
"Search forward for the previous search string or regexp." |
203 |
|
(interactive) |
204 |
|
(cond |
205 |
|
((and (eq menu-bar-last-search-type 'string) |
206 |
|
search-ring) |
207 |
|
(search-forward (car search-ring))) |
208 |
|
((and (eq menu-bar-last-search-type 'regexp) |
209 |
|
regexp-search-ring) |
210 |
|
(re-search-forward (car regexp-search-ring))) |
211 |
|
(t |
212 |
|
(error "No previous search")))) |
213 |
|
|
214 |
|
(defun nonincremental-repeat-search-backward () |
215 |
|
"Search backward for the previous search string or regexp." |
216 |
|
(interactive) |
217 |
|
(cond |
218 |
|
((and (eq menu-bar-last-search-type 'string) |
219 |
|
search-ring) |
220 |
|
(search-backward (car search-ring))) |
221 |
|
((and (eq menu-bar-last-search-type 'regexp) |
222 |
|
regexp-search-ring) |
223 |
|
(re-search-backward (car regexp-search-ring))) |
224 |
|
(t |
225 |
|
(error "No previous search")))) |
226 |
|
|
227 |
(defun nonincremental-search-forward (string) |
(defun nonincremental-search-forward (string) |
228 |
"Read a string and search for it nonincrementally." |
"Read a string and search for it nonincrementally." |
229 |
(interactive "sSearch for string: ") |
(interactive "sSearch for string: ") |
230 |
|
(setq menu-bar-last-search-type 'string) |
231 |
(if (equal string "") |
(if (equal string "") |
232 |
(search-forward (car search-ring)) |
(search-forward (car search-ring)) |
233 |
(isearch-update-ring string nil) |
(isearch-update-ring string nil) |
236 |
(defun nonincremental-search-backward (string) |
(defun nonincremental-search-backward (string) |
237 |
"Read a string and search backward for it nonincrementally." |
"Read a string and search backward for it nonincrementally." |
238 |
(interactive "sSearch for string: ") |
(interactive "sSearch for string: ") |
239 |
|
(setq menu-bar-last-search-type 'string) |
240 |
(if (equal string "") |
(if (equal string "") |
241 |
(search-backward (car search-ring)) |
(search-backward (car search-ring)) |
242 |
(isearch-update-ring string nil) |
(isearch-update-ring string nil) |
245 |
(defun nonincremental-re-search-forward (string) |
(defun nonincremental-re-search-forward (string) |
246 |
"Read a regular expression and search for it nonincrementally." |
"Read a regular expression and search for it nonincrementally." |
247 |
(interactive "sSearch for regexp: ") |
(interactive "sSearch for regexp: ") |
248 |
|
(setq menu-bar-last-search-type 'regexp) |
249 |
(if (equal string "") |
(if (equal string "") |
250 |
(re-search-forward (car regexp-search-ring)) |
(re-search-forward (car regexp-search-ring)) |
251 |
(isearch-update-ring string t) |
(isearch-update-ring string t) |
254 |
(defun nonincremental-re-search-backward (string) |
(defun nonincremental-re-search-backward (string) |
255 |
"Read a regular expression and search backward for it nonincrementally." |
"Read a regular expression and search backward for it nonincrementally." |
256 |
(interactive "sSearch for regexp: ") |
(interactive "sSearch for regexp: ") |
257 |
|
(setq menu-bar-last-search-type 'regexp) |
258 |
(if (equal string "") |
(if (equal string "") |
259 |
(re-search-backward (car regexp-search-ring)) |
(re-search-backward (car regexp-search-ring)) |
260 |
(isearch-update-ring string t) |
(isearch-update-ring string t) |
261 |
(re-search-backward string))) |
(re-search-backward string))) |
262 |
|
|
|
(defun nonincremental-repeat-search-forward () |
|
|
"Search forward for the previous search string." |
|
|
(interactive) |
|
|
(if (null search-ring) |
|
|
(error "No previous search")) |
|
|
(search-forward (car search-ring))) |
|
|
|
|
|
(defun nonincremental-repeat-search-backward () |
|
|
"Search backward for the previous search string." |
|
|
(interactive) |
|
|
(if (null search-ring) |
|
|
(error "No previous search")) |
|
|
(search-backward (car search-ring))) |
|
|
|
|
|
(defun nonincremental-repeat-re-search-forward () |
|
|
"Search forward for the previous regular expression." |
|
|
(interactive) |
|
|
(if (null regexp-search-ring) |
|
|
(error "No previous search")) |
|
|
(re-search-forward (car regexp-search-ring))) |
|
|
|
|
|
(defun nonincremental-repeat-re-search-backward () |
|
|
"Search backward for the previous regular expression." |
|
|
(interactive) |
|
|
(if (null regexp-search-ring) |
|
|
(error "No previous search")) |
|
|
(re-search-backward (car regexp-search-ring))) |
|
|
|
|
263 |
(defvar menu-bar-search-menu (make-sparse-keymap "Search")) |
(defvar menu-bar-search-menu (make-sparse-keymap "Search")) |
|
(defvar menu-bar-adv-search-menu |
|
|
(make-sparse-keymap "Advanced Search/Replace")) |
|
264 |
|
|
265 |
(define-key menu-bar-adv-search-menu [tags-continue] |
;; The Edit->Search->Incremental Search menu |
266 |
'(menu-item "Continue Tags Search/Replace" tags-loop-continue |
(defvar menu-bar-i-search-menu |
267 |
:help "Continue last tags search/replace operation")) |
(make-sparse-keymap "Incremental Search")) |
268 |
(define-key menu-bar-adv-search-menu [tags-repl] |
|
269 |
'(menu-item "Replace in all tagged files" tags-query-replace |
(define-key menu-bar-i-search-menu [isearch-backward-regexp] |
270 |
:help "Interactively replace a regexp in all tagged files")) |
'(menu-item "Backward Regexp..." isearch-backward-regexp |
271 |
(define-key menu-bar-adv-search-menu [tags-srch] |
:help "Search backwards for a regular expression as you type it")) |
272 |
'(menu-item "Search in all tagged files" tags-search |
(define-key menu-bar-i-search-menu [isearch-forward-regexp] |
273 |
:help "Search for a regexp in all tagged files")) |
'(menu-item "Forward Regexp..." isearch-forward-regexp |
274 |
|
:help "Search forward for a regular expression as you type it")) |
275 |
|
(define-key menu-bar-i-search-menu [isearch-backward] |
276 |
|
'(menu-item "Backward String..." isearch-backward |
277 |
|
:help "Search backwards for a string as you type it")) |
278 |
|
(define-key menu-bar-i-search-menu [isearch-forward] |
279 |
|
'(menu-item "Forward String..." isearch-forward |
280 |
|
:help "Search forward for a string as you type it")) |
281 |
|
|
282 |
|
|
283 |
(define-key menu-bar-adv-search-menu [separator-tag-search] |
(define-key menu-bar-search-menu [i-search] |
284 |
|
(list 'menu-item "Incremental Search" menu-bar-i-search-menu |
285 |
|
:help "Incremental Search finds partial matches while you type the search string.\nIt is most convenient from the keyboard. Try it!")) |
286 |
|
(define-key menu-bar-search-menu [separator-tag-isearch] |
287 |
'(menu-item "--")) |
'(menu-item "--")) |
288 |
|
|
289 |
(define-key menu-bar-adv-search-menu [query-replace-regexp] |
(define-key menu-bar-search-menu [tags-continue] |
290 |
'(menu-item "Replace Regexp..." query-replace-regexp |
'(menu-item "Continue Tags Search" tags-loop-continue |
291 |
:enable (not buffer-read-only) |
:help "Continue last tags search operation")) |
292 |
:help "Replace regular expression, ask about each occurrence")) |
(define-key menu-bar-search-menu [tags-srch] |
293 |
(define-key menu-bar-adv-search-menu [repeat-regexp-back] |
'(menu-item "Search tagged files" tags-search |
294 |
'(menu-item "Repeat Regexp Backwards" |
:help "Search for a regexp in all tagged files")) |
295 |
nonincremental-repeat-re-search-backward |
(define-key menu-bar-search-menu [separator-tag-search] |
|
:enable regexp-search-ring |
|
|
:help "Repeat last regular expression search backwards")) |
|
|
(define-key menu-bar-adv-search-menu [repeat-regexp-fwd] |
|
|
'(menu-item "Repeat Regexp" nonincremental-repeat-re-search-forward |
|
|
:enable regexp-search-ring |
|
|
:help "Repeat last regular expression search forward")) |
|
|
(define-key menu-bar-adv-search-menu [re-search-backward] |
|
|
'(menu-item "Search Regexp Backwards..." nonincremental-re-search-backward |
|
|
:help "Search backwards for a regular expression")) |
|
|
(define-key menu-bar-adv-search-menu [re-search-forward] |
|
|
'(menu-item "Search Regexp..." nonincremental-re-search-forward |
|
|
:help "Search forward for a regular expression")) |
|
|
(define-key menu-bar-adv-search-menu [separator-tag-isearch] |
|
296 |
'(menu-item "--")) |
'(menu-item "--")) |
|
(define-key menu-bar-adv-search-menu [isearch-backward] |
|
|
'(menu-item "Incremental Search Backwards..." isearch-backward |
|
|
:help "Search backwards for a string as you type it")) |
|
|
(define-key menu-bar-adv-search-menu [isearch-forward] |
|
|
'(menu-item "Incremental Search..." isearch-forward |
|
|
:help "Search forward for a string as you type it")) |
|
|
(define-key menu-bar-search-menu [re-search] |
|
|
(list 'menu-item "Advanced Search/Replace" menu-bar-adv-search-menu |
|
|
:help "Regexp and Tags search and replace")) |
|
297 |
|
|
|
(define-key menu-bar-search-menu [query-replace] |
|
|
'(menu-item "Replace..." query-replace |
|
|
:enable (not buffer-read-only) |
|
|
:help "Replace string interactively, ask about each occurrence")) |
|
298 |
(define-key menu-bar-search-menu [repeat-search-back] |
(define-key menu-bar-search-menu [repeat-search-back] |
299 |
'(menu-item "Repeat Backwards" nonincremental-repeat-search-backward |
'(menu-item "Repeat Backwards" nonincremental-repeat-search-backward |
300 |
:enable search-ring |
:enable (or (and (eq menu-bar-last-search-type 'string) |
301 |
|
search-ring) |
302 |
|
(and (eq menu-bar-last-search-type 'regexp) |
303 |
|
regexp-search-ring)) |
304 |
:help "Repeat last search backwards")) |
:help "Repeat last search backwards")) |
305 |
(define-key menu-bar-search-menu [repeat-search-fwd] |
(define-key menu-bar-search-menu [repeat-search-fwd] |
306 |
'(menu-item "Repeat Search" nonincremental-repeat-search-forward |
'(menu-item "Repeat Forward" nonincremental-repeat-search-forward |
307 |
:enable search-ring |
:enable (or (and (eq menu-bar-last-search-type 'string) |
308 |
|
search-ring) |
309 |
|
(and (eq menu-bar-last-search-type 'regexp) |
310 |
|
regexp-search-ring)) |
311 |
:help "Repeat last search forward")) |
:help "Repeat last search forward")) |
312 |
|
(define-key menu-bar-search-menu [separator-repeat-search] |
313 |
|
'(menu-item "--")) |
314 |
|
|
315 |
|
(define-key menu-bar-search-menu [re-search-backward] |
316 |
|
'(menu-item "Regexp Backwards..." nonincremental-re-search-backward |
317 |
|
:help "Search backwards for a regular expression")) |
318 |
|
(define-key menu-bar-search-menu [re-search-forward] |
319 |
|
'(menu-item "Regexp Forward..." nonincremental-re-search-forward |
320 |
|
:help "Search forward for a regular expression")) |
321 |
|
|
322 |
(define-key menu-bar-search-menu [search-backward] |
(define-key menu-bar-search-menu [search-backward] |
323 |
'(menu-item "Search Backwards..." nonincremental-search-backward |
'(menu-item "String Backwards..." nonincremental-search-backward |
324 |
:help "Search backwards for a string")) |
:help "Search backwards for a string")) |
325 |
(define-key menu-bar-search-menu [search-forward] |
(define-key menu-bar-search-menu [search-forward] |
326 |
'(menu-item "Search..." nonincremental-search-forward |
'(menu-item "String Forward..." nonincremental-search-forward |
327 |
:help "Search forward for a string")) |
:help "Search forward for a string")) |
328 |
|
|
329 |
|
;; The Edit->Replace submenu |
330 |
|
|
331 |
|
(defvar menu-bar-replace-menu (make-sparse-keymap "Replace")) |
332 |
|
|
333 |
|
(define-key menu-bar-replace-menu [tags-repl-continue] |
334 |
|
'(menu-item "Continue Replace" tags-loop-continue |
335 |
|
:help "Continue last tags replace operation")) |
336 |
|
(define-key menu-bar-replace-menu [tags-repl] |
337 |
|
'(menu-item "Replace in tagged files" tags-query-replace |
338 |
|
:help "Interactively replace a regexp in all tagged files")) |
339 |
|
(define-key menu-bar-replace-menu [separator-replace-tags] |
340 |
|
'(menu-item "--")) |
341 |
|
|
342 |
|
(define-key menu-bar-replace-menu [query-replace-regexp] |
343 |
|
'(menu-item "Replace Regexp..." query-replace-regexp |
344 |
|
:enable (not buffer-read-only) |
345 |
|
:help "Replace regular expression interactively, ask about each occurrence")) |
346 |
|
(define-key menu-bar-replace-menu [query-replace] |
347 |
|
'(menu-item "Replace String..." query-replace |
348 |
|
:enable (not buffer-read-only) |
349 |
|
:help "Replace string interactively, ask about each occurrence")) |
350 |
|
|
351 |
;;; Assemble the top-level Edit menu items. |
;;; Assemble the top-level Edit menu items. |
352 |
(define-key menu-bar-edit-menu [props] |
(define-key menu-bar-edit-menu [props] |
353 |
'(menu-item "Text Properties" facemenu-menu |
'(menu-item "Text Properties" facemenu-menu |
380 |
:help "Find function/variables whose names match regexp")) |
:help "Find function/variables whose names match regexp")) |
381 |
(define-key menu-bar-goto-menu [next-tag-otherw] |
(define-key menu-bar-goto-menu [next-tag-otherw] |
382 |
'(menu-item "Next Tag in Other Window" |
'(menu-item "Next Tag in Other Window" |
383 |
(lambda () (interactive) (find-tag-other-window nil t)) |
menu-bar-next-tag-other-window |
384 |
:enable (and (boundp 'tags-location-ring) |
:enable (and (boundp 'tags-location-ring) |
385 |
(not (ring-empty-p tags-location-ring))) |
(not (ring-empty-p tags-location-ring))) |
386 |
:help "Find next function/variable matching last tag name in another window")) |
:help "Find next function/variable matching last tag name in another window")) |
387 |
|
|
388 |
|
(defun menu-bar-next-tag-other-window () |
389 |
|
"Find the next definition of the tag already specified." |
390 |
|
(interactive) |
391 |
|
(find-tag-other-window nil t)) |
392 |
|
|
393 |
|
(defun menu-bar-next-tag () |
394 |
|
"Find the next definition of the tag already specified." |
395 |
|
(interactive) |
396 |
|
(find-tag nil t)) |
397 |
|
|
398 |
(define-key menu-bar-goto-menu [next-tag] |
(define-key menu-bar-goto-menu [next-tag] |
399 |
'(menu-item "Find Next Tag" |
'(menu-item "Find Next Tag" |
400 |
(lambda () (interactive) (find-tag nil t)) |
menu-bar-next-tag |
401 |
:enable (and (boundp 'tags-location-ring) |
:enable (and (boundp 'tags-location-ring) |
402 |
(not (ring-empty-p tags-location-ring))) |
(not (ring-empty-p tags-location-ring))) |
403 |
:help "Find next function/variable matching last tag name")) |
:help "Find next function/variable matching last tag name")) |
425 |
(define-key menu-bar-edit-menu [goto] |
(define-key menu-bar-edit-menu [goto] |
426 |
(list 'menu-item "Go To" menu-bar-goto-menu)) |
(list 'menu-item "Go To" menu-bar-goto-menu)) |
427 |
|
|
428 |
|
(define-key menu-bar-edit-menu [replace] |
429 |
|
(list 'menu-item "Replace" menu-bar-replace-menu)) |
430 |
|
|
431 |
(define-key menu-bar-edit-menu [search] |
(define-key menu-bar-edit-menu [search] |
432 |
(list 'menu-item "Search" menu-bar-search-menu)) |
(list 'menu-item "Search" menu-bar-search-menu)) |
433 |
|
|
582 |
|
|
583 |
;(defvar menu-bar-preferences-menu (make-sparse-keymap "Preferences")) |
;(defvar menu-bar-preferences-menu (make-sparse-keymap "Preferences")) |
584 |
|
|
585 |
(defmacro menu-bar-make-toggle (name variable doc message help &optional props &rest body) |
(defmacro menu-bar-make-mm-toggle (fname doc help &optional props) |
586 |
|
"Make a menu-item for a global minor mode toggle. |
587 |
|
FNAME is the minor mode's name (variable and function). |
588 |
|
DOC is the text to use the menu entry. |
589 |
|
HELP is the text to use for the tooltip. |
590 |
|
PROPS are additional properties." |
591 |
|
`'(menu-item ,doc ,fname |
592 |
|
,@(if props props) |
593 |
|
:help ,help |
594 |
|
:button (:toggle . (and (default-boundp ',fname) |
595 |
|
(default-value ',fname))))) |
596 |
|
|
597 |
|
(defmacro menu-bar-make-toggle (name variable doc message help &rest body) |
598 |
`(progn |
`(progn |
599 |
(defun ,name () |
(defun ,name () |
600 |
,(concat "Toggle whether to " (downcase (substring help 0 1)) |
,(concat "Toggle whether to " (downcase (substring help 0 1)) |
607 |
(get (or (get ',variable 'custom-get) 'default-value))) |
(get (or (get ',variable 'custom-get) 'default-value))) |
608 |
(funcall set ',variable (not (funcall get ',variable)))))) |
(funcall set ',variable (not (funcall get ',variable)))))) |
609 |
(message ,message "enabled") |
(message ,message "enabled") |
610 |
(message ,message "disabled"))) |
(message ,message "disabled")) |
611 |
;; The function `customize-mark-as-set' must only be called when |
;; The function `customize-mark-as-set' must only be called when |
612 |
;; a variable is set interactively, as the purpose is to mark it |
;; a variable is set interactively, as the purpose is to mark it as |
613 |
;; as a candidate for "Save Options", and we do not want to save |
;; a candidate for "Save Options", and we do not want to save options |
614 |
;; options the user have already set explicitly in his init |
;; the user have already set explicitly in his init file. |
615 |
;; file. Unfortunately, he could very likely call the function |
(if (interactive-p) (customize-mark-as-set ',variable))) |
616 |
;; defined above there. So we put `customize-mark-as-set' in a |
'(menu-item ,doc ,name |
|
;; lambda expression. |
|
|
;; -- Per Abrahamsen <abraham@dina.kvl.dk> 2002-02-11. |
|
|
'(menu-item ,doc (lambda () |
|
|
(interactive) |
|
|
(,name) |
|
|
(customize-mark-as-set ',variable)) |
|
|
,@(if props props) |
|
617 |
:help ,help |
:help ,help |
618 |
:button (:toggle . (and (default-boundp ',variable) |
:button (:toggle . (and (default-boundp ',variable) |
619 |
(default-value ',variable)))))) |
(default-value ',variable)))))) |
661 |
(defvar menu-bar-showhide-menu (make-sparse-keymap "Show/Hide")) |
(defvar menu-bar-showhide-menu (make-sparse-keymap "Show/Hide")) |
662 |
|
|
663 |
(define-key menu-bar-showhide-menu [column-number-mode] |
(define-key menu-bar-showhide-menu [column-number-mode] |
664 |
(menu-bar-make-toggle toggle-column-number-mode column-number-mode |
(menu-bar-make-mm-toggle column-number-mode |
665 |
"Show Column Numbers" "Column number mode %s" |
"Show Column Numbers" |
666 |
"Show the current column number in the mode line")) |
"Show the current column number in the mode line")) |
667 |
|
|
668 |
(define-key menu-bar-showhide-menu [line-number-mode] |
(define-key menu-bar-showhide-menu [line-number-mode] |
669 |
(menu-bar-make-toggle toggle-line-number-mode line-number-mode |
(menu-bar-make-mm-toggle line-number-mode |
670 |
"Show Line Numbers" "Line number mode %s" |
"Show Line Numbers" |
671 |
"Show the current line number in the mode line")) |
"Show the current line number in the mode line")) |
672 |
|
|
673 |
(define-key menu-bar-showhide-menu [linecolumn-separator] |
(define-key menu-bar-showhide-menu [linecolumn-separator] |
674 |
'("--")) |
'("--")) |
678 |
(interactive) |
(interactive) |
679 |
(if (display-time-mode) |
(if (display-time-mode) |
680 |
(message "Display-time mode enabled.") |
(message "Display-time mode enabled.") |
681 |
(message "Display-time mode disabled."))) |
(message "Display-time mode disabled.")) |
682 |
|
(customize-mark-as-set 'display-time-mode)) |
683 |
|
|
684 |
(define-key menu-bar-showhide-menu [showhide-date-time] |
(define-key menu-bar-showhide-menu [showhide-date-time] |
685 |
'(menu-item "Date and Time" (lambda () |
'(menu-item "Date and Time" showhide-date-time |
|
(interactive) |
|
|
(showhide-date-time) |
|
|
(customize-mark-as-set 'display-time-mode)) |
|
686 |
:help "Display date and time in the mode line" |
:help "Display date and time in the mode line" |
687 |
:button (:toggle . display-time-mode))) |
:button (:toggle . display-time-mode))) |
688 |
|
|
711 |
:visible (display-graphic-p))) |
:visible (display-graphic-p))) |
712 |
|
|
713 |
(defun menu-bar-showhide-fringe-menu-customize-reset () |
(defun menu-bar-showhide-fringe-menu-customize-reset () |
714 |
"Reset the default fringe mode." |
"Reset the fringe mode: display fringes on both sides of a window." |
715 |
(interactive) |
(interactive) |
716 |
(customize-set-variable 'fringe-mode nil)) |
(customize-set-variable 'fringe-mode nil)) |
717 |
|
|
718 |
|
;; The real definition is in fringe.el. |
719 |
|
;; This is to prevent errors in the :radio conditions below. |
720 |
|
(setq fringe-mode nil) |
721 |
|
|
722 |
(define-key menu-bar-showhide-fringe-menu [default] |
(define-key menu-bar-showhide-fringe-menu [default] |
723 |
'(menu-item "Default" menu-bar-showhide-fringe-menu-customize-reset |
'(menu-item "Default" menu-bar-showhide-fringe-menu-customize-reset |
724 |
:help "Default width fringe on both left and right side" |
:help "Default width fringe on both left and right side" |
726 |
:button (:radio . (eq fringe-mode nil)))) |
:button (:radio . (eq fringe-mode nil)))) |
727 |
|
|
728 |
(defun menu-bar-showhide-fringe-menu-customize-left () |
(defun menu-bar-showhide-fringe-menu-customize-left () |
729 |
"Make fringes appear only on the left." |
"Display fringes only on the left of each window." |
730 |
(interactive) |
(interactive) |
731 |
(require 'fringe) |
(require 'fringe) |
732 |
(customize-set-variable 'fringe-mode '(nil . 0))) |
(customize-set-variable 'fringe-mode '(nil . 0))) |
738 |
:button (:radio . (equal fringe-mode '(nil . 0))))) |
:button (:radio . (equal fringe-mode '(nil . 0))))) |
739 |
|
|
740 |
(defun menu-bar-showhide-fringe-menu-customize-right () |
(defun menu-bar-showhide-fringe-menu-customize-right () |
741 |
"Make fringes appear only on the right." |
"Display fringes only on the right of each window." |
742 |
(interactive) |
(interactive) |
743 |
(require 'fringe) |
(require 'fringe) |
744 |
(customize-set-variable 'fringe-mode '(0 . nil))) |
(customize-set-variable 'fringe-mode '(0 . nil))) |
750 |
:button (:radio . (equal fringe-mode '(0 . nil))))) |
:button (:radio . (equal fringe-mode '(0 . nil))))) |
751 |
|
|
752 |
(defun menu-bar-showhide-fringe-menu-customize-disable () |
(defun menu-bar-showhide-fringe-menu-customize-disable () |
753 |
"Make fringes disappear." |
"Do not display window fringes." |
754 |
(interactive) |
(interactive) |
755 |
(require 'fringe) |
(require 'fringe) |
756 |
(customize-set-variable 'fringe-mode 0)) |
(customize-set-variable 'fringe-mode 0)) |
770 |
|
|
771 |
(define-key menu-bar-showhide-scroll-bar-menu [right] |
(define-key menu-bar-showhide-scroll-bar-menu [right] |
772 |
'(menu-item "On the Right" |
'(menu-item "On the Right" |
773 |
(lambda () |
menu-bar-right-scroll-bar |
|
(interactive) |
|
|
(customize-set-variable 'scroll-bar-mode 'right)) |
|
774 |
:help "Scroll-bar on the right side" |
:help "Scroll-bar on the right side" |
775 |
:visible (display-graphic-p) |
:visible (display-graphic-p) |
776 |
:button (:radio . (eq (cdr (assq 'vertical-scroll-bars |
:button (:radio . (eq (cdr (assq 'vertical-scroll-bars |
777 |
(frame-parameters))) 'right)))) |
(frame-parameters))) 'right)))) |
778 |
|
(defun menu-bar-right-scroll-bar () |
779 |
|
"Display scroll bars on the right of each window." |
780 |
|
(interactive) |
781 |
|
(customize-set-variable 'scroll-bar-mode 'right)) |
782 |
|
|
783 |
(define-key menu-bar-showhide-scroll-bar-menu [left] |
(define-key menu-bar-showhide-scroll-bar-menu [left] |
784 |
'(menu-item "On the Left" |
'(menu-item "On the Left" |
785 |
(lambda () |
menu-bar-left-scroll-bar |
|
(interactive) |
|
|
(customize-set-variable 'scroll-bar-mode 'left)) |
|
786 |
:help "Scroll-bar on the left side" |
:help "Scroll-bar on the left side" |
787 |
:visible (display-graphic-p) |
:visible (display-graphic-p) |
788 |
:button (:radio . (eq (cdr (assq 'vertical-scroll-bars |
:button (:radio . (eq (cdr (assq 'vertical-scroll-bars |
789 |
(frame-parameters))) 'left)))) |
(frame-parameters))) 'left)))) |
790 |
|
|
791 |
|
(defun menu-bar-left-scroll-bar () |
792 |
|
"Display scroll bars on the left of each window." |
793 |
|
(interactive) |
794 |
|
(customize-set-variable 'scroll-bar-mode 'left)) |
795 |
|
|
796 |
(define-key menu-bar-showhide-scroll-bar-menu [none] |
(define-key menu-bar-showhide-scroll-bar-menu [none] |
797 |
'(menu-item "None" |
'(menu-item "None" |
798 |
(lambda () |
menu-bar-no-scroll-bar |
|
(interactive) |
|
|
(customize-set-variable 'scroll-bar-mode nil)) |
|
799 |
:help "Turn off scroll-bar" |
:help "Turn off scroll-bar" |
800 |
:visible (display-graphic-p) |
:visible (display-graphic-p) |
801 |
:button (:radio . (eq (cdr (assq 'vertical-scroll-bars |
:button (:radio . (eq (cdr (assq 'vertical-scroll-bars |
802 |
(frame-parameters))) nil)))) |
(frame-parameters))) nil)))) |
803 |
|
|
804 |
|
(defun menu-bar-no-scroll-bar () |
805 |
|
"Turn off scroll bars." |
806 |
|
(interactive) |
807 |
|
(customize-set-variable 'scroll-bar-mode nil)) |
808 |
|
|
809 |
(define-key menu-bar-showhide-menu [showhide-scroll-bar] |
(define-key menu-bar-showhide-menu [showhide-scroll-bar] |
810 |
(list 'menu-item "Scroll-bar" menu-bar-showhide-scroll-bar-menu |
(list 'menu-item "Scroll-bar" menu-bar-showhide-scroll-bar-menu |
811 |
:visible `(display-graphic-p) |
:visible `(display-graphic-p) |
812 |
:help "Select scroll-bar mode")) |
:help "Select scroll-bar mode")) |
813 |
|
|
814 |
(defun showhide-menu-bar () |
(define-key menu-bar-showhide-menu [menu-bar-mode] |
815 |
"Toggle whether to turn menu-bar on/off." |
'(menu-item "Menu-bar" menu-bar-mode |
|
(interactive) |
|
|
(menu-bar-mode) |
|
|
(if menu-bar-mode |
|
|
(message "Menu-bar mode enabled.") |
|
|
(message "Menu-bar mode disabled. Use M-x menu-bar-mode to make the menu bar appear.")) |
|
|
(customize-mark-as-set 'menu-bar-mode)) |
|
|
|
|
|
(define-key menu-bar-showhide-menu [showhide-menu-bar] |
|
|
'(menu-item "Menu-bar" showhide-menu-bar |
|
816 |
:help "Toggle menu-bar on/off" |
:help "Toggle menu-bar on/off" |
817 |
:button (:toggle . menu-bar-mode))) |
:button (:toggle . menu-bar-mode))) |
818 |
|
|
|
(defun showhide-toolbar () |
|
|
"Toggle whether to turn tool-bar on/off." |
|
|
(interactive) |
|
|
(if (tool-bar-mode) |
|
|
(message "Tool-bar mode enabled.") |
|
|
(message "Tool-bar mode disabled.")) |
|
|
(customize-mark-as-set 'tool-bar-mode)) |
|
|
|
|
819 |
(define-key menu-bar-showhide-menu [showhide-tool-bar] |
(define-key menu-bar-showhide-menu [showhide-tool-bar] |
820 |
(list 'menu-item "Tool-bar" 'showhide-toolbar |
(list 'menu-item "Tool-bar" 'tool-bar-mode |
821 |
:help "Turn tool-bar on/off" |
:help "Turn tool-bar on/off" |
822 |
:visible `(display-graphic-p) |
:visible `(display-graphic-p) |
823 |
:button `(:toggle . tool-bar-mode))) |
:button `(:toggle . tool-bar-mode))) |
858 |
'("--")) |
'("--")) |
859 |
(define-key menu-bar-options-menu [toggle-auto-compression] |
(define-key menu-bar-options-menu [toggle-auto-compression] |
860 |
'(menu-item "Automatic File De/compression" |
'(menu-item "Automatic File De/compression" |
861 |
(lambda () |
auto-compression-mode |
|
(interactive) |
|
|
(auto-compression-mode) |
|
|
(customize-mark-as-set 'auto-compression-mode)) |
|
862 |
:help "Transparently decompress compressed files" |
:help "Transparently decompress compressed files" |
863 |
:button (:toggle . (rassq 'jka-compr-handler |
:button (:toggle . (rassq 'jka-compr-handler |
864 |
file-name-handler-alist)))) |
file-name-handler-alist)))) |
865 |
|
|
866 |
(define-key menu-bar-options-menu [save-place] |
(define-key menu-bar-options-menu [save-place] |
867 |
(menu-bar-make-toggle toggle-save-place-globally save-place |
(menu-bar-make-toggle toggle-save-place-globally save-place |
868 |
"Save Place in Files between Sessions" |
"Save Place in Files between Sessions" |
869 |
"Saving place in files %s" |
"Saving place in files %s" |
870 |
"Save Emacs state for next session")) |
"Visit files of previous session when restarting Emacs")) |
871 |
|
|
872 |
(define-key menu-bar-options-menu [uniquify] |
(define-key menu-bar-options-menu [uniquify] |
873 |
(menu-bar-make-toggle toggle-uniquify-buffer-names uniquify-buffer-name-style |
(menu-bar-make-toggle toggle-uniquify-buffer-names uniquify-buffer-name-style |
874 |
"Use Directory Names in Buffer Names" |
"Use Directory Names in Buffer Names" |
875 |
"Directory name in buffer names (uniquify) %s" |
"Directory name in buffer names (uniquify) %s" |
876 |
"Uniquify buffer names by adding parent directory names" |
"Uniquify buffer names by adding parent directory names" |
|
() ; no props |
|
877 |
(require 'uniquify) |
(require 'uniquify) |
878 |
(setq uniquify-buffer-name-style |
(setq uniquify-buffer-name-style |
879 |
(if (not uniquify-buffer-name-style) |
(if (not uniquify-buffer-name-style) |
883 |
'("--")) |
'("--")) |
884 |
(define-key menu-bar-options-menu [cua-mode] |
(define-key menu-bar-options-menu [cua-mode] |
885 |
'(menu-item "CUA-style cut and paste" |
'(menu-item "CUA-style cut and paste" |
886 |
(lambda () |
menu-bar-toggle-cua-mode |
|
(interactive) |
|
|
(cua-mode nil) |
|
|
(customize-mark-as-set 'cua-mode) |
|
|
(message "CUA-style cut and paste %s" |
|
|
(if cua-mode "enabled" "disabled"))) |
|
887 |
:help "Use C-z/C-x/C-c/C-v keys for undo/cut/copy/paste" |
:help "Use C-z/C-x/C-c/C-v keys for undo/cut/copy/paste" |
888 |
:button (:toggle . cua-mode))) |
:button (:toggle . cua-mode))) |
889 |
|
|
890 |
|
(defun menu-bar-toggle-cua-mode () |
891 |
|
"Toggle CUA key-binding mode. |
892 |
|
When enabled, using shifted movement keys will activate the region (and |
893 |
|
highlight the region using `transient-mark-mode'), and typed text replaces |
894 |
|
the active selection. C-z, C-x, C-c, and C-v will undo, cut, copy, and |
895 |
|
paste (in addition to the normal Emacs bindings)." |
896 |
|
(interactive) |
897 |
|
(cua-mode nil) |
898 |
|
(customize-mark-as-set 'cua-mode) |
899 |
|
(message "CUA-style cut and paste %s" |
900 |
|
(if cua-mode "enabled" "disabled"))) |
901 |
|
|
902 |
(define-key menu-bar-options-menu [case-fold-search] |
(define-key menu-bar-options-menu [case-fold-search] |
903 |
(menu-bar-make-toggle toggle-case-fold-search case-fold-search |
(menu-bar-make-toggle toggle-case-fold-search case-fold-search |
904 |
"Case-Insensitive Search" |
"Case-Insensitive Search" |
905 |
"Case-Insensitive Search %s" |
"Case-Insensitive Search %s" |
906 |
"Ignore letter-case in search")) |
"Ignore letter-case in search")) |
907 |
|
|
908 |
|
(defun menu-bar-text-mode-auto-fill () |
909 |
|
(interactive) |
910 |
|
(toggle-text-mode-auto-fill) |
911 |
|
;; This is somewhat questionable, as `text-mode-hook' |
912 |
|
;; might have changed outside customize. |
913 |
|
;; -- Per Abrahamsen <abraham@dina.kvl.dk> 2002-02-11. |
914 |
|
(customize-mark-as-set 'text-mode-hook)) |
915 |
|
|
916 |
(define-key menu-bar-options-menu [auto-fill-mode] |
(define-key menu-bar-options-menu [auto-fill-mode] |
917 |
'(menu-item "Word Wrap in Text Modes (Auto Fill)" |
'(menu-item "Word Wrap in Text Modes" |
918 |
(lambda () |
menu-bar-text-mode-auto-fill |
919 |
(interactive) |
:help "Automatically fill text between left and right margins (Auto Fill)" |
|
(toggle-text-mode-auto-fill) |
|
|
;; This is somewhat questionable, as `text-mode-hook' |
|
|
;; might have changed outside customize. |
|
|
;; -- Per Abrahamsen <abraham@dina.kvl.dk> 2002-02-11. |
|
|
(customize-mark-as-set 'text-mode-hook)) |
|
|
:help "Automatically fill text between left and right margins" |
|
920 |
:button (:toggle . (if (listp text-mode-hook) |
:button (:toggle . (if (listp text-mode-hook) |
921 |
(member 'turn-on-auto-fill text-mode-hook) |
(member 'turn-on-auto-fill text-mode-hook) |
922 |
(eq 'turn-on-auto-fill text-mode-hook))))) |
(eq 'turn-on-auto-fill text-mode-hook))))) |
923 |
(define-key menu-bar-options-menu [truncate-lines] |
(define-key menu-bar-options-menu [truncate-lines] |
924 |
'(menu-item "Truncate Long Lines in this Buffer" |
'(menu-item "Truncate Long Lines in this Buffer" |
925 |
(lambda () |
toggle-truncate-lines |
|
(interactive) |
|
|
(setq truncate-lines (not truncate-lines)) |
|
|
(set-buffer-modified-p (buffer-modified-p)) |
|
|
(message "Truncate long lines %s" |
|
|
(if truncate-lines "enabled" "disabled"))) |
|
926 |
:help "Truncate long lines on the screen" |
:help "Truncate long lines on the screen" |
927 |
:button (:toggle . truncate-lines))) |
:button (:toggle . truncate-lines))) |
928 |
|
|
929 |
(define-key menu-bar-options-menu [highlight-separator] |
(define-key menu-bar-options-menu [highlight-separator] |
930 |
'("--")) |
'("--")) |
931 |
(define-key menu-bar-options-menu [highlight-paren-mode] |
(define-key menu-bar-options-menu [highlight-paren-mode] |
932 |
(menu-bar-make-toggle toggle-highlight-paren-mode show-paren-mode |
(menu-bar-make-mm-toggle show-paren-mode |
933 |
"Paren Match Highlighting (Show Paren mode)" |
"Paren Match Highlighting" |
934 |
"Show Paren mode %s" |
"Highlight matching/mismatched parentheses at cursor (Show Paren mode)")) |
|
"Highlight matching/mismatched parentheses at cursor")) |
|
935 |
(define-key menu-bar-options-menu [transient-mark-mode] |
(define-key menu-bar-options-menu [transient-mark-mode] |
936 |
(menu-bar-make-toggle toggle-transient-mark-mode transient-mark-mode |
(menu-bar-make-mm-toggle transient-mark-mode |
937 |
"Active Region Highlighting (Transient Mark mode)" |
"Active Region Highlighting" |
938 |
"Transient Mark mode %s" |
"Make text in active region stand out in color (Transient Mark mode)" |
939 |
"Make text in active region stand out in color" |
(:enable (not cua-mode)))) |
|
(:enable (not cua-mode)))) |
|
940 |
(define-key menu-bar-options-menu [toggle-global-lazy-font-lock-mode] |
(define-key menu-bar-options-menu [toggle-global-lazy-font-lock-mode] |
941 |
(menu-bar-make-toggle toggle-global-lazy-font-lock-mode global-font-lock-mode |
(menu-bar-make-mm-toggle global-font-lock-mode |
942 |
"Syntax Highlighting (Global Font Lock mode)" |
"Syntax Highlighting" |
943 |
"Global Font Lock mode %s" |
"Colorize text based on language syntax (Global Font Lock mode)")) |
|
"Colorize text based on language syntax")) |
|
944 |
|
|
945 |
|
|
946 |
;; The "Tools" menu items |
;; The "Tools" menu items |
1032 |
(define-key menu-bar-tools-menu [rmail] |
(define-key menu-bar-tools-menu [rmail] |
1033 |
(list |
(list |
1034 |
'menu-item `(format "Read Mail (with %s)" (read-mail-item-name)) |
'menu-item `(format "Read Mail (with %s)" (read-mail-item-name)) |
1035 |
(lambda () |
'menu-bar-read-mail |
|
(interactive) |
|
|
(call-interactively read-mail-command)) |
|
1036 |
:visible `(and read-mail-command (not (eq read-mail-command 'ignore))) |
:visible `(and read-mail-command (not (eq read-mail-command 'ignore))) |
1037 |
:help "Read your mail and reply to it")) |
:help "Read your mail and reply to it")) |
1038 |
|
|
1039 |
|
(defun menu-bar-read-mail () |
1040 |
|
"Read mail using `read-mail-command'." |
1041 |
|
(interactive) |
1042 |
|
(call-interactively read-mail-command)) |
1043 |
|
|
1044 |
(define-key menu-bar-tools-menu [gnus] |
(define-key menu-bar-tools-menu [gnus] |
1045 |
'(menu-item "Read Net News (Gnus)" gnus |
'(menu-item "Read Net News (Gnus)" gnus |
1046 |
:help "Read network news groups")) |
:help "Read network news groups")) |
1141 |
(define-key menu-bar-describe-menu [describe-function] |
(define-key menu-bar-describe-menu [describe-function] |
1142 |
'(menu-item "Describe Function..." describe-function |
'(menu-item "Describe Function..." describe-function |
1143 |
:help "Display documentation of function/command")) |
:help "Display documentation of function/command")) |
1144 |
(define-key menu-bar-describe-menu [describe-key] |
(define-key menu-bar-describe-menu [describe-key-1] |
1145 |
'(menu-item "Describe Key..." describe-key |
'(menu-item "Describe Key..." describe-key |
1146 |
;; Users typically don't identify keys and menu items... |
;; Users typically don't identify keys and menu items... |
1147 |
:help "Display documentation of command bound to a \ |
:help "Display documentation of command bound to a \ |
1148 |
key (or menu-item)")) |
key (or menu-item)")) |
1149 |
|
(define-key menu-bar-describe-menu [describe-key] |
1150 |
|
'(menu-item "What's This? " describe-key |
1151 |
|
;; Users typically don't identify keys and menu items... |
1152 |
|
:help "Display documentation of command bound to a \ |
1153 |
|
key (or menu-item)")) |
1154 |
(define-key menu-bar-describe-menu [describe-mode] |
(define-key menu-bar-describe-menu [describe-mode] |
1155 |
'(menu-item "Describe Buffer Modes" describe-mode |
'(menu-item "Describe Buffer Modes" describe-mode |
1156 |
:help "Describe this buffer's major and minor mode")) |
:help "Describe this buffer's major and minor mode")) |
1166 |
(interactive) |
(interactive) |
1167 |
(info "eintr")) |
(info "eintr")) |
1168 |
|
|
|
(defun menu-bar-read-emacs-man () |
|
|
"Display Emacs User Manual in Info mode." |
|
|
(interactive) |
|
|
(info "emacs")) |
|
|
|
|
1169 |
(defun search-emacs-glossary () |
(defun search-emacs-glossary () |
1170 |
"Display the Glossary node of the Emacs manual in Info mode." |
"Display the Glossary node of the Emacs manual in Info mode." |
1171 |
(interactive) |
(interactive) |
1255 |
:help "How to get latest versions of Emacs")) |
:help "How to get latest versions of Emacs")) |
1256 |
(define-key menu-bar-help-menu [more] |
(define-key menu-bar-help-menu [more] |
1257 |
'(menu-item "Find Extra Packages" |
'(menu-item "Find Extra Packages" |
1258 |
(lambda () |
menu-bar-help-extra-packages |
|
(interactive) |
|
|
(let (enable-local-variables) |
|
|
(view-file (expand-file-name "MORE.STUFF" |
|
|
data-directory)) |
|
|
(goto-address))) |
|
1259 |
:help "Where to find some extra packages and possible updates")) |
:help "Where to find some extra packages and possible updates")) |
1260 |
|
(defun menu-bar-help-extra-packages () |
1261 |
|
"Display help about some additional packages available for Emacs." |
1262 |
|
(interactive) |
1263 |
|
(let (enable-local-variables) |
1264 |
|
(view-file (expand-file-name "MORE.STUFF" |
1265 |
|
data-directory)) |
1266 |
|
(goto-address))) |
1267 |
(define-key menu-bar-help-menu [about] |
(define-key menu-bar-help-menu [about] |
1268 |
'(menu-item "About Emacs" display-splash-screen |
'(menu-item "About Emacs" display-splash-screen |
1269 |
:help "Display version number, copyright info, and basic help")) |
:help "Display version number, copyright info, and basic help")) |
1276 |
(list 'menu-item "More Manuals" menu-bar-manuals-menu |
(list 'menu-item "More Manuals" menu-bar-manuals-menu |
1277 |
:help "Search and browse on-line manuals")) |
:help "Search and browse on-line manuals")) |
1278 |
(define-key menu-bar-help-menu [emacs-manual] |
(define-key menu-bar-help-menu [emacs-manual] |
1279 |
'(menu-item "Read the Emacs Manual" menu-bar-read-emacs-man |
'(menu-item "Read the Emacs Manual" info-emacs-manual |
1280 |
:help "Full documentation of Emacs features")) |
:help "Full documentation of Emacs features")) |
1281 |
(define-key menu-bar-help-menu [describe] |
(define-key menu-bar-help-menu [describe] |
1282 |
(list 'menu-item "Describe" menu-bar-describe-menu |
(list 'menu-item "Describe" menu-bar-describe-menu |
1296 |
:help "New features of this version")) |
:help "New features of this version")) |
1297 |
(define-key menu-bar-help-menu [emacs-faq] |
(define-key menu-bar-help-menu [emacs-faq] |
1298 |
'(menu-item "Emacs FAQ" view-emacs-FAQ)) |
'(menu-item "Emacs FAQ" view-emacs-FAQ)) |
1299 |
|
|
1300 |
|
(defun help-with-tutorial-spec-language () |
1301 |
|
"Use the Emacs tutorial, specifying which language you want." |
1302 |
|
(interactive) |
1303 |
|
(help-with-tutorial t)) |
1304 |
|
|
1305 |
(define-key menu-bar-help-menu [emacs-tutorial-language-specific] |
(define-key menu-bar-help-menu [emacs-tutorial-language-specific] |
1306 |
'(menu-item "Emacs Tutorial (choose language)..." |
'(menu-item "Emacs Tutorial (choose language)..." |
1307 |
(lambda () (interactive) (help-with-tutorial t)) |
help-with-tutorial-spec-language |
1308 |
:help "Learn how to use Emacs (choose a language)")) |
:help "Learn how to use Emacs (choose a language)")) |
1309 |
(define-key menu-bar-help-menu [emacs-tutorial] |
(define-key menu-bar-help-menu [emacs-tutorial] |
1310 |
'(menu-item "Emacs Tutorial" help-with-tutorial |
'(menu-item "Emacs Tutorial" help-with-tutorial |
1567 |
(menu-bar-update-buffers) |
(menu-bar-update-buffers) |
1568 |
|
|
1569 |
;; this version is too slow |
;; this version is too slow |
1570 |
;;;(defun format-buffers-menu-line (buffer) |
;;(defun format-buffers-menu-line (buffer) |
1571 |
;;; "Returns a string to represent the given buffer in the Buffer menu. |
;; "Returns a string to represent the given buffer in the Buffer menu. |
1572 |
;;;nil means the buffer shouldn't be listed. You can redefine this." |
;;nil means the buffer shouldn't be listed. You can redefine this." |
1573 |
;;; (if (string-match "\\` " (buffer-name buffer)) |
;; (if (string-match "\\` " (buffer-name buffer)) |
1574 |
;;; nil |
;; nil |
1575 |
;;; (save-excursion |
;; (save-excursion |
1576 |
;;; (set-buffer buffer) |
;; (set-buffer buffer) |
1577 |
;;; (let ((size (buffer-size))) |
;; (let ((size (buffer-size))) |
1578 |
;;; (format "%s%s %-19s %6s %-15s %s" |
;; (format "%s%s %-19s %6s %-15s %s" |
1579 |
;;; (if (buffer-modified-p) "*" " ") |
;; (if (buffer-modified-p) "*" " ") |
1580 |
;;; (if buffer-read-only "%" " ") |
;; (if buffer-read-only "%" " ") |
1581 |
;;; (buffer-name) |
;; (buffer-name) |
1582 |
;;; size |
;; size |
1583 |
;;; mode-name |
;; mode-name |
1584 |
;;; (or (buffer-file-name) "")))))) |
;; (or (buffer-file-name) "")))))) |
1585 |
|
|
1586 |
;;; Set up a menu bar menu for the minibuffer. |
;;; Set up a menu bar menu for the minibuffer. |
1587 |
|
|
1611 |
(list 'menu-item "Enter" 'exit-minibuffer |
(list 'menu-item "Enter" 'exit-minibuffer |
1612 |
:help "Terminate input and exit minibuffer"))) |
:help "Terminate input and exit minibuffer"))) |
1613 |
|
|
1614 |
(defcustom menu-bar-mode t |
;;;###autoload |
1615 |
"Toggle display of a menu bar on each frame. |
;; This comment is taken from toolbar/tool-bar.el near |
1616 |
Setting this variable directly does not take effect; |
;; (put 'tool-bar-mode ...) |
1617 |
use either \\[customize] or the function `menu-bar-mode'." |
;; We want to pretend the menu bar by standard is on, as this will make |
1618 |
:set (lambda (symbol value) |
;; customize consider disabling the menu bar a customization, and save |
1619 |
(menu-bar-mode (or value 0))) |
;; that. We could do this for real by setting :init-value below, but |
1620 |
:initialize 'custom-initialize-default |
;; that would overwrite disabling the tool bar from X resources. |
1621 |
:type 'boolean |
(put 'menu-bar-mode 'standard-value '(t)) |
|
:group 'frames) |
|
1622 |
|
|
1623 |
(defun menu-bar-mode (&optional flag) |
;;;###autoload |
1624 |
|
(define-minor-mode menu-bar-mode |
1625 |
"Toggle display of a menu bar on each frame. |
"Toggle display of a menu bar on each frame. |
1626 |
This command applies to all frames that exist and frames to be |
This command applies to all frames that exist and frames to be |
1627 |
created in the future. |
created in the future. |
1628 |
With a numeric argument, if the argument is positive, |
With a numeric argument, if the argument is positive, |
1629 |
turn on menu bars; otherwise, turn off menu bars." |
turn on menu bars; otherwise, turn off menu bars." |
1630 |
(interactive "P") |
:init-value nil |
1631 |
|
:global t |
1632 |
|
:group 'frames |
1633 |
;; Make menu-bar-mode and default-frame-alist consistent. |
;; Make menu-bar-mode and default-frame-alist consistent. |
1634 |
(let ((default (assq 'menu-bar-lines default-frame-alist))) |
(let ((lines (if menu-bar-mode 1 0))) |
1635 |
(if default |
;; Alter existing frames... |
1636 |
(setq menu-bar-mode (not (eq (cdr default) 0))) |
(mapc (lambda (frame) |
1637 |
(setq default-frame-alist |
(modify-frame-parameters frame |
1638 |
(cons (cons 'menu-bar-lines (if menu-bar-mode 1 0)) |
(list (cons 'menu-bar-lines lines)))) |
1639 |
default-frame-alist)))) |
(frame-list)) |
1640 |
|
;; ...and future ones. |
1641 |
;; Toggle or set the mode, according to FLAG. |
(let ((elt (assq 'menu-bar-lines default-frame-alist))) |
1642 |
(setq menu-bar-mode (if (null flag) (not menu-bar-mode) |
(if elt |
1643 |
(> (prefix-numeric-value flag) 0))) |
(setcdr elt lines) |
1644 |
|
(add-to-list 'default-frame-alist (cons 'menu-bar-lines lines))))) |
1645 |
;; Apply it to default-frame-alist. |
|
1646 |
(let ((parameter (assq 'menu-bar-lines default-frame-alist))) |
;; Make the message appear when Emacs is idle. We can not call message |
1647 |
(if (consp parameter) |
;; directly. The minor-mode message "Menu-bar mode disabled" comes |
1648 |
(setcdr parameter (if menu-bar-mode 1 0)) |
;; after this function returns, overwriting any message we do here. |
1649 |
(setq default-frame-alist |
(when (and (interactive-p) (not menu-bar-mode)) |
1650 |
(cons (cons 'menu-bar-lines (if menu-bar-mode 1 0)) |
(run-with-idle-timer 0 nil 'message |
1651 |
default-frame-alist)))) |
"Menu-bar mode disabled. Use M-x menu-bar-mode to make the menu bar appear.")) |
1652 |
|
menu-bar-mode) |
|
;; Apply it to existing frames. |
|
|
(let ((frames (frame-list))) |
|
|
(while frames |
|
|
(let ((height (cdr (assq 'height (frame-parameters (car frames)))))) |
|
|
(modify-frame-parameters (car frames) |
|
|
(list (cons 'menu-bar-lines |
|
|
(if menu-bar-mode 1 0)))) |
|
|
(modify-frame-parameters (car frames) |
|
|
(list (cons 'height height)))) |
|
|
(setq frames (cdr frames))))) |
|
1653 |
|
|
1654 |
(provide 'menu-bar) |
(provide 'menu-bar) |
1655 |
|
|