* menu-bar: disable items when no frame visible
@ 2005-11-10 15:57 David Reitter
2005-11-10 16:03 ` David Reitter
` (2 more replies)
0 siblings, 3 replies; 71+ messages in thread
From: David Reitter @ 2005-11-10 15:57 UTC (permalink / raw)
[-- Attachment #1.1.1: Type: text/plain, Size: 277 bytes --]
This patch ensures that menu items are disabled when they should be,
i.e. when there is no applicable visible and non-iconified frame.
In a lot of cases, one could do "insert file" or choose stuff from
the "search" menu even if there were only iconified or hidden frames.
[-- Attachment #1.1.2: menu-bar-visible-frame.patch --]
[-- Type: application/octet-stream, Size: 8113 bytes --]
Index: menu-bar.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/menu-bar.el,v
retrieving revision 1.278
diff -c -r1.278 menu-bar.el
*** menu-bar.el 1 Nov 2005 23:21:39 -0000 1.278
--- menu-bar.el 10 Nov 2005 15:50:18 -0000
***************
*** 172,177 ****
--- 172,178 ----
'(menu-item "Save" save-buffer
:enable (and (buffer-modified-p)
(buffer-file-name)
+ (menu-bar-menu-frame-live-and-visible-p)
(menu-bar-non-minibuffer-window-p))
:help "Save current buffer to its file"))
***************
*** 184,190 ****
:help "Discard (kill) current buffer"))
(define-key menu-bar-file-menu [insert-file]
'(menu-item "Insert File..." insert-file
! :enable (menu-bar-non-minibuffer-window-p)
:help "Insert another file into current buffer"))
(define-key menu-bar-file-menu [dired]
'(menu-item "Open Directory..." dired
--- 185,192 ----
:help "Discard (kill) current buffer"))
(define-key menu-bar-file-menu [insert-file]
'(menu-item "Insert File..." insert-file
! :enable (and (menu-bar-non-minibuffer-window-p)
! (menu-bar-menu-frame-live-and-visible-p))
:help "Insert another file into current buffer"))
(define-key menu-bar-file-menu [dired]
'(menu-item "Open Directory..." dired
***************
*** 192,202 ****
:help "Read a directory, to operate on its files"))
(define-key menu-bar-file-menu [open-file]
'(menu-item "Open File..." find-file-existing
! :enable (menu-bar-non-minibuffer-window-p)
:help "Read an existing file into an Emacs buffer"))
(define-key menu-bar-file-menu [new-file]
'(menu-item "Visit New File..." find-file
! :enable (menu-bar-non-minibuffer-window-p)
:help "Specify a new file's name, to edit the file"))
\f
--- 194,206 ----
:help "Read a directory, to operate on its files"))
(define-key menu-bar-file-menu [open-file]
'(menu-item "Open File..." find-file-existing
! :enable (or enable-recursive-minibuffers
! (menu-bar-non-minibuffer-window-p))
:help "Read an existing file into an Emacs buffer"))
(define-key menu-bar-file-menu [new-file]
'(menu-item "Visit New File..." find-file
! :enable (or enable-recursive-minibuffers
! (menu-bar-non-minibuffer-window-p))
:help "Specify a new file's name, to edit the file"))
\f
***************
*** 359,364 ****
--- 363,369 ----
;;; Assemble the top-level Edit menu items.
(define-key menu-bar-edit-menu [props]
'(menu-item "Text Properties" facemenu-menu
+ :enable (menu-bar-menu-frame-live-and-visible-p)
:help "Change properties of text in region"))
(define-key menu-bar-edit-menu [fill]
***************
*** 371,377 ****
'(menu-item "--"))
(define-key menu-bar-edit-menu [bookmark]
! '(menu-item "Bookmarks" menu-bar-bookmark-map
:help "Record positions and jump between them"))
(defvar menu-bar-goto-menu (make-sparse-keymap "Go To"))
--- 376,382 ----
'(menu-item "--"))
(define-key menu-bar-edit-menu [bookmark]
! `(menu-item "Bookmarks" ,menu-bar-bookmark-map
:help "Record positions and jump between them"))
(defvar menu-bar-goto-menu (make-sparse-keymap "Go To"))
***************
*** 431,450 ****
:help "Read a line number and go to that line"))
(define-key menu-bar-edit-menu [goto]
! (list 'menu-item "Go To" menu-bar-goto-menu))
(define-key menu-bar-edit-menu [replace]
! (list 'menu-item "Replace" menu-bar-replace-menu))
(define-key menu-bar-edit-menu [search]
! (list 'menu-item "Search" menu-bar-search-menu))
(define-key menu-bar-edit-menu [separator-search]
'(menu-item "--"))
(define-key menu-bar-edit-menu [mark-whole-buffer]
'(menu-item "Select All" mark-whole-buffer
:help "Mark the whole buffer for a subsequent cut/copy."))
(define-key menu-bar-edit-menu [clear]
'(menu-item "Clear" delete-region
:enable (and mark-active
--- 436,459 ----
:help "Read a line number and go to that line"))
(define-key menu-bar-edit-menu [goto]
! `(menu-item "Go To" ,menu-bar-goto-menu
! :enable (menu-bar-menu-frame-live-and-visible-p)))
(define-key menu-bar-edit-menu [replace]
! `(menu-item "Replace" ,menu-bar-replace-menu
! :enable (menu-bar-menu-frame-live-and-visible-p)))
(define-key menu-bar-edit-menu [search]
! `(menu-item "Search" ,menu-bar-search-menu
! :enable (menu-bar-menu-frame-live-and-visible-p)))
(define-key menu-bar-edit-menu [separator-search]
'(menu-item "--"))
(define-key menu-bar-edit-menu [mark-whole-buffer]
'(menu-item "Select All" mark-whole-buffer
+ :enable (menu-bar-menu-frame-live-and-visible-p)
:help "Mark the whole buffer for a subsequent cut/copy."))
(define-key menu-bar-edit-menu [clear]
'(menu-item "Clear" delete-region
:enable (and mark-active
***************
*** 456,462 ****
(fset 'yank-menu (cons 'keymap yank-menu))
(define-key menu-bar-edit-menu [select-paste]
'(menu-item "Select and Paste" yank-menu
! :enable (and (cdr yank-menu) (not buffer-read-only))
:help "Paste (yank) text cut or copied earlier"))
(define-key menu-bar-edit-menu [paste]
'(menu-item "Paste" yank
--- 466,474 ----
(fset 'yank-menu (cons 'keymap yank-menu))
(define-key menu-bar-edit-menu [select-paste]
'(menu-item "Select and Paste" yank-menu
! :enable (and (cdr yank-menu)
! (not buffer-read-only)
! (menu-bar-menu-frame-live-and-visible-p))
:help "Paste (yank) text cut or copied earlier"))
(define-key menu-bar-edit-menu [paste]
'(menu-item "Paste" yank
***************
*** 464,470 ****
;; Emacs compiled --without-x doesn't have
;; x-selection-exists-p.
(fboundp 'x-selection-exists-p)
! (x-selection-exists-p) (not buffer-read-only))
:help "Paste (yank) text most recently cut/copied"))
(define-key menu-bar-edit-menu [copy]
'(menu-item "Copy" menu-bar-kill-ring-save
--- 476,483 ----
;; Emacs compiled --without-x doesn't have
;; x-selection-exists-p.
(fboundp 'x-selection-exists-p)
! (x-selection-exists-p) (not buffer-read-only)
! (menu-bar-menu-frame-live-and-visible-p))
:help "Paste (yank) text most recently cut/copied"))
(define-key menu-bar-edit-menu [copy]
'(menu-item "Copy" menu-bar-kill-ring-save
***************
*** 479,484 ****
--- 492,498 ----
(define-key menu-bar-edit-menu [undo]
'(menu-item "Undo" undo
:enable (and (not buffer-read-only)
+ (menu-bar-menu-frame-live-and-visible-p)
(not (eq t buffer-undo-list))
(if (eq last-command 'undo)
pending-undo-list
***************
*** 1427,1433 ****
(let ((menu-frame (if (display-multi-frame-p) menu-updating-frame
(selected-frame))))
(and (frame-live-p menu-frame)
! (frame-visible-p menu-frame))))
(defun menu-bar-non-minibuffer-window-p ()
"Return non-nil if selected window of the menu frame is not a minibuf window.
--- 1433,1441 ----
(let ((menu-frame (if (display-multi-frame-p) menu-updating-frame
(selected-frame))))
(and (frame-live-p menu-frame)
! (frame-visible-p menu-frame)
! (not (frame-iconified-p (selected-frame))))))
!
(defun menu-bar-non-minibuffer-window-p ()
"Return non-nil if selected window of the menu frame is not a minibuf window.
***************
*** 1451,1456 ****
--- 1459,1465 ----
(setq count (1+ count)))
(setq buffers (cdr buffers)))
(and (menu-bar-non-minibuffer-window-p)
+ (menu-bar-menu-frame-live-and-visible-p)
(> count 1))))
(put 'dired 'menu-enable '(menu-bar-non-minibuffer-window-p))
[-- Attachment #1.2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 2400 bytes --]
[-- Attachment #2: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-11-10 15:57 menu-bar: disable items when no frame visible David Reitter
@ 2005-11-10 16:03 ` David Reitter
2005-11-10 21:12 ` David Reitter
2005-11-10 19:34 ` Eli Zaretskii
2005-11-28 20:23 ` Juri Linkov
2 siblings, 1 reply; 71+ messages in thread
From: David Reitter @ 2005-11-10 16:03 UTC (permalink / raw)
[-- Attachment #1.1.1: Type: text/plain, Size: 107 bytes --]
I'm sorry, the patch I sent needed a function that I assumed was
built-in.
Here is the corrected patch.
[-- Attachment #1.1.2: menu-bar-visible-frame.patch --]
[-- Type: application/octet-stream, Size: 8013 bytes --]
Index: menu-bar.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/menu-bar.el,v
retrieving revision 1.278
diff -c -r1.278 menu-bar.el
*** menu-bar.el 1 Nov 2005 23:21:39 -0000 1.278
--- menu-bar.el 10 Nov 2005 16:02:35 -0000
***************
*** 172,177 ****
--- 172,178 ----
'(menu-item "Save" save-buffer
:enable (and (buffer-modified-p)
(buffer-file-name)
+ (menu-bar-menu-frame-live-and-visible-p)
(menu-bar-non-minibuffer-window-p))
:help "Save current buffer to its file"))
***************
*** 184,190 ****
:help "Discard (kill) current buffer"))
(define-key menu-bar-file-menu [insert-file]
'(menu-item "Insert File..." insert-file
! :enable (menu-bar-non-minibuffer-window-p)
:help "Insert another file into current buffer"))
(define-key menu-bar-file-menu [dired]
'(menu-item "Open Directory..." dired
--- 185,192 ----
:help "Discard (kill) current buffer"))
(define-key menu-bar-file-menu [insert-file]
'(menu-item "Insert File..." insert-file
! :enable (and (menu-bar-non-minibuffer-window-p)
! (menu-bar-menu-frame-live-and-visible-p))
:help "Insert another file into current buffer"))
(define-key menu-bar-file-menu [dired]
'(menu-item "Open Directory..." dired
***************
*** 192,202 ****
:help "Read a directory, to operate on its files"))
(define-key menu-bar-file-menu [open-file]
'(menu-item "Open File..." find-file-existing
! :enable (menu-bar-non-minibuffer-window-p)
:help "Read an existing file into an Emacs buffer"))
(define-key menu-bar-file-menu [new-file]
'(menu-item "Visit New File..." find-file
! :enable (menu-bar-non-minibuffer-window-p)
:help "Specify a new file's name, to edit the file"))
\f
--- 194,206 ----
:help "Read a directory, to operate on its files"))
(define-key menu-bar-file-menu [open-file]
'(menu-item "Open File..." find-file-existing
! :enable (or enable-recursive-minibuffers
! (menu-bar-non-minibuffer-window-p))
:help "Read an existing file into an Emacs buffer"))
(define-key menu-bar-file-menu [new-file]
'(menu-item "Visit New File..." find-file
! :enable (or enable-recursive-minibuffers
! (menu-bar-non-minibuffer-window-p))
:help "Specify a new file's name, to edit the file"))
\f
***************
*** 359,364 ****
--- 363,369 ----
;;; Assemble the top-level Edit menu items.
(define-key menu-bar-edit-menu [props]
'(menu-item "Text Properties" facemenu-menu
+ :enable (menu-bar-menu-frame-live-and-visible-p)
:help "Change properties of text in region"))
(define-key menu-bar-edit-menu [fill]
***************
*** 371,377 ****
'(menu-item "--"))
(define-key menu-bar-edit-menu [bookmark]
! '(menu-item "Bookmarks" menu-bar-bookmark-map
:help "Record positions and jump between them"))
(defvar menu-bar-goto-menu (make-sparse-keymap "Go To"))
--- 376,382 ----
'(menu-item "--"))
(define-key menu-bar-edit-menu [bookmark]
! `(menu-item "Bookmarks" ,menu-bar-bookmark-map
:help "Record positions and jump between them"))
(defvar menu-bar-goto-menu (make-sparse-keymap "Go To"))
***************
*** 431,449 ****
:help "Read a line number and go to that line"))
(define-key menu-bar-edit-menu [goto]
! (list 'menu-item "Go To" menu-bar-goto-menu))
(define-key menu-bar-edit-menu [replace]
! (list 'menu-item "Replace" menu-bar-replace-menu))
(define-key menu-bar-edit-menu [search]
! (list 'menu-item "Search" menu-bar-search-menu))
(define-key menu-bar-edit-menu [separator-search]
'(menu-item "--"))
(define-key menu-bar-edit-menu [mark-whole-buffer]
'(menu-item "Select All" mark-whole-buffer
:help "Mark the whole buffer for a subsequent cut/copy."))
(define-key menu-bar-edit-menu [clear]
'(menu-item "Clear" delete-region
--- 436,458 ----
:help "Read a line number and go to that line"))
(define-key menu-bar-edit-menu [goto]
! `(menu-item "Go To" ,menu-bar-goto-menu
! :enable (menu-bar-menu-frame-live-and-visible-p)))
(define-key menu-bar-edit-menu [replace]
! `(menu-item "Replace" ,menu-bar-replace-menu
! :enable (menu-bar-menu-frame-live-and-visible-p)))
(define-key menu-bar-edit-menu [search]
! `(menu-item "Search" ,menu-bar-search-menu
! :enable (menu-bar-menu-frame-live-and-visible-p)))
(define-key menu-bar-edit-menu [separator-search]
'(menu-item "--"))
(define-key menu-bar-edit-menu [mark-whole-buffer]
'(menu-item "Select All" mark-whole-buffer
+ :enable (menu-bar-menu-frame-live-and-visible-p)
:help "Mark the whole buffer for a subsequent cut/copy."))
(define-key menu-bar-edit-menu [clear]
'(menu-item "Clear" delete-region
***************
*** 456,462 ****
(fset 'yank-menu (cons 'keymap yank-menu))
(define-key menu-bar-edit-menu [select-paste]
'(menu-item "Select and Paste" yank-menu
! :enable (and (cdr yank-menu) (not buffer-read-only))
:help "Paste (yank) text cut or copied earlier"))
(define-key menu-bar-edit-menu [paste]
'(menu-item "Paste" yank
--- 465,473 ----
(fset 'yank-menu (cons 'keymap yank-menu))
(define-key menu-bar-edit-menu [select-paste]
'(menu-item "Select and Paste" yank-menu
! :enable (and (cdr yank-menu)
! (not buffer-read-only)
! (menu-bar-menu-frame-live-and-visible-p))
:help "Paste (yank) text cut or copied earlier"))
(define-key menu-bar-edit-menu [paste]
'(menu-item "Paste" yank
***************
*** 464,470 ****
;; Emacs compiled --without-x doesn't have
;; x-selection-exists-p.
(fboundp 'x-selection-exists-p)
! (x-selection-exists-p) (not buffer-read-only))
:help "Paste (yank) text most recently cut/copied"))
(define-key menu-bar-edit-menu [copy]
'(menu-item "Copy" menu-bar-kill-ring-save
--- 475,482 ----
;; Emacs compiled --without-x doesn't have
;; x-selection-exists-p.
(fboundp 'x-selection-exists-p)
! (x-selection-exists-p) (not buffer-read-only)
! (menu-bar-menu-frame-live-and-visible-p))
:help "Paste (yank) text most recently cut/copied"))
(define-key menu-bar-edit-menu [copy]
'(menu-item "Copy" menu-bar-kill-ring-save
***************
*** 479,484 ****
--- 491,497 ----
(define-key menu-bar-edit-menu [undo]
'(menu-item "Undo" undo
:enable (and (not buffer-read-only)
+ (menu-bar-menu-frame-live-and-visible-p)
(not (eq t buffer-undo-list))
(if (eq last-command 'undo)
pending-undo-list
***************
*** 1427,1433 ****
(let ((menu-frame (if (display-multi-frame-p) menu-updating-frame
(selected-frame))))
(and (frame-live-p menu-frame)
! (frame-visible-p menu-frame))))
(defun menu-bar-non-minibuffer-window-p ()
"Return non-nil if selected window of the menu frame is not a minibuf window.
--- 1440,1447 ----
(let ((menu-frame (if (display-multi-frame-p) menu-updating-frame
(selected-frame))))
(and (frame-live-p menu-frame)
! ;; not icon
! (eq (frame-visible-p menu-frame) t))))
(defun menu-bar-non-minibuffer-window-p ()
"Return non-nil if selected window of the menu frame is not a minibuf window.
***************
*** 1451,1456 ****
--- 1465,1471 ----
(setq count (1+ count)))
(setq buffers (cdr buffers)))
(and (menu-bar-non-minibuffer-window-p)
+ (menu-bar-menu-frame-live-and-visible-p)
(> count 1))))
(put 'dired 'menu-enable '(menu-bar-non-minibuffer-window-p))
[-- Attachment #1.1.3: Type: text/plain, Size: 369 bytes --]
On 10 Nov 2005, at 15:57, David Reitter wrote:
> This patch ensures that menu items are disabled when they should
> be, i.e. when there is no applicable visible and non-iconified frame.
> In a lot of cases, one could do "insert file" or choose stuff from
> the "search" menu even if there were only iconified or hidden frames.
>
> <menu-bar-visible-frame.patch>
[-- Attachment #1.2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 2400 bytes --]
[-- Attachment #2: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-11-10 16:03 ` David Reitter
@ 2005-11-10 21:12 ` David Reitter
2005-11-12 3:38 ` Richard M. Stallman
0 siblings, 1 reply; 71+ messages in thread
From: David Reitter @ 2005-11-10 21:12 UTC (permalink / raw)
On 10 Nov 2005, at 16:03, David Reitter wrote:
> This patch ensures that menu items are disabled when they should
> be, i.e. when there is no applicable visible and non-iconified frame.
> In a lot of cases, one could do "insert file" or choose stuff from
> the "search" menu even if there were only iconified or hidden frames.
Here's the patch again, this time not as attachment for your
convenience.
(If any lines were wrapped, please use the previous attachment to
apply.)
Index: menu-bar.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/menu-bar.el,v
retrieving revision 1.278
diff -c -r1.278 menu-bar.el
*** menu-bar.el 1 Nov 2005 23:21:39 -0000 1.278
--- menu-bar.el 10 Nov 2005 16:02:35 -0000
***************
*** 172,177 ****
--- 172,178 ----
'(menu-item "Save" save-buffer
:enable (and (buffer-modified-p)
(buffer-file-name)
+ (menu-bar-menu-frame-live-and-visible-p)
(menu-bar-non-minibuffer-window-p))
:help "Save current buffer to its file"))
***************
*** 184,190 ****
:help "Discard (kill) current buffer"))
(define-key menu-bar-file-menu [insert-file]
'(menu-item "Insert File..." insert-file
! :enable (menu-bar-non-minibuffer-window-p)
:help "Insert another file into current buffer"))
(define-key menu-bar-file-menu [dired]
'(menu-item "Open Directory..." dired
--- 185,192 ----
:help "Discard (kill) current buffer"))
(define-key menu-bar-file-menu [insert-file]
'(menu-item "Insert File..." insert-file
! :enable (and (menu-bar-non-minibuffer-window-p)
! (menu-bar-menu-frame-live-and-visible-p))
:help "Insert another file into current buffer"))
(define-key menu-bar-file-menu [dired]
'(menu-item "Open Directory..." dired
***************
*** 192,202 ****
:help "Read a directory, to operate on its files"))
(define-key menu-bar-file-menu [open-file]
'(menu-item "Open File..." find-file-existing
! :enable (menu-bar-non-minibuffer-window-p)
:help "Read an existing file into an Emacs buffer"))
(define-key menu-bar-file-menu [new-file]
'(menu-item "Visit New File..." find-file
! :enable (menu-bar-non-minibuffer-window-p)
:help "Specify a new file's name, to edit the file"))
\f
--- 194,206 ----
:help "Read a directory, to operate on its files"))
(define-key menu-bar-file-menu [open-file]
'(menu-item "Open File..." find-file-existing
! :enable (or enable-recursive-minibuffers
! (menu-bar-non-minibuffer-window-p))
:help "Read an existing file into an Emacs buffer"))
(define-key menu-bar-file-menu [new-file]
'(menu-item "Visit New File..." find-file
! :enable (or enable-recursive-minibuffers
! (menu-bar-non-minibuffer-window-p))
:help "Specify a new file's name, to edit the file"))
\f
***************
*** 359,364 ****
--- 363,369 ----
;;; Assemble the top-level Edit menu items.
(define-key menu-bar-edit-menu [props]
'(menu-item "Text Properties" facemenu-menu
+ :enable (menu-bar-menu-frame-live-and-visible-p)
:help "Change properties of text in region"))
(define-key menu-bar-edit-menu [fill]
***************
*** 371,377 ****
'(menu-item "--"))
(define-key menu-bar-edit-menu [bookmark]
! '(menu-item "Bookmarks" menu-bar-bookmark-map
:help "Record positions and jump between them"))
(defvar menu-bar-goto-menu (make-sparse-keymap "Go To"))
--- 376,382 ----
'(menu-item "--"))
(define-key menu-bar-edit-menu [bookmark]
! `(menu-item "Bookmarks" ,menu-bar-bookmark-map
:help "Record positions and jump between them"))
(defvar menu-bar-goto-menu (make-sparse-keymap "Go To"))
***************
*** 431,449 ****
:help "Read a line number and go to that line"))
(define-key menu-bar-edit-menu [goto]
! (list 'menu-item "Go To" menu-bar-goto-menu))
(define-key menu-bar-edit-menu [replace]
! (list 'menu-item "Replace" menu-bar-replace-menu))
(define-key menu-bar-edit-menu [search]
! (list 'menu-item "Search" menu-bar-search-menu))
(define-key menu-bar-edit-menu [separator-search]
'(menu-item "--"))
(define-key menu-bar-edit-menu [mark-whole-buffer]
'(menu-item "Select All" mark-whole-buffer
:help "Mark the whole buffer for a subsequent cut/copy."))
(define-key menu-bar-edit-menu [clear]
'(menu-item "Clear" delete-region
--- 436,458 ----
:help "Read a line number and go to that line"))
(define-key menu-bar-edit-menu [goto]
! `(menu-item "Go To" ,menu-bar-goto-menu
! :enable (menu-bar-menu-frame-live-and-visible-p)))
(define-key menu-bar-edit-menu [replace]
! `(menu-item "Replace" ,menu-bar-replace-menu
! :enable (menu-bar-menu-frame-live-and-visible-p)))
(define-key menu-bar-edit-menu [search]
! `(menu-item "Search" ,menu-bar-search-menu
! :enable (menu-bar-menu-frame-live-and-visible-p)))
(define-key menu-bar-edit-menu [separator-search]
'(menu-item "--"))
(define-key menu-bar-edit-menu [mark-whole-buffer]
'(menu-item "Select All" mark-whole-buffer
+ :enable (menu-bar-menu-frame-live-and-visible-p)
:help "Mark the whole buffer for a subsequent cut/copy."))
(define-key menu-bar-edit-menu [clear]
'(menu-item "Clear" delete-region
***************
*** 456,462 ****
(fset 'yank-menu (cons 'keymap yank-menu))
(define-key menu-bar-edit-menu [select-paste]
'(menu-item "Select and Paste" yank-menu
! :enable (and (cdr yank-menu) (not buffer-read-only))
:help "Paste (yank) text cut or copied earlier"))
(define-key menu-bar-edit-menu [paste]
'(menu-item "Paste" yank
--- 465,473 ----
(fset 'yank-menu (cons 'keymap yank-menu))
(define-key menu-bar-edit-menu [select-paste]
'(menu-item "Select and Paste" yank-menu
! :enable (and (cdr yank-menu)
! (not buffer-read-only)
! (menu-bar-menu-frame-live-and-visible-p))
:help "Paste (yank) text cut or copied earlier"))
(define-key menu-bar-edit-menu [paste]
'(menu-item "Paste" yank
***************
*** 464,470 ****
;; Emacs compiled --without-x doesn't have
;; x-selection-exists-p.
(fboundp 'x-selection-exists-p)
! (x-selection-exists-p) (not buffer-read-only))
:help "Paste (yank) text most recently cut/copied"))
(define-key menu-bar-edit-menu [copy]
'(menu-item "Copy" menu-bar-kill-ring-save
--- 475,482 ----
;; Emacs compiled --without-x doesn't have
;; x-selection-exists-p.
(fboundp 'x-selection-exists-p)
! (x-selection-exists-p) (not buffer-read-only)
! (menu-bar-menu-frame-live-and-visible-p))
:help "Paste (yank) text most recently cut/copied"))
(define-key menu-bar-edit-menu [copy]
'(menu-item "Copy" menu-bar-kill-ring-save
***************
*** 479,484 ****
--- 491,497 ----
(define-key menu-bar-edit-menu [undo]
'(menu-item "Undo" undo
:enable (and (not buffer-read-only)
+ (menu-bar-menu-frame-live-and-visible-p)
(not (eq t buffer-undo-list))
(if (eq last-command 'undo)
pending-undo-list
***************
*** 1427,1433 ****
(let ((menu-frame (if (display-multi-frame-p) menu-updating-frame
(selected-frame))))
(and (frame-live-p menu-frame)
! (frame-visible-p menu-frame))))
(defun menu-bar-non-minibuffer-window-p ()
"Return non-nil if selected window of the menu frame is not a
minibuf window.
--- 1440,1447 ----
(let ((menu-frame (if (display-multi-frame-p) menu-updating-frame
(selected-frame))))
(and (frame-live-p menu-frame)
! ;; not icon
! (eq (frame-visible-p menu-frame) t))))
(defun menu-bar-non-minibuffer-window-p ()
"Return non-nil if selected window of the menu frame is not a
minibuf window.
***************
*** 1451,1456 ****
--- 1465,1471 ----
(setq count (1+ count)))
(setq buffers (cdr buffers)))
(and (menu-bar-non-minibuffer-window-p)
+ (menu-bar-menu-frame-live-and-visible-p)
(> count 1))))
(put 'dired 'menu-enable '(menu-bar-non-minibuffer-window-p))
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-11-10 21:12 ` David Reitter
@ 2005-11-12 3:38 ` Richard M. Stallman
2005-11-12 7:11 ` Eli Zaretskii
2005-12-20 21:55 ` Juri Linkov
0 siblings, 2 replies; 71+ messages in thread
From: Richard M. Stallman @ 2005-11-12 3:38 UTC (permalink / raw)
Cc: emacs-devel
The patch seems ok to me. Please install it.
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-11-12 3:38 ` Richard M. Stallman
@ 2005-11-12 7:11 ` Eli Zaretskii
2005-11-12 21:21 ` Richard M. Stallman
2005-11-28 0:21 ` David Reitter
2005-12-20 21:55 ` Juri Linkov
1 sibling, 2 replies; 71+ messages in thread
From: Eli Zaretskii @ 2005-11-12 7:11 UTC (permalink / raw)
Cc: david.reitter, emacs-devel
> From: "Richard M. Stallman" <rms@gnu.org>
> Date: Fri, 11 Nov 2005 22:38:16 -0500
> Cc: emacs-devel@gnu.org
>
> The patch seems ok to me. Please install it.
No, please DON'T!! We currently don't have a good way of checking
whether the menu's frame is visible. The code used by David to do
that does not work in non-toolkit builds of Emacs (see another thread
where Juri about this), so installing it will disable many important
menu items in non-toolkit X builds.
I suggest to wait with the patch until that other problem is resolved.
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-11-12 7:11 ` Eli Zaretskii
@ 2005-11-12 21:21 ` Richard M. Stallman
2005-11-12 22:44 ` Eli Zaretskii
2005-11-28 0:21 ` David Reitter
1 sibling, 1 reply; 71+ messages in thread
From: Richard M. Stallman @ 2005-11-12 21:21 UTC (permalink / raw)
Cc: david.reitter, emacs-devel
The code used by David to do
that does not work in non-toolkit builds of Emacs (see another thread
where Juri about this), so installing it will disable many important
menu items in non-toolkit X builds.
If the problem situation occurs only on the Mac, the code could call
a new C function that is trivial except on the Mac.
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-11-12 21:21 ` Richard M. Stallman
@ 2005-11-12 22:44 ` Eli Zaretskii
0 siblings, 0 replies; 71+ messages in thread
From: Eli Zaretskii @ 2005-11-12 22:44 UTC (permalink / raw)
Cc: david.reitter, emacs-devel
> From: "Richard M. Stallman" <rms@gnu.org>
> CC: david.reitter@gmail.com, emacs-devel@gnu.org
> Date: Sat, 12 Nov 2005 16:21:29 -0500
>
> The code used by David to do
> that does not work in non-toolkit builds of Emacs (see another thread
> where Juri about this), so installing it will disable many important
> menu items in non-toolkit X builds.
>
> If the problem situation occurs only on the Mac, the code could call
> a new C function that is trivial except on the Mac.
That would be okay, of course. My point was that the changes
suggested by David should not be installed as is.
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-11-12 7:11 ` Eli Zaretskii
2005-11-12 21:21 ` Richard M. Stallman
@ 2005-11-28 0:21 ` David Reitter
2005-11-28 5:32 ` Eli Zaretskii
1 sibling, 1 reply; 71+ messages in thread
From: David Reitter @ 2005-11-28 0:21 UTC (permalink / raw)
Cc: rms, emacs-devel
On 12 Nov 2005, at 07:11, Eli Zaretskii wrote:
>> From: "Richard M. Stallman" <rms@gnu.org>
>> Date: Fri, 11 Nov 2005 22:38:16 -0500
>> Cc: emacs-devel@gnu.org
>>
>> The patch seems ok to me. Please install it.
>
> No, please DON'T!! We currently don't have a good way of checking
> whether the menu's frame is visible. The code used by David to do
> that does not work in non-toolkit builds of Emacs (see another thread
> where Juri about this), so installing it will disable many important
> menu items in non-toolkit X builds.
>
> I suggest to wait with the patch until that other problem is resolved.
Do you know if this problem (with menu-bar-menu-frame-live-and-
visible-p I presume) has been solved now?
(I couldn't find the other thread.)
I didn't bother writing a workaround for this issue because I thought
the original bug would be fixed sooner or later.
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-11-28 0:21 ` David Reitter
@ 2005-11-28 5:32 ` Eli Zaretskii
2005-11-28 20:23 ` Juri Linkov
2005-11-28 21:00 ` Richard M. Stallman
0 siblings, 2 replies; 71+ messages in thread
From: Eli Zaretskii @ 2005-11-28 5:32 UTC (permalink / raw)
Cc: emacs-devel
> Cc: rms@gnu.org,
> emacs-devel@gnu.org
> From: David Reitter <david.reitter@gmail.com>
> Date: Mon, 28 Nov 2005 00:21:58 +0000
>
> On 12 Nov 2005, at 07:11, Eli Zaretskii wrote:
>
> > No, please DON'T!! We currently don't have a good way of checking
> > whether the menu's frame is visible. The code used by David to do
> > that does not work in non-toolkit builds of Emacs (see another thread
> > where Juri about this), so installing it will disable many important
> > menu items in non-toolkit X builds.
> >
> > I suggest to wait with the patch until that other problem is resolved.
>
> Do you know if this problem (with menu-bar-menu-frame-live-and-
> visible-p I presume) has been solved now?
No, not yet.
> I didn't bother writing a workaround for this issue because I thought
> the original bug would be fixed sooner or later.
I'm not sure it's a bug, it could be a missing feature. The issue is
how to determine that a frame that displays the current menu is
visible. The code we are discussing tries to use menu-updating-frame,
but it looks like that variable is not a reliable way of finding the
frame in question at the point where we need it (which is when a menu
is dropped after a mouse click). Perhaps someone could suggest a
better way of finding the menu's frame.
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-11-28 5:32 ` Eli Zaretskii
@ 2005-11-28 20:23 ` Juri Linkov
2005-11-28 21:00 ` Richard M. Stallman
1 sibling, 0 replies; 71+ messages in thread
From: Juri Linkov @ 2005-11-28 20:23 UTC (permalink / raw)
Cc: david.reitter, emacs-devel
> The issue is how to determine that a frame that displays the current
> menu is visible. The code we are discussing tries to use
> menu-updating-frame, but it looks like that variable is not
> a reliable way of finding the frame in question at the point where
> we need it (which is when a menu is dropped after a mouse click).
> Perhaps someone could suggest a better way of finding the menu's frame.
As I proposed to replace
(if (display-multi-frame-p) menu-updating-frame (selected-frame))
with
(or menu-updating-frame (selected-frame))
it seems this condition will work on all configurations. For toolkits
that set `menu-updating-frame', it will work exactly as now (i.e.
it will disable menu items if there's no visible frame).
For non-toolkit configurations and terminals, where the menu is drawn
on the same frame, it will give the correct result too (with selected-frame).
Could someone find a configuration where this doesn't work?
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-11-28 5:32 ` Eli Zaretskii
2005-11-28 20:23 ` Juri Linkov
@ 2005-11-28 21:00 ` Richard M. Stallman
2005-11-28 22:20 ` David Reitter
2005-11-28 22:46 ` Jason Rumney
1 sibling, 2 replies; 71+ messages in thread
From: Richard M. Stallman @ 2005-11-28 21:00 UTC (permalink / raw)
Cc: david.reitter, emacs-devel
I'm not sure it's a bug, it could be a missing feature. The issue is
how to determine that a frame that displays the current menu is
visible.
Is it only Mac OS on which the menu can be separated from the frame?
On Mac OS, does it always apply to the selected frame?
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-11-28 21:00 ` Richard M. Stallman
@ 2005-11-28 22:20 ` David Reitter
2005-11-28 22:46 ` Jason Rumney
1 sibling, 0 replies; 71+ messages in thread
From: David Reitter @ 2005-11-28 22:20 UTC (permalink / raw)
Cc: Eli Zaretskii, emacs-devel
On 28 Nov 2005, at 21:00, Richard M. Stallman wrote:
> I'm not sure it's a bug, it could be a missing feature. The
> issue is
> how to determine that a frame that displays the current menu is
> visible.
>
> Is it only Mac OS on which the menu can be separated from the frame?
> On Mac OS, does it always apply to the selected frame?
Yes, to the selected frame (and the selected buffer).
And it's not an option for the user (in the Carbon port) - the menu
is always on the top of the screen.
Wasn't there some option in KDE or Gnome that allowed you to do that,
too?
I faintly remember seeing something. (Though I don't know if this
will apply to Emacs' menu, too.)
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-11-28 21:00 ` Richard M. Stallman
2005-11-28 22:20 ` David Reitter
@ 2005-11-28 22:46 ` Jason Rumney
2005-11-29 10:32 ` Reiner Steib
2005-11-29 21:48 ` Richard M. Stallman
1 sibling, 2 replies; 71+ messages in thread
From: Jason Rumney @ 2005-11-28 22:46 UTC (permalink / raw)
Cc: david.reitter, Eli Zaretskii, emacs-devel
"Richard M. Stallman" <rms@gnu.org> writes:
> I'm not sure it's a bug, it could be a missing feature. The issue is
> how to determine that a frame that displays the current menu is
> visible.
>
> Is it only Mac OS on which the menu can be separated from the frame?
> On Mac OS, does it always apply to the selected frame?
GTK menus can be detached from their frame. I am not absolutely sure
(and not able to test right now) what happens if you minimize their
frame (or otherwise make it invisible) though.
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-11-28 22:46 ` Jason Rumney
@ 2005-11-29 10:32 ` Reiner Steib
2005-11-29 21:48 ` Richard M. Stallman
1 sibling, 0 replies; 71+ messages in thread
From: Reiner Steib @ 2005-11-29 10:32 UTC (permalink / raw)
On Mon, Nov 28 2005, Jason Rumney wrote:
> GTK menus can be detached from their frame. I am not absolutely sure
> (and not able to test right now) what happens if you minimize their
> frame (or otherwise make it invisible) though.
When minimizing the frame, the menu is minimized too. But it is
possible to raise the menu without raising the corresponding frame.
Versions:
Window manager:
$ fluxbox -version
Fluxbox 0.9.14 : (c) 2001-2005 Henrik Kinnunen
In GNU Emacs 22.0.50.5 (x86_64-unknown-linux-gnu, GTK+ Version 2.4.9)
of 2005-11-29 on bridgekeeper
X server distributor `The X.Org Foundation', version 11.0.60801000
configured using `configure '--prefix=/import/xtra/emacs/HEAD'
'--with-gtk' '--exec-prefix=/import/xtra/emacs/HEAD-x86_64''
Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-11-28 22:46 ` Jason Rumney
2005-11-29 10:32 ` Reiner Steib
@ 2005-11-29 21:48 ` Richard M. Stallman
2005-12-06 0:54 ` Juri Linkov
1 sibling, 1 reply; 71+ messages in thread
From: Richard M. Stallman @ 2005-11-29 21:48 UTC (permalink / raw)
Cc: david.reitter, eliz, emacs-devel
GTK menus can be detached from their frame. I am not absolutely sure
(and not able to test right now) what happens if you minimize their
frame (or otherwise make it invisible) though.
Can someone tell us what the detached GTK menu bar does
when there is no visible frame? Which frame does it operate on?
Is the suggestion (or menu-updating-frame (selected-frame)) correct
for the GTK case?
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-11-29 21:48 ` Richard M. Stallman
@ 2005-12-06 0:54 ` Juri Linkov
2005-12-06 16:43 ` Richard M. Stallman
0 siblings, 1 reply; 71+ messages in thread
From: Juri Linkov @ 2005-12-06 0:54 UTC (permalink / raw)
Cc: david.reitter, eliz, emacs-devel, jasonr
> GTK menus can be detached from their frame. I am not absolutely sure
> (and not able to test right now) what happens if you minimize their
> frame (or otherwise make it invisible) though.
>
> Can someone tell us what the detached GTK menu bar does
> when there is no visible frame? Which frame does it operate on?
It operates on the frame from which it was detached. This frame
remains invisible after selecting a menu item from the visible menu.
> Is the suggestion (or menu-updating-frame (selected-frame)) correct
> for the GTK case?
At least, it doesn't make things worse. I discovered that currently
even GTK builds have the same bug as on non-toolkit builds. For example,
after evaluating on a GTK build:
(define-key global-map [down-mouse-3] menu-bar-file-menu)
the menu item "Save As..." is disabled in the popup menu called via [mouse-3].
After looking at the code I suspect that the same bug exists on W32 and OSX.
In w32menu.c and macmenu.c `x-popup-menu' after setting Vmenu_updating_frame
to the frame `f', resets it immediately to nil, so Vmenu_updating_frame
eventually is always nil in popup menus. And xmenu.c doesn't set
Vmenu_updating_frame at all in `x-popup-menu'. I guess the correct code
for all three platforms should be:
if (! NILP (position))
{
...
XSETFRAME (Vmenu_updating_frame, f);
}
else
Vmenu_updating_frame = Qnil;
Is it right?
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-06 0:54 ` Juri Linkov
@ 2005-12-06 16:43 ` Richard M. Stallman
2005-12-07 0:45 ` Juri Linkov
0 siblings, 1 reply; 71+ messages in thread
From: Richard M. Stallman @ 2005-12-06 16:43 UTC (permalink / raw)
Cc: david.reitter, eliz, emacs-devel, jasonr
> Can someone tell us what the detached GTK menu bar does
> when there is no visible frame? Which frame does it operate on?
It operates on the frame from which it was detached. This frame
remains invisible after selecting a menu item from the visible menu.
Does this mean you can have several detached GTK menus,
each detached from a different frame?
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-06 16:43 ` Richard M. Stallman
@ 2005-12-07 0:45 ` Juri Linkov
2005-12-07 22:58 ` Richard M. Stallman
0 siblings, 1 reply; 71+ messages in thread
From: Juri Linkov @ 2005-12-07 0:45 UTC (permalink / raw)
Cc: david.reitter, eliz, emacs-devel, jasonr
> > Can someone tell us what the detached GTK menu bar does
> > when there is no visible frame? Which frame does it operate on?
>
> It operates on the frame from which it was detached. This frame
> remains invisible after selecting a menu item from the visible menu.
>
> Does this mean you can have several detached GTK menus,
> each detached from a different frame?
Yes.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-07 0:45 ` Juri Linkov
@ 2005-12-07 22:58 ` Richard M. Stallman
2005-12-12 8:23 ` Jan D.
0 siblings, 1 reply; 71+ messages in thread
From: Richard M. Stallman @ 2005-12-07 22:58 UTC (permalink / raw)
Cc: david.reitter, eliz, emacs-devel, jasonr
> Does this mean you can have several detached GTK menus,
> each detached from a different frame?
Yes.
So I guess it is necessary to make operations on each detached menu
work on its associated frame, and to make the enabling and disabling
of items in that menu depend on its associated frame.
Jan, could you DTRT?
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-07 22:58 ` Richard M. Stallman
@ 2005-12-12 8:23 ` Jan D.
2005-12-12 21:14 ` Eli Zaretskii
` (2 more replies)
0 siblings, 3 replies; 71+ messages in thread
From: Jan D. @ 2005-12-12 8:23 UTC (permalink / raw)
Cc: Juri Linkov, david.reitter, eliz, jasonr, emacs-devel
Richard M. Stallman wrote:
> > Does this mean you can have several detached GTK menus,
> > each detached from a different frame?
>
> Yes.
>
>So I guess it is necessary to make operations on each detached menu
>work on its associated frame, and to make the enabling and disabling
>of items in that menu depend on its associated frame.
>
>Jan, could you DTRT?
>
It should be so already. Code-wise there is no difference between a
menu bar menu and a detached menu, so if enabling/disabling works for
the menu bar, it should work for detached menus also. Are there cases
where this doesn't work?
When a frame is iconified, the detached menus are (or should be)
iconified as well. This is done by the GTK toolkit.
Jan D.
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-12 8:23 ` Jan D.
@ 2005-12-12 21:14 ` Eli Zaretskii
2005-12-13 7:19 ` Jan Djärv
2005-12-13 3:15 ` Richard M. Stallman
2005-12-16 9:05 ` Juri Linkov
2 siblings, 1 reply; 71+ messages in thread
From: Eli Zaretskii @ 2005-12-12 21:14 UTC (permalink / raw)
Cc: juri, david.reitter, emacs-devel
> Date: Mon, 12 Dec 2005 09:23:51 +0100
> From: "Jan D." <jan.h.d@swipnet.se>
> CC: Juri Linkov <juri@jurta.org>, david.reitter@gmail.com, eliz@gnu.org,
> emacs-devel@gnu.org, jasonr@gnu.org
>
> Richard M. Stallman wrote:
>
> > > Does this mean you can have several detached GTK menus,
> > > each detached from a different frame?
> >
> > Yes.
> >
> >So I guess it is necessary to make operations on each detached menu
> >work on its associated frame, and to make the enabling and disabling
> >of items in that menu depend on its associated frame.
> >
> >Jan, could you DTRT?
> >
>
> It should be so already. Code-wise there is no difference between a
> menu bar menu and a detached menu, so if enabling/disabling works for
> the menu bar, it should work for detached menus also. Are there cases
> where this doesn't work?
>
> When a frame is iconified, the detached menus are (or should be)
> iconified as well. This is done by the GTK toolkit.
What about the other half of what Richard wrote: ``make the enabling
and disabling of items in the menu depend on its associated frame''
(which is the original problem that started this thread)? When you
say ``it should be so already'', do you mean it already works?
Because, AFAIK, in the current code enabling/disabling menu items
depends on the variable menu-updating-frame, which is not set
correctly on some platforms, like the no-toolkit X build.
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-12 21:14 ` Eli Zaretskii
@ 2005-12-13 7:19 ` Jan Djärv
2005-12-13 20:24 ` Eli Zaretskii
0 siblings, 1 reply; 71+ messages in thread
From: Jan Djärv @ 2005-12-13 7:19 UTC (permalink / raw)
Cc: juri, david.reitter, emacs-devel
Eli Zaretskii wrote:
>>
>>It should be so already. Code-wise there is no difference between a
>>menu bar menu and a detached menu, so if enabling/disabling works for
>>the menu bar, it should work for detached menus also. Are there cases
>>where this doesn't work?
>>
>>When a frame is iconified, the detached menus are (or should be)
>>iconified as well. This is done by the GTK toolkit.
>
>
> What about the other half of what Richard wrote: ``make the enabling
> and disabling of items in the menu depend on its associated frame''
> (which is the original problem that started this thread)? When you
> say ``it should be so already'', do you mean it already works?
> Because, AFAIK, in the current code enabling/disabling menu items
> depends on the variable menu-updating-frame, which is not set
> correctly on some platforms, like the no-toolkit X build.
I mean that if the general problem of updating menu-updating-frame is fixed,
the detached menus should "just work". But if it is a toolkit dependent
problem, I'll have a look and see if there are cases where menu-updating-frame
isn't set correctly for the GTK build.
Jan D.
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-13 7:19 ` Jan Djärv
@ 2005-12-13 20:24 ` Eli Zaretskii
2005-12-14 17:03 ` Juri Linkov
0 siblings, 1 reply; 71+ messages in thread
From: Eli Zaretskii @ 2005-12-13 20:24 UTC (permalink / raw)
Cc: juri, david.reitter, emacs-devel
> Date: Tue, 13 Dec 2005 08:19:20 +0100
> From: =?ISO-8859-1?Q?Jan_Dj=E4rv?= <jan.h.d@swipnet.se>
> CC: juri@jurta.org, david.reitter@gmail.com, emacs-devel@gnu.org
>
> I mean that if the general problem of updating menu-updating-frame is fixed,
> the detached menus should "just work".
This cannot be fixed in a platform-independent manner. Each window
system and each toolkit (more accurately, each version of the menu
support C code) needs to find its own solution. Currently, AFAIK,
there's a known problem with non-toolkit X build and perhaps with one
of the Mac builds (I'm not sure which one exactly, but I think you can
find it out by reading previous messages in this thread.)
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-13 20:24 ` Eli Zaretskii
@ 2005-12-14 17:03 ` Juri Linkov
2005-12-14 19:25 ` Eli Zaretskii
2005-12-14 21:25 ` Drew Adams
0 siblings, 2 replies; 71+ messages in thread
From: Juri Linkov @ 2005-12-14 17:03 UTC (permalink / raw)
Cc: david.reitter, jan.h.d, emacs-devel
> This cannot be fixed in a platform-independent manner. Each window
> system and each toolkit (more accurately, each version of the menu
> support C code) needs to find its own solution. Currently, AFAIK,
> there's a known problem with non-toolkit X build and perhaps with one
> of the Mac builds (I'm not sure which one exactly, but I think you can
> find it out by reading previous messages in this thread.)
This problem exists not only on non-toolkit X builds, but also
for toolbars and pop-up menus of all X toolkits, and perhaps also
on Mac and Windows. Could you try to evaluate on Windows
(define-key global-map [down-mouse-3] menu-bar-file-menu)
and to click [mouse-3] on a buffer. Do you see "Save As..." disabled?
If yes, then this problem also affects Windows.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-14 17:03 ` Juri Linkov
@ 2005-12-14 19:25 ` Eli Zaretskii
2005-12-16 9:04 ` Juri Linkov
2005-12-14 21:25 ` Drew Adams
1 sibling, 1 reply; 71+ messages in thread
From: Eli Zaretskii @ 2005-12-14 19:25 UTC (permalink / raw)
Cc: david.reitter, jan.h.d, emacs-devel
> From: Juri Linkov <juri@jurta.org>
> Cc: jan.h.d@swipnet.se, david.reitter@gmail.com, emacs-devel@gnu.org
> Date: Wed, 14 Dec 2005 19:03:09 +0200
>
> This problem exists not only on non-toolkit X builds, but also
> for toolbars and pop-up menus of all X toolkits, and perhaps also
> on Mac and Windows. Could you try to evaluate on Windows
>
> (define-key global-map [down-mouse-3] menu-bar-file-menu)
>
> and to click [mouse-3] on a buffer. Do you see "Save As..." disabled?
Yes.
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-14 19:25 ` Eli Zaretskii
@ 2005-12-16 9:04 ` Juri Linkov
2005-12-16 11:29 ` Eli Zaretskii
0 siblings, 1 reply; 71+ messages in thread
From: Juri Linkov @ 2005-12-16 9:04 UTC (permalink / raw)
Cc: david.reitter, jan.h.d, emacs-devel
>> This problem exists not only on non-toolkit X builds, but also
>> for toolbars and pop-up menus of all X toolkits, and perhaps also
>> on Mac and Windows. Could you try to evaluate on Windows
>>
>> (define-key global-map [down-mouse-3] menu-bar-file-menu)
>>
>> and to click [mouse-3] on a buffer. Do you see "Save As..." disabled?
>
> Yes.
Below is a fix that sets menu-updating-frame correctly for three
platforms (X, Mac, W32), and also doesn't disable menu items
permanently on tty and non-toolkit X builds:
Index: src/xmenu.c
===================================================================
RCS file: /sources/emacs/emacs/src/xmenu.c,v
retrieving revision 1.296
diff -c -r1.296 xmenu.c
*** src/xmenu.c 12 Dec 2005 08:08:43 -0000 1.296
--- src/xmenu.c 16 Dec 2005 09:02:32 -0000
***************
*** 899,906 ****
xpos += XINT (x);
ypos += XINT (y);
}
! Vmenu_updating_frame = Qnil;
#endif /* HAVE_MENUS */
record_unwind_protect (unuse_menu_items, Qnil);
--- 899,909 ----
xpos += XINT (x);
ypos += XINT (y);
+
+ XSETFRAME (Vmenu_updating_frame, f);
}
! else
! Vmenu_updating_frame = Qnil;
#endif /* HAVE_MENUS */
record_unwind_protect (unuse_menu_items, Qnil);
Index: src/w32menu.c
===================================================================
RCS file: /sources/emacs/emacs/src/w32menu.c,v
retrieving revision 1.77
diff -c -r1.77 w32menu.c
*** src/w32menu.c 31 Aug 2005 15:22:15 -0000 1.77
--- src/w32menu.c 16 Dec 2005 09:02:33 -0000
***************
*** 738,744 ****
XSETFRAME (Vmenu_updating_frame, f);
}
! Vmenu_updating_frame = Qnil;
#endif /* HAVE_MENUS */
title = Qnil;
--- 738,745 ----
XSETFRAME (Vmenu_updating_frame, f);
}
! else
! Vmenu_updating_frame = Qnil;
#endif /* HAVE_MENUS */
title = Qnil;
Index: src/macmenu.c
===================================================================
RCS file: /sources/emacs/emacs/src/macmenu.c,v
retrieving revision 1.32
diff -c -r1.32 macmenu.c
*** src/macmenu.c 7 Aug 2005 12:33:17 -0000 1.32
--- src/macmenu.c 16 Dec 2005 09:02:34 -0000
***************
*** 746,752 ****
XSETFRAME (Vmenu_updating_frame, f);
}
! Vmenu_updating_frame = Qnil;
#endif /* HAVE_MENUS */
title = Qnil;
--- 746,753 ----
XSETFRAME (Vmenu_updating_frame, f);
}
! else
! Vmenu_updating_frame = Qnil;
#endif /* HAVE_MENUS */
title = Qnil;
Index: lisp/menu-bar.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/menu-bar.el,v
retrieving revision 1.284
diff -c -r1.284 menu-bar.el
*** lisp/menu-bar.el 13 Dec 2005 11:07:50 -0000 1.284
--- lisp/menu-bar.el 16 Dec 2005 09:02:43 -0000
***************
*** 1418,1425 ****
(defun menu-bar-menu-frame-live-and-visible-p ()
"Return non-nil if the menu frame is alive and visible.
The menu frame is the frame for which we are updating the menu."
! (let ((menu-frame (if (display-multi-frame-p) menu-updating-frame
! (selected-frame))))
(and (frame-live-p menu-frame)
(frame-visible-p menu-frame))))
--- 1418,1424 ----
(defun menu-bar-menu-frame-live-and-visible-p ()
"Return non-nil if the menu frame is alive and visible.
The menu frame is the frame for which we are updating the menu."
! (let ((menu-frame (or menu-updating-frame (selected-frame))))
(and (frame-live-p menu-frame)
(frame-visible-p menu-frame))))
***************
*** 1428,1435 ****
See the documentation of `menu-bar-menu-frame-live-and-visible-p'
for the definition of the menu frame."
! (let ((menu-frame (if (display-multi-frame-p) menu-updating-frame
! (selected-frame))))
(not (window-minibuffer-p (frame-selected-window menu-frame)))))
(defun kill-this-buffer () ; for the menubar
--- 1427,1433 ----
See the documentation of `menu-bar-menu-frame-live-and-visible-p'
for the definition of the menu frame."
! (let ((menu-frame (or menu-updating-frame (selected-frame))))
(not (window-minibuffer-p (frame-selected-window menu-frame)))))
(defun kill-this-buffer () ; for the menubar
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-16 9:04 ` Juri Linkov
@ 2005-12-16 11:29 ` Eli Zaretskii
2005-12-16 12:55 ` Juri Linkov
0 siblings, 1 reply; 71+ messages in thread
From: Eli Zaretskii @ 2005-12-16 11:29 UTC (permalink / raw)
Cc: david.reitter, jan.h.d, emacs-devel
> From: Juri Linkov <juri@jurta.org>
> Cc: jan.h.d@swipnet.se, david.reitter@gmail.com, emacs-devel@gnu.org
> Date: Fri, 16 Dec 2005 11:04:59 +0200
>
> Below is a fix that sets menu-updating-frame correctly for three
> platforms (X, Mac, W32), and also doesn't disable menu items
> permanently on tty and non-toolkit X builds:
If you fixed the code to set menu-updating-frame correctly for all
platforms, then why did you need to change menu-bar.el as well? I
mean changes like this one:
> *** lisp/menu-bar.el 13 Dec 2005 11:07:50 -0000 1.284
> --- lisp/menu-bar.el 16 Dec 2005 09:02:43 -0000
> ***************
> *** 1418,1425 ****
> (defun menu-bar-menu-frame-live-and-visible-p ()
> "Return non-nil if the menu frame is alive and visible.
> The menu frame is the frame for which we are updating the menu."
> ! (let ((menu-frame (if (display-multi-frame-p) menu-updating-frame
> ! (selected-frame))))
> (and (frame-live-p menu-frame)
> (frame-visible-p menu-frame))))
>
> --- 1418,1424 ----
> (defun menu-bar-menu-frame-live-and-visible-p ()
> "Return non-nil if the menu frame is alive and visible.
> The menu frame is the frame for which we are updating the menu."
> ! (let ((menu-frame (or menu-updating-frame (selected-frame))))
> (and (frame-live-p menu-frame)
> (frame-visible-p menu-frame))))
>
> ***************
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-16 11:29 ` Eli Zaretskii
@ 2005-12-16 12:55 ` Juri Linkov
2005-12-16 13:14 ` Eli Zaretskii
0 siblings, 1 reply; 71+ messages in thread
From: Juri Linkov @ 2005-12-16 12:55 UTC (permalink / raw)
Cc: david.reitter, jan.h.d, emacs-devel
>> Below is a fix that sets menu-updating-frame correctly for three
>> platforms (X, Mac, W32), and also doesn't disable menu items
>> permanently on tty and non-toolkit X builds:
>
> If you fixed the code to set menu-updating-frame correctly for all
> platforms, then why did you need to change menu-bar.el as well?
It sets menu-updating-frame on platforms where menus can be displayed
in a separate frame. The change in menu-bar.el is needed for builds
like tty and non-toolkit where menu bars are displayed in the same
frame. This change will also work on platforms with menus in a
separate frame because menu-updating-frame is always non-nil on them.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-16 12:55 ` Juri Linkov
@ 2005-12-16 13:14 ` Eli Zaretskii
2005-12-16 14:27 ` Juri Linkov
0 siblings, 1 reply; 71+ messages in thread
From: Eli Zaretskii @ 2005-12-16 13:14 UTC (permalink / raw)
Cc: david.reitter, jan.h.d, emacs-devel
> From: Juri Linkov <juri@jurta.org>
> Cc: jan.h.d@swipnet.se, david.reitter@gmail.com, emacs-devel@gnu.org
> Date: Fri, 16 Dec 2005 14:55:34 +0200
>
> > If you fixed the code to set menu-updating-frame correctly for all
> > platforms, then why did you need to change menu-bar.el as well?
>
> It sets menu-updating-frame on platforms where menus can be displayed
> in a separate frame. The change in menu-bar.el is needed for builds
> like tty and non-toolkit where menu bars are displayed in the same
> frame.
The current code already supports the tty case. And I thought the
non-toolkit builds were handled by your C-level changes.
FWIW, I don't like using the frame returned by selected-frame because
that could enable the menu items if menu-updating-frame is somehow not
set when it should. We might be sweeping problems under the carpet
here.
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-16 13:14 ` Eli Zaretskii
@ 2005-12-16 14:27 ` Juri Linkov
2005-12-16 15:24 ` Eli Zaretskii
0 siblings, 1 reply; 71+ messages in thread
From: Juri Linkov @ 2005-12-16 14:27 UTC (permalink / raw)
Cc: david.reitter, jan.h.d, emacs-devel
> FWIW, I don't like using the frame returned by selected-frame because
> that could enable the menu items if menu-updating-frame is somehow not
> set when it should. We might be sweeping problems under the carpet
> here.
If for some reason menu-updating-frame is not set when it should (due to
a bug or a overlooked case) then it is much better to enable menu items
than to disable them by default. When a menu item is enabled with its
updating frame invisible, it is not a disaster. But when menu items are
permanently disabled (for another overlooked case like non-toolkit builds),
this makes menus in Emacs unusable. The change in menu-bar.el makes such
an unfortunate situation impossible.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-16 14:27 ` Juri Linkov
@ 2005-12-16 15:24 ` Eli Zaretskii
2005-12-17 10:54 ` Juri Linkov
0 siblings, 1 reply; 71+ messages in thread
From: Eli Zaretskii @ 2005-12-16 15:24 UTC (permalink / raw)
Cc: david.reitter, jan.h.d, emacs-devel
> From: Juri Linkov <juri@jurta.org>
> Cc: jan.h.d@swipnet.se, david.reitter@gmail.com, emacs-devel@gnu.org
> Date: Fri, 16 Dec 2005 16:27:28 +0200
>
> If for some reason menu-updating-frame is not set when it should (due to
> a bug or a overlooked case) then it is much better to enable menu items
> than to disable them by default.
With that arrangement, we will never find those cases.
^ permalink raw reply [flat|nested] 71+ messages in thread
* RE: menu-bar: disable items when no frame visible
2005-12-14 17:03 ` Juri Linkov
2005-12-14 19:25 ` Eli Zaretskii
@ 2005-12-14 21:25 ` Drew Adams
2005-12-15 4:33 ` Eli Zaretskii
1 sibling, 1 reply; 71+ messages in thread
From: Drew Adams @ 2005-12-14 21:25 UTC (permalink / raw)
Could you try to evaluate on Windows
(define-key global-map [down-mouse-3] menu-bar-file-menu)
and to click [mouse-3] on a buffer. Do you see "Save As..." disabled?
If yes, then this problem also affects Windows.
No, Save Buffer As... is not disabled.
In GNU Emacs 22.0.50.1 (i386-mingw-nt5.1.2600)
of 2005-06-26 on NONIQPC
X server distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc
(3.3) --cflags -I../../jpeg-6b-3/include -I../../libpng-1.2.8/include -I../.
./tiff-3.6.1-2/include -I../../xpm-nox-4.2.0/include -I../../zlib-1.2.2/incl
ude'
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-14 21:25 ` Drew Adams
@ 2005-12-15 4:33 ` Eli Zaretskii
0 siblings, 0 replies; 71+ messages in thread
From: Eli Zaretskii @ 2005-12-15 4:33 UTC (permalink / raw)
Cc: emacs-devel
> From: "Drew Adams" <drew.adams@oracle.com>
> Date: Wed, 14 Dec 2005 13:25:41 -0800
>
> Could you try to evaluate on Windows
>
> (define-key global-map [down-mouse-3] menu-bar-file-menu)
>
> and to click [mouse-3] on a buffer. Do you see "Save As..." disabled?
> If yes, then this problem also affects Windows.
>
> No, Save Buffer As... is not disabled.
[...]
> In GNU Emacs 22.0.50.1 (i386-mingw-nt5.1.2600)
> of 2005-06-26 on NONIQPC
^^^^^^^^^^
It's clear why: you have a very old build, way before the code that
disables menu items was introduced.
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-12 8:23 ` Jan D.
2005-12-12 21:14 ` Eli Zaretskii
@ 2005-12-13 3:15 ` Richard M. Stallman
2005-12-16 9:05 ` Juri Linkov
2 siblings, 0 replies; 71+ messages in thread
From: Richard M. Stallman @ 2005-12-13 3:15 UTC (permalink / raw)
Cc: juri, david.reitter, eliz, jasonr, emacs-devel
It should be so already. Code-wise there is no difference between a
menu bar menu and a detached menu, so if enabling/disabling works for
the menu bar, it should work for detached menus also. Are there cases
where this doesn't work?
I don't know. Could you test it?
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-12 8:23 ` Jan D.
2005-12-12 21:14 ` Eli Zaretskii
2005-12-13 3:15 ` Richard M. Stallman
@ 2005-12-16 9:05 ` Juri Linkov
2005-12-16 17:40 ` Jan Djärv
2 siblings, 1 reply; 71+ messages in thread
From: Juri Linkov @ 2005-12-16 9:05 UTC (permalink / raw)
Cc: david.reitter, eliz, jasonr, rms, emacs-devel
> When a frame is iconified, the detached menus are (or should be) iconified
> as well. This is done by the GTK toolkit.
Emacs doesn't iconify the detached toolbar when a frame is iconified on
GTK builds. Should this be fixed?
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-16 9:05 ` Juri Linkov
@ 2005-12-16 17:40 ` Jan Djärv
2005-12-17 10:47 ` Juri Linkov
0 siblings, 1 reply; 71+ messages in thread
From: Jan Djärv @ 2005-12-16 17:40 UTC (permalink / raw)
Cc: david.reitter, eliz, jasonr, rms, emacs-devel
Juri Linkov wrote:
>>When a frame is iconified, the detached menus are (or should be) iconified
>>as well. This is done by the GTK toolkit.
>
>
> Emacs doesn't iconify the detached toolbar when a frame is iconified on
> GTK builds. Should this be fixed?
>
It should be fixed by the GTK people then. Anyway, it is probably dependent
on the window manager you use, I suspect they do this with WM hints.
Jan D.
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-16 17:40 ` Jan Djärv
@ 2005-12-17 10:47 ` Juri Linkov
0 siblings, 0 replies; 71+ messages in thread
From: Juri Linkov @ 2005-12-17 10:47 UTC (permalink / raw)
Cc: david.reitter, eliz, jasonr, rms, emacs-devel
>>>When a frame is iconified, the detached menus are (or should be) iconified
>>>as well. This is done by the GTK toolkit.
>> Emacs doesn't iconify the detached toolbar when a frame is iconified on
>> GTK builds. Should this be fixed?
>
> It should be fixed by the GTK people then. Anyway, it is probably
> dependent on the window manager you use, I suspect they do this with
> WM hints.
I use sawfish, and it doesn't seem to do anything special with the
toolbar window.
I just noticed that the toolbar window have no Minimize button in the
window title. Maybe this prevents it from minimizing when its main Emacs
frame becomes minimized?
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-11-12 3:38 ` Richard M. Stallman
2005-11-12 7:11 ` Eli Zaretskii
@ 2005-12-20 21:55 ` Juri Linkov
2005-12-23 20:43 ` Juri Linkov
1 sibling, 1 reply; 71+ messages in thread
From: Juri Linkov @ 2005-12-20 21:55 UTC (permalink / raw)
Cc: david.reitter, emacs-devel
Since I fixed menu-bar to work on non-toolkit builds, I think patches
sent by David Reitter finally can be installed now.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-20 21:55 ` Juri Linkov
@ 2005-12-23 20:43 ` Juri Linkov
2005-12-24 12:15 ` David Reitter
2005-12-24 16:32 ` Richard M. Stallman
0 siblings, 2 replies; 71+ messages in thread
From: Juri Linkov @ 2005-12-23 20:43 UTC (permalink / raw)
Cc: david.reitter, emacs-devel
> Since I fixed menu-bar to work on non-toolkit builds, I think patches
> sent by David Reitter finally can be installed now.
I looked at these patches and now I have some questions.
1. What is the purpose of adding the condition `enable-recursive-minibuffers'
to `:enable' of "Visit New File..." and "Open File..."? If to allow
calling `find-file' in the minibuffer then this doesn't work anyway.
It gives an error after selecting "Open File..." and selecting a file name
while point in the minibuffer:
find-file: Cannot switch buffers in minibuffer window
2. Why keymap variables are replaced with their values at the moment
of adding a menu item? I.e. what changes like the following achieve?
(define-key menu-bar-edit-menu [bookmark]
- '(menu-item "Bookmarks" menu-bar-bookmark-map
+ `(menu-item "Bookmarks" ,menu-bar-bookmark-map
:help "Record positions and jump between them"))
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-23 20:43 ` Juri Linkov
@ 2005-12-24 12:15 ` David Reitter
2005-12-24 20:07 ` Juri Linkov
2005-12-25 2:51 ` Richard M. Stallman
2005-12-24 16:32 ` Richard M. Stallman
1 sibling, 2 replies; 71+ messages in thread
From: David Reitter @ 2005-12-24 12:15 UTC (permalink / raw)
Cc: rms, emacs-devel
On 23 Dec 2005, at 21:43, Juri Linkov wrote:
> 1. What is the purpose of adding the condition `enable-recursive-
> minibuffers'
> to `:enable' of "Visit New File..." and "Open File..."? If to allow
> calling `find-file' in the minibuffer then this doesn't work anyway.
> It gives an error after selecting "Open File..." and selecting a
> file name
> while point in the minibuffer:
>
> find-file: Cannot switch buffers in minibuffer window
Yes, you're right.
But I would suggest improving find-file to catch the error in switch-
to-buffer and show the buffer in another window in that case, at
least when called interactively.
(This made sense in my own setup because I have advised switch-to-
buffer to show most buffers in a new frame, so I don't usually get
that error.)
> 2. Why keymap variables are replaced with their values at the moment
> of adding a menu item? I.e. what changes like the following achieve?
>
> (define-key menu-bar-edit-menu [bookmark]
> - '(menu-item "Bookmarks" menu-bar-bookmark-map
> + `(menu-item "Bookmarks" ,menu-bar-bookmark-map
> :help "Record positions and jump between them"))
Thanks for pointing this out, maybe that's a bug in the patch. Let's
leave this particular change out.
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-24 12:15 ` David Reitter
@ 2005-12-24 20:07 ` Juri Linkov
2005-12-24 22:59 ` David Reitter
2005-12-25 2:51 ` Richard M. Stallman
1 sibling, 1 reply; 71+ messages in thread
From: Juri Linkov @ 2005-12-24 20:07 UTC (permalink / raw)
Cc: rms, emacs-devel
> (This made sense in my own setup because I have advised switch-to-
> buffer to show most buffers in a new frame, so I don't usually get
> that error.)
This looks like what `pop-up-frames' is intended for.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-24 20:07 ` Juri Linkov
@ 2005-12-24 22:59 ` David Reitter
2005-12-25 16:54 ` Stefan Monnier
0 siblings, 1 reply; 71+ messages in thread
From: David Reitter @ 2005-12-24 22:59 UTC (permalink / raw)
Cc: Emacs-Devel '
On 24 Dec 2005, at 21:07, Juri Linkov wrote:
>> (This made sense in my own setup because I have advised switch-to-
>> buffer to show most buffers in a new frame, so I don't usually get
>> that error.)
>
> This looks like what `pop-up-frames' is intended for.
Doesn't open new frames when you find-file or, in general, during
switch-to-buffer.
Instead, it opens new frames for *Completions* etc, which is very
annoying and not what I find useful.
I want much more fine-control over what is opened where. I have a
mode called `one-buffer-one-frame' which will display newly visited
files in separate frames and generally create new frames for things,
with the exception of stuff like completions buffers or other
buffers, usually *...* ones. A more compatible way to do this (better
than to advise switch-to-buffer and use my own display-buffer
function) would be much appreciated, of course.
Besides, display-buffer is documented to show the buffer in a new
window without selecting it. When pop-up-frames is non-nil, it
creates a new frame, but selects it, which is annoying when you want
to, e.g. display a quick *Help* but keep working in the original
frame. The behavior seems to be pretty much against the spirit of
display-buffer, maybe you could consider it a bug... (maybe only in
the Carbon port, haven't checked this.) I remember reading somewhere
that the system may itself select new frames, and Emacs will accept
that. Fair enough, but I find my display-buffer function rather useful.
(defun aquamacs-display-buffer (&rest args)
(let ((display-buffer-function nil))
(if (and
one-buffer-one-frame
(open-in-other-frame-p (car args)))
(let ((pop-up-frames t)
(sframe (selected-frame))
(swin (selected-window)))
(let ((ret (apply (function display-buffer) args)))
;; make sure the old frame stays the selected one
(select-frame sframe)
(select-window swin)
ret))
(apply (function display-buffer) args))))
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-24 22:59 ` David Reitter
@ 2005-12-25 16:54 ` Stefan Monnier
0 siblings, 0 replies; 71+ messages in thread
From: Stefan Monnier @ 2005-12-25 16:54 UTC (permalink / raw)
Cc: Juri Linkov, Emacs-Devel '
>>> (This made sense in my own setup because I have advised switch-to-
>>> buffer to show most buffers in a new frame, so I don't usually get
>>> that error.)
>>
>> This looks like what `pop-up-frames' is intended for.
Except that switch-to-buffer doesn't pay attention to it. That's one of the
main reasons why switch-to-buffer should be avoided in elisp code and used
"only" via C-x b.
> I want much more fine-control over what is opened where. I have a mode
> called `one-buffer-one-frame' which will display newly visited files in
> separate frames and generally create new frames for things, with the
> exception of stuff like completions buffers or other buffers, usually *...*
> ones. A more compatible way to do this (better than to advise
> switch-to-buffer and use my own display-buffer function) would be much
> appreciated, of course.
For the switch-to-buffer advice, the only alternative I know is to fix the
source code :-(.
But in order to show *...* elsewhere, all you need should be something like
(add-to-list 'special-display-regexp '("\\*.*\\*" (same-frame . t)))
> Besides, display-buffer is documented to show the buffer in a new window
> without selecting it. When pop-up-frames is non-nil, it creates a new
> frame, but selects it, which is annoying when you want to, e.g. display
> a quick *Help* but keep working in the original frame.
That's a bug.
Stefan
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-24 12:15 ` David Reitter
2005-12-24 20:07 ` Juri Linkov
@ 2005-12-25 2:51 ` Richard M. Stallman
2005-12-25 6:44 ` Eli Zaretskii
` (3 more replies)
1 sibling, 4 replies; 71+ messages in thread
From: Richard M. Stallman @ 2005-12-25 2:51 UTC (permalink / raw)
Cc: juri, emacs-devel
But I would suggest improving find-file to catch the error in switch-
to-buffer and show the buffer in another window in that case, at
least when called interactively.
Why do you find it so often useful to invoke Find File
while you're in a minibuffer?
> (define-key menu-bar-edit-menu [bookmark]
> - '(menu-item "Bookmarks" menu-bar-bookmark-map
> + `(menu-item "Bookmarks" ,menu-bar-bookmark-map
> :help "Record positions and jump between them"))
Thanks for pointing this out, maybe that's a bug in the patch. Let's
leave this particular change out.
Now I understand the context of this question.
Amd I see that menu-bar-bookmark-map has a function
definition the same as its value--that is what makes it
work correctly to use the symbol instead of the map itself.
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-25 2:51 ` Richard M. Stallman
@ 2005-12-25 6:44 ` Eli Zaretskii
2005-12-26 2:19 ` Richard M. Stallman
2005-12-25 9:54 ` David Reitter
` (2 subsequent siblings)
3 siblings, 1 reply; 71+ messages in thread
From: Eli Zaretskii @ 2005-12-25 6:44 UTC (permalink / raw)
Cc: juri, david.reitter, emacs-devel
> From: "Richard M. Stallman" <rms@gnu.org>
> Date: Sat, 24 Dec 2005 21:51:22 -0500
> Cc: juri@jurta.org, emacs-devel@gnu.org
>
> But I would suggest improving find-file to catch the error in switch-
> to-buffer and show the buffer in another window in that case, at
> least when called interactively.
>
> Why do you find it so often useful to invoke Find File
> while you're in a minibuffer?
I think a more important question is why disable it, not why it could
be useful. Here's one situation where it could be useful to me.
Sometimes, when I type in the minibuffer, I need to consult some file.
If it's already in a displayed window, I can go there with "C-x o"
(important when the part I want to read is not in the displayed
portion), but if it isn't in any window, I have no way of looking at
it except abort whatever I'm doing in the minibuffer, which is
annoying.
I learned to live with that, but I'd certainly be happier if we lifted
that limitation.
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-25 6:44 ` Eli Zaretskii
@ 2005-12-26 2:19 ` Richard M. Stallman
2005-12-26 5:06 ` Eli Zaretskii
0 siblings, 1 reply; 71+ messages in thread
From: Richard M. Stallman @ 2005-12-26 2:19 UTC (permalink / raw)
Cc: juri, david.reitter, emacs-devel
The general reason to disable commands that use the minibuffer while
in the minibuffer is because recursive minibuffers got many users
confused. If you're an advanced user who won't get confused by
recursive minibuffers, you can set enable-recursive-minibuffers
to t, and enable them all the time.
So I don't see any reason why these specific commands should
be enabled in the minibuffer _for everyone_ including newbies.
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-26 2:19 ` Richard M. Stallman
@ 2005-12-26 5:06 ` Eli Zaretskii
0 siblings, 0 replies; 71+ messages in thread
From: Eli Zaretskii @ 2005-12-26 5:06 UTC (permalink / raw)
Cc: juri, david.reitter, emacs-devel
> From: "Richard M. Stallman" <rms@gnu.org>
> CC: david.reitter@gmail.com, juri@jurta.org, emacs-devel@gnu.org
> Date: Sun, 25 Dec 2005 21:19:31 -0500
>
> The general reason to disable commands that use the minibuffer while
> in the minibuffer is because recursive minibuffers got many users
> confused. If you're an advanced user who won't get confused by
> recursive minibuffers, you can set enable-recursive-minibuffers
> to t, and enable them all the time.
It goes without saying that I didn't mean to have those features
_unless_ enable-recursive-minibuffers is non-nil.
The problem is, even with enable-recursive-minibuffers, you cannot,
e.g., visit a file from within the minibuffer. You get the error
message described by Juri. You can try it like this:
emacs -q
M-x C-x C-f ~/.emacs RET
At this point Emacs signals an error: "Cannot switch buffers in
minibuffer window".
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-25 2:51 ` Richard M. Stallman
2005-12-25 6:44 ` Eli Zaretskii
@ 2005-12-25 9:54 ` David Reitter
2005-12-26 2:19 ` Richard M. Stallman
2005-12-25 16:58 ` Stefan Monnier
[not found] ` <87x6v29lvv.fsf-monnier+emacs@gnu.org>
3 siblings, 1 reply; 71+ messages in thread
From: David Reitter @ 2005-12-25 9:54 UTC (permalink / raw)
Cc: juri, emacs-devel
On 25 Dec 2005, at 03:51, Richard M. Stallman wrote:
> But I would suggest improving find-file to catch the error in
> switch-
> to-buffer and show the buffer in another window in that case, at
> least when called interactively.
>
> Why do you find it so often useful to invoke Find File
> while you're in a minibuffer?
Usually I have started something else which reads an argument in the
minibuffer, either in error or because I'd like to look up something
in another file in order to supply the right input. This applies to
invoking switch-to-buffer with the same reasoning -- you'd like to
look up something else.
WIthout having counted these cases, I'd say the majority of cases is
erroneous invoking of the first command that gets me to the
minibuffer. (Of course, I should do C-g, but that doesn't happen.)
That's why I've been looking for a way to enable "sequential" instead
of "recursive" minibuffers (see my recent message below).
Either method (switch-to-buffer using a different window if in
minibuffer and interactive, and: sequential minibuffers) address
similar situations and would be of benefit at least to the
inexperienced user.
Begin forwarded message:
From: david.reitter@gmail.com
Subject: Sequential instead of recursive minibuffers?
Date: 15 December 2005 20:02:28 GMT+01:00
To: Help-gnu-emacs@gnu.org
Is it possible to automatically signal a `quit' to the current
minibuffer prompt function when another minibuffer is set up?
We've had a discussion back in summer:
http://lists.gnu.org/archive/html/help-gnu-emacs/2005-07/msg00021.html
To explain this a little further: I can currently choose between
normal (simple) minibuffers and recursive minibuffers.
The difference is in the behavior if a user presses a key sequence
bound to an interactive command, sees the prompt and decides that it
was the wrong command. Now (without a C-g in between) he remembers
the correct command and enters that one.
The first option will always signal an error ("Command attempted to
use minibuffer while in minibuffer"), which is somewhat confusing and
certainly annoying to me. A couple of months ago, when I didn't know
anything about this minibuffer business, I was confused big time!
The "recursive minibuffer" setting will do just what it says - which
means that the old prompt will reappear as soon as the new command is
finished. This is equally confusing, in particular to new users. I
often get caught in situations where several minibuffers stack up and
I have to C-g several times to get out of the situation.
In the previously mentioned discussion, some UI-based workarounds
have been proposed (e.g. different colors depending on minibuffer
state).
What I'd like to configure in my Emacs is a sequential minibuffer: As
soon as I enter another interactive command, the currently running
one is quit. My first attempt at doing that was
(setq enable-recursive-minibuffers nil)
(add-hook 'minibuffer-setup-hook
'keyboard-quit)
which fails because `keyboard-quit' is, of course, executed in the
wrong context.
Again, the logic could be:
- if we're in an interactive command (call-interactively) that uses
the minibuffer (A)
- and another interactive is called (but not via a minibuffer-
specific keymap) which prompts for some input in the minibuffer (B)
then signal 'quit' to A and continue with B.
That way I can do M-x M-x ...., or something like C-x C-f di C-h
f ding RET (where I confused C-h f with C-x C-f) without any error
messages, without remaining minibuffers that I don't want and with
exactly the desired result.
I have no idea how to accomplish this -- any suggestions would be
appreciated.
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-25 9:54 ` David Reitter
@ 2005-12-26 2:19 ` Richard M. Stallman
0 siblings, 0 replies; 71+ messages in thread
From: Richard M. Stallman @ 2005-12-26 2:19 UTC (permalink / raw)
Cc: juri, emacs-devel
Is it possible to automatically signal a `quit' to the current
minibuffer prompt function when another minibuffer is set up?
That might be a good feature, especially for beginning users. It's
not straightforward to implement, since it would require a nonlocal
exit to the command loop, to exit the first minibuffer and the command
that invoked it, and after this it would be necessary to invoke the
second command again. But it should not be terribly hard.
We should not install this till after the release, but you could
write it now.
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-25 2:51 ` Richard M. Stallman
2005-12-25 6:44 ` Eli Zaretskii
2005-12-25 9:54 ` David Reitter
@ 2005-12-25 16:58 ` Stefan Monnier
[not found] ` <87x6v29lvv.fsf-monnier+emacs@gnu.org>
3 siblings, 0 replies; 71+ messages in thread
From: Stefan Monnier @ 2005-12-25 16:58 UTC (permalink / raw)
Cc: juri, David Reitter, emacs-devel
> But I would suggest improving find-file to catch the error in switch-
> to-buffer and show the buffer in another window in that case, at
> least when called interactively.
> Why do you find it so often useful to invoke Find File
> while you're in a minibuffer?
Because I configure my Emacs similarly to what Epoch used to do. So when
I start Emacs, I only get a one-line frame holding the minibuffer. And even
later on when "real frames" are open (without their own minibuffer) they may
be hidden or iconified, wheres my minibuffer-only-frame is always-on-top at
the bottom of my display.
Other cases of errors is when I use C-x C-f from a dedicated window/frame.
Stefan
^ permalink raw reply [flat|nested] 71+ messages in thread
[parent not found: <87x6v29lvv.fsf-monnier+emacs@gnu.org>]
* Re: menu-bar: disable items when no frame visible
[not found] ` <87x6v29lvv.fsf-monnier+emacs@gnu.org>
@ 2005-12-26 2:20 ` Richard M. Stallman
2005-12-26 16:02 ` Stefan Monnier
0 siblings, 1 reply; 71+ messages in thread
From: Richard M. Stallman @ 2005-12-26 2:20 UTC (permalink / raw)
Cc: juri, david.reitter, emacs-devel
Because I configure my Emacs similarly to what Epoch used to do. So when
I start Emacs, I only get a one-line frame holding the minibuffer.
Would simply enabling recursive minibuffers give you what you want?
It occurs to me that in this kind of configuration, though you usually
see the minibuffer frame, the minibuffer is not active. Do minibuffer
commands give you an error when you run them in the minibuffer frame
while the minibuffer is not active?
Other cases of errors is when I use C-x C-f from a dedicated window/frame.
That is a completely different issue. You won't get an error entering
the file name in the minibuffer. You will get an error trying to
display a different buffer in that dedicated window.
For now, the solution is to use C-x 4 f or C-x 5 f.
After the release we could think about whether commands to
switch buffers should treat dedicated windows differently.
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-26 2:20 ` Richard M. Stallman
@ 2005-12-26 16:02 ` Stefan Monnier
2005-12-26 21:56 ` Richard M. Stallman
0 siblings, 1 reply; 71+ messages in thread
From: Stefan Monnier @ 2005-12-26 16:02 UTC (permalink / raw)
Cc: juri, david.reitter, emacs-devel
> Because I configure my Emacs similarly to what Epoch used to do. So when
> I start Emacs, I only get a one-line frame holding the minibuffer.
> Would simply enabling recursive minibuffers give you what you want?
enable-recursive-minibuffers has nothing to do with the problem.
> Other cases of errors is when I use C-x C-f from a dedicated window/frame.
> That is a completely different issue.
No, it's the exact same issue. `switch-to-buffer' fails in those two cases:
when the selected window is a minibuffer window, and when it is
a dedicated window.
As Eli points out in another message, you misunderstood the problem
described by Juri.
Stefan
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-26 16:02 ` Stefan Monnier
@ 2005-12-26 21:56 ` Richard M. Stallman
2005-12-27 19:01 ` Juri Linkov
0 siblings, 1 reply; 71+ messages in thread
From: Richard M. Stallman @ 2005-12-26 21:56 UTC (permalink / raw)
Cc: juri, david.reitter, emacs-devel
As Eli points out in another message, you misunderstood the problem
described by Juri.
The question that I'm talking about is why two specific commands have
a property to let them invoke recursive minibuffers, and whether there
is a reason it should be so. Reitter, I think, raised that question.
Another question is whether find-file should do something different
if it cannot display the buffer in the selected window.
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-23 20:43 ` Juri Linkov
2005-12-24 12:15 ` David Reitter
@ 2005-12-24 16:32 ` Richard M. Stallman
2005-12-24 20:12 ` Juri Linkov
1 sibling, 1 reply; 71+ messages in thread
From: Richard M. Stallman @ 2005-12-24 16:32 UTC (permalink / raw)
Cc: david.reitter, emacs-devel
1. What is the purpose of adding the condition `enable-recursive-minibuffers'
to `:enable' of "Visit New File..." and "Open File..."?
I am not sure.
2. Why keymap variables are replaced with their values at the moment
of adding a menu item? I.e. what changes like the following achieve?
(define-key menu-bar-edit-menu [bookmark]
- '(menu-item "Bookmarks" menu-bar-bookmark-map
+ `(menu-item "Bookmarks" ,menu-bar-bookmark-map
:help "Record positions and jump between them"))
I think a symbol in such a position means to use its function
definition, not its value. Thus, unless I am misremembering, the
first version would not work at all. Was it ever really in use?
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-12-24 16:32 ` Richard M. Stallman
@ 2005-12-24 20:12 ` Juri Linkov
0 siblings, 0 replies; 71+ messages in thread
From: Juri Linkov @ 2005-12-24 20:12 UTC (permalink / raw)
Cc: david.reitter, emacs-devel
> 2. Why keymap variables are replaced with their values at the moment
> of adding a menu item? I.e. what changes like the following achieve?
>
> (define-key menu-bar-edit-menu [bookmark]
> - '(menu-item "Bookmarks" menu-bar-bookmark-map
> + `(menu-item "Bookmarks" ,menu-bar-bookmark-map
> :help "Record positions and jump between them"))
>
> I think a symbol in such a position means to use its function
> definition, not its value. Thus, unless I am misremembering, the
> first version would not work at all. Was it ever really in use?
Actually, both versions work correctly. I guess the first version works
because menu operations can read the value of the map variable, and the
second version works because functions that modify the menu operate
directly on the Lisp structure by modifying its cells. I don't know
which of these two variants is more preferable.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-11-10 15:57 menu-bar: disable items when no frame visible David Reitter
2005-11-10 16:03 ` David Reitter
@ 2005-11-10 19:34 ` Eli Zaretskii
2005-11-10 19:39 ` David Reitter
2005-11-28 20:23 ` Juri Linkov
2 siblings, 1 reply; 71+ messages in thread
From: Eli Zaretskii @ 2005-11-10 19:34 UTC (permalink / raw)
Cc: emacs-devel
> From: David Reitter <david.reitter@gmail.com>
> Date: Thu, 10 Nov 2005 15:57:23 +0000
>
> This patch ensures that menu items are disabled when they should be,
> i.e. when there is no applicable visible and non-iconified frame.
Could you explain why this is needed? If there's no visible frame,
the menu isn't visible as well, so no one will notice that the menu
items are enabled.
Or am I missing something?
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-11-10 19:34 ` Eli Zaretskii
@ 2005-11-10 19:39 ` David Reitter
2005-11-11 8:33 ` Eli Zaretskii
0 siblings, 1 reply; 71+ messages in thread
From: David Reitter @ 2005-11-10 19:39 UTC (permalink / raw)
Cc: emacs-devel
[-- Attachment #1.1: Type: text/plain, Size: 638 bytes --]
On 10 Nov 2005, at 19:34, Eli Zaretskii wrote:
>> This patch ensures that menu items are disabled when they should be,
>> i.e. when there is no applicable visible and non-iconified frame.
>
> Could you explain why this is needed? If there's no visible frame,
> the menu isn't visible as well, so no one will notice that the menu
> items are enabled.
>
> Or am I missing something?
Yes you are :)
Menus are not always inside frames. On my machine, they're on top and
perfectly accessible when there is no window...
I think we already have a few frame-live-p/frame-visible-p checks in
menu-bar, they're just not very complete.
- D
[-- Attachment #1.2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 2400 bytes --]
[-- Attachment #2: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-11-10 19:39 ` David Reitter
@ 2005-11-11 8:33 ` Eli Zaretskii
2005-11-12 3:38 ` Richard M. Stallman
0 siblings, 1 reply; 71+ messages in thread
From: Eli Zaretskii @ 2005-11-11 8:33 UTC (permalink / raw)
Cc: emacs-devel
> Cc: emacs-devel@gnu.org
> From: David Reitter <david.reitter@gmail.com>
> Date: Thu, 10 Nov 2005 19:39:08 +0000
>
> Menus are not always inside frames. On my machine, they're on top and
> perfectly accessible when there is no window...
Really? What OS and windows manager is that, and what toolkit was used
to build Emacs?
> I think we already have a few frame-live-p/frame-visible-p checks in
> menu-bar, they're just not very complete.
Those checks are for completely different situations. For example, if
there's only one frame, the "Delete Frame" item in the File menu
should be disabled.
In your case, you wrote:
> In a lot of cases, one could do "insert file" or choose stuff from
> the "search" menu even if there were only iconified or hidden frames.
What is wrong with this? If the Emacs menu bar is visible even if no
frame is, why is it bad that the user can insert a file?
Also, if one clicks on the menu, on the system such as yours,
shouldn't one of the Emacs frame be automatically raised?
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-11-11 8:33 ` Eli Zaretskii
@ 2005-11-12 3:38 ` Richard M. Stallman
0 siblings, 0 replies; 71+ messages in thread
From: Richard M. Stallman @ 2005-11-12 3:38 UTC (permalink / raw)
Cc: david.reitter, emacs-devel
> In a lot of cases, one could do "insert file" or choose stuff from
> the "search" menu even if there were only iconified or hidden frames.
What is wrong with this? If the Emacs menu bar is visible even if no
frame is, why is it bad that the user can insert a file?
It would be very confusing to insert a file when yo don't
see the buffer it would be inserted in.
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-11-10 15:57 menu-bar: disable items when no frame visible David Reitter
2005-11-10 16:03 ` David Reitter
2005-11-10 19:34 ` Eli Zaretskii
@ 2005-11-28 20:23 ` Juri Linkov
2005-11-28 22:17 ` David Reitter
2005-11-29 3:10 ` Richard M. Stallman
2 siblings, 2 replies; 71+ messages in thread
From: Juri Linkov @ 2005-11-28 20:23 UTC (permalink / raw)
Cc: emacs-devel
> This patch ensures that menu items are disabled when they should be,
> i.e. when there is no applicable visible and non-iconified frame.
> In a lot of cases, one could do "insert file" or choose stuff from
> the "search" menu even if there were only iconified or hidden frames.
Instead of disabling some menu items one by one, wouldn't it be better
to disable all menu items if the frame attached to the menu is not visible.
Operating on non-visible frames from the visible menu is not only confusing,
but might be dangerous.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-11-28 20:23 ` Juri Linkov
@ 2005-11-28 22:17 ` David Reitter
2005-11-28 22:44 ` Juri Linkov
2005-11-29 3:10 ` Richard M. Stallman
1 sibling, 1 reply; 71+ messages in thread
From: David Reitter @ 2005-11-28 22:17 UTC (permalink / raw)
Cc: emacs-devel
On 28 Nov 2005, at 20:23, Juri Linkov wrote:
>> This patch ensures that menu items are disabled when they should be,
>> i.e. when there is no applicable visible and non-iconified frame.
>> In a lot of cases, one could do "insert file" or choose stuff from
>> the "search" menu even if there were only iconified or hidden frames.
>
> Instead of disabling some menu items one by one, wouldn't it be better
> to disable all menu items if the frame attached to the menu is not
> visible.
> Operating on non-visible frames from the visible menu is not only
> confusing,
> but might be dangerous.
Err, what menu is shown when there is no visible frame?
(Recall what the OS X desktop looks like.)
- D
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-11-28 22:17 ` David Reitter
@ 2005-11-28 22:44 ` Juri Linkov
2005-11-29 0:08 ` David Reitter
2005-11-29 9:02 ` Juri Linkov
0 siblings, 2 replies; 71+ messages in thread
From: Juri Linkov @ 2005-11-28 22:44 UTC (permalink / raw)
Cc: emacs-devel
>> Instead of disabling some menu items one by one, wouldn't it be
>> better to disable all menu items if the frame attached to the menu
>> is not visible. Operating on non-visible frames from the visible
>> menu is not only confusing, but might be dangerous.
>
> Err, what menu is shown when there is no visible frame?
In GTK builds it is possible to detach the toolbar, menu or submenu
from the frame. After iconifying the frame, the floating menu is
still shown.
> (Recall what the OS X desktop looks like.)
I see this is not possible on OS X. But then I wonder why do you make
more menu items disabled for non-visible frames in your patch, if on
OS X, where the menu bar always applies to the selected frame, there is
no way to have a menu with disabled items?
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-11-28 22:44 ` Juri Linkov
@ 2005-11-29 0:08 ` David Reitter
2005-11-29 9:03 ` Juri Linkov
2005-11-29 9:02 ` Juri Linkov
1 sibling, 1 reply; 71+ messages in thread
From: David Reitter @ 2005-11-29 0:08 UTC (permalink / raw)
Cc: emacs-devel
On 28 Nov 2005, at 22:44, Juri Linkov wrote:
>>
>> (Recall what the OS X desktop looks like.)
>
> I see this is not possible on OS X. But then I wonder why do you make
> more menu items disabled for non-visible frames in your patch, if on
> OS X, where the menu bar always applies to the selected frame,
> there is
> no way to have a menu with disabled items?
The menu-bar doesn't go away when no frame is shown. It is still
there, showing the state of the selected frame (even though it is
hidden).
And you need the menu bar in this situation, because might need to
open a file from the File menu, for example. On most other systems
that I know, the application is quit when you close the last window -
that is logical because there would be no way to show the menu. That
is not the case in general for apps on the Mac. Now, Emacs still
quits when you close the last frame. But you can hide it (or minimize
it) just fine. That's when you have the menu with the disabled items.
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-11-29 0:08 ` David Reitter
@ 2005-11-29 9:03 ` Juri Linkov
0 siblings, 0 replies; 71+ messages in thread
From: Juri Linkov @ 2005-11-29 9:03 UTC (permalink / raw)
Cc: emacs-devel
> The menu-bar doesn't go away when no frame is shown. It is still
> there, showing the state of the selected frame (even though it is
> hidden).
>
> And you need the menu bar in this situation, because might need to
> open a file from the File menu, for example. On most other systems
> that I know, the application is quit when you close the last window -
> that is logical because there would be no way to show the
> menu. That is not the case in general for apps on the Mac.
I guess if it would be possible to close the last frame, there should
be fewer menu items enabled than when the last frame is minimized,
because in the minimized frame there is the current buffer, but not
in the closed frame. Only menu items that create a new buffer should
be enabled in the closed frame.
> Now, Emacs still quits when you close the last frame. But you can
> hide it (or minimize it) just fine. That's when you have the menu
> with the disabled items.
This is somehow similar to GTK where the last frame can be minimized
but the tool bar is still visible.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-11-28 22:44 ` Juri Linkov
2005-11-29 0:08 ` David Reitter
@ 2005-11-29 9:02 ` Juri Linkov
1 sibling, 0 replies; 71+ messages in thread
From: Juri Linkov @ 2005-11-29 9:02 UTC (permalink / raw)
Cc: emacs-devel
>>> Instead of disabling some menu items one by one, wouldn't it be
>>> better to disable all menu items if the frame attached to the menu
>>> is not visible. Operating on non-visible frames from the visible
>>> menu is not only confusing, but might be dangerous.
>>
>> Err, what menu is shown when there is no visible frame?
>
> In GTK builds it is possible to detach the toolbar, menu or submenu
> from the frame. After iconifying the frame, the floating menu is
> still shown.
I want to clarify: when the frame is minimized in GTK, all its detached
menus are minimized as well, but not the tool bar. The floating tool bar
is still shown when its frame is not visible. I don't know is it
possible to keep detached menus visible with the iconified frame with
some configuration, but the detached tool bar with the hidden frame is
what I can see in the GTK Emacs build.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-11-28 20:23 ` Juri Linkov
2005-11-28 22:17 ` David Reitter
@ 2005-11-29 3:10 ` Richard M. Stallman
2005-11-29 9:01 ` Juri Linkov
1 sibling, 1 reply; 71+ messages in thread
From: Richard M. Stallman @ 2005-11-29 3:10 UTC (permalink / raw)
Cc: david.reitter, emacs-devel
Instead of disabling some menu items one by one, wouldn't it be better
to disable all menu items if the frame attached to the menu is not visible.
Operating on non-visible frames from the visible menu is not only confusing,
but might be dangerous.
That is right in general, but there might be some specific things,
such as finding a file, that are safe even when the frame is not
visible. Especially if that command wil make the frame appear.
^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: menu-bar: disable items when no frame visible
2005-11-29 3:10 ` Richard M. Stallman
@ 2005-11-29 9:01 ` Juri Linkov
2005-11-29 21:47 ` Richard M. Stallman
0 siblings, 1 reply; 71+ messages in thread
From: Juri Linkov @ 2005-11-29 9:01 UTC (permalink / raw)
Cc: david.reitter, emacs-devel
> Instead of disabling some menu items one by one, wouldn't it be better
> to disable all menu items if the frame attached to the menu is not visible.
> Operating on non-visible frames from the visible menu is not only confusing,
> but might be dangerous.
>
> That is right in general, but there might be some specific things,
> such as finding a file, that are safe even when the frame is not
> visible.
Wouldn't it be easier to enable some safe menu items in the completely
disabled menu, than to disable dangerous/inappropriate menu items in the
menu where all menu items are enabled by default.
> Especially if that command will make the frame appear.
I think this is an essential requirement. Currently a command called
from the menu doesn't make the frame appear.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 71+ messages in thread
end of thread, other threads:[~2005-12-27 19:55 UTC | newest]
Thread overview: 71+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-10 15:57 menu-bar: disable items when no frame visible David Reitter
2005-11-10 16:03 ` David Reitter
2005-11-10 21:12 ` David Reitter
2005-11-12 3:38 ` Richard M. Stallman
2005-11-12 7:11 ` Eli Zaretskii
2005-11-12 21:21 ` Richard M. Stallman
2005-11-12 22:44 ` Eli Zaretskii
2005-11-28 0:21 ` David Reitter
2005-11-28 5:32 ` Eli Zaretskii
2005-11-28 20:23 ` Juri Linkov
2005-11-28 21:00 ` Richard M. Stallman
2005-11-28 22:20 ` David Reitter
2005-11-28 22:46 ` Jason Rumney
2005-11-29 10:32 ` Reiner Steib
2005-11-29 21:48 ` Richard M. Stallman
2005-12-06 0:54 ` Juri Linkov
2005-12-06 16:43 ` Richard M. Stallman
2005-12-07 0:45 ` Juri Linkov
2005-12-07 22:58 ` Richard M. Stallman
2005-12-12 8:23 ` Jan D.
2005-12-12 21:14 ` Eli Zaretskii
2005-12-13 7:19 ` Jan Djärv
2005-12-13 20:24 ` Eli Zaretskii
2005-12-14 17:03 ` Juri Linkov
2005-12-14 19:25 ` Eli Zaretskii
2005-12-16 9:04 ` Juri Linkov
2005-12-16 11:29 ` Eli Zaretskii
2005-12-16 12:55 ` Juri Linkov
2005-12-16 13:14 ` Eli Zaretskii
2005-12-16 14:27 ` Juri Linkov
2005-12-16 15:24 ` Eli Zaretskii
2005-12-17 10:54 ` Juri Linkov
2005-12-14 21:25 ` Drew Adams
2005-12-15 4:33 ` Eli Zaretskii
2005-12-13 3:15 ` Richard M. Stallman
2005-12-16 9:05 ` Juri Linkov
2005-12-16 17:40 ` Jan Djärv
2005-12-17 10:47 ` Juri Linkov
2005-12-20 21:55 ` Juri Linkov
2005-12-23 20:43 ` Juri Linkov
2005-12-24 12:15 ` David Reitter
2005-12-24 20:07 ` Juri Linkov
2005-12-24 22:59 ` David Reitter
2005-12-25 16:54 ` Stefan Monnier
2005-12-25 2:51 ` Richard M. Stallman
2005-12-25 6:44 ` Eli Zaretskii
2005-12-26 2:19 ` Richard M. Stallman
2005-12-26 5:06 ` Eli Zaretskii
2005-12-25 9:54 ` David Reitter
2005-12-26 2:19 ` Richard M. Stallman
2005-12-25 16:58 ` Stefan Monnier
[not found] ` <87x6v29lvv.fsf-monnier+emacs@gnu.org>
2005-12-26 2:20 ` Richard M. Stallman
2005-12-26 16:02 ` Stefan Monnier
2005-12-26 21:56 ` Richard M. Stallman
2005-12-27 19:01 ` Juri Linkov
2005-12-27 19:55 ` Stefan Monnier
2005-12-24 16:32 ` Richard M. Stallman
2005-12-24 20:12 ` Juri Linkov
2005-11-10 19:34 ` Eli Zaretskii
2005-11-10 19:39 ` David Reitter
2005-11-11 8:33 ` Eli Zaretskii
2005-11-12 3:38 ` Richard M. Stallman
2005-11-28 20:23 ` Juri Linkov
2005-11-28 22:17 ` David Reitter
2005-11-28 22:44 ` Juri Linkov
2005-11-29 0:08 ` David Reitter
2005-11-29 9:03 ` Juri Linkov
2005-11-29 9:02 ` Juri Linkov
2005-11-29 3:10 ` Richard M. Stallman
2005-11-29 9:01 ` Juri Linkov
2005-11-29 21:47 ` Richard M. Stallman
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).