* disable menu-items when frame invisible / inapplicable
@ 2005-08-18 21:48 David Reitter
0 siblings, 0 replies; only message in thread
From: David Reitter @ 2005-08-18 21:48 UTC (permalink / raw)
Can I suggest to disable menu items when the frame they refer to is
invisible, or when they refer to a buffer and the minibuffer is
selected?
Note that the menu bar doesn't always have to be inside the frame -
some systems / window manager configurations allow you to have the
menu bar on top of the screen or wherever.
*** menu-bar.el 11 Aug 2005 20:57:36 -0000 1.268
--- menu-bar.el 18 Aug 2005 21:43:51 -0000
***************
*** 105,110 ****
--- 105,114 ----
(define-key menu-bar-file-menu [split-window]
'(menu-item "Split Window" split-window-vertically
+ :enable (and (frame-live-p menu-updating-frame)
+ (frame-visible-p menu-updating-frame )
+ (not (window-minibuffer-p
+ (frame-selected-window menu-updating-
frame))))
:help "Split selected window in two windows"))
(define-key menu-bar-file-menu [separator-window]
***************
*** 116,121 ****
--- 120,127 ----
:help "Pretty-print marked region in black and white
to PostScript printer"))
(define-key menu-bar-file-menu [ps-print-buffer]
'(menu-item "Postscript Print Buffer (B+W)" ps-print-buffer
+ :enable (and (frame-live-p menu-updating-frame)
+ (frame-visible-p menu-updating-frame ))
:help "Pretty-print current buffer in black and white
to PostScript printer"))
(define-key menu-bar-file-menu [ps-print-region-faces]
'(menu-item "Postscript Print Region" ps-print-region-with-faces
***************
*** 123,128 ****
--- 129,136 ----
:help "Pretty-print marked region to PostScript
printer"))
(define-key menu-bar-file-menu [ps-print-buffer-faces]
'(menu-item "Postscript Print Buffer" ps-print-buffer-with-faces
+ :enable (and (frame-live-p menu-updating-frame)
+ (frame-visible-p menu-updating-frame ))
:help "Pretty-print current buffer to PostScript
printer"))
(define-key menu-bar-file-menu [print-region]
'(menu-item "Print Region" print-region
***************
*** 130,135 ****
--- 138,145 ----
:help "Print region between mark and current position"))
(define-key menu-bar-file-menu [print-buffer]
'(menu-item "Print Buffer" print-buffer
+ :enable (and (frame-live-p menu-updating-frame)
+ (frame-visible-p menu-updating-frame ))
:help "Print current buffer with page headings"))
(define-key menu-bar-file-menu [separator-print]
***************
*** 160,167 ****
:help "Re-read current buffer from its file"))
(define-key menu-bar-file-menu [write-file]
'(menu-item "Save As..." write-file
! :enable (not (window-minibuffer-p
! (frame-selected-window menu-updating-
frame)))
:help "Write current buffer to another file"))
(define-key menu-bar-file-menu [save-buffer]
'(menu-item "Save" save-buffer
--- 170,180 ----
:help "Re-read current buffer from its file"))
(define-key menu-bar-file-menu [write-file]
'(menu-item "Save As..." write-file
!
! :enable (and (frame-live-p menu-updating-frame)
! (frame-visible-p menu-updating-frame )
! (not (window-minibuffer-p
! (frame-selected-window menu-updating-
frame))))
:help "Write current buffer to another file"))
(define-key menu-bar-file-menu [save-buffer]
'(menu-item "Save" save-buffer
***************
*** 1037,1043 ****
'(menu-item "Truncate Long Lines in this Buffer"
toggle-truncate-lines
:help "Truncate long lines on the screen"
! :button (:toggle . truncate-lines)))
(define-key menu-bar-options-menu [highlight-separator]
'("--"))
--- 1050,1058 ----
'(menu-item "Truncate Long Lines in this Buffer"
toggle-truncate-lines
:help "Truncate long lines on the screen"
! :button (:toggle . truncate-lines)
! :enable (and (frame-live-p menu-updating-frame)
! (frame-visible-p menu-updating-frame ))))
(define-key menu-bar-options-menu [highlight-separator]
'("--"))
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-08-18 21:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-18 21:48 disable menu-items when frame invisible / inapplicable David Reitter
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).