aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaroly Lorentey2006-03-26 14:20:01 +0000
committerKaroly Lorentey2006-03-26 14:20:01 +0000
commit6a5af08f8d3bb831a78edf17e9c38813bbfbb6f8 (patch)
treee4e263c9e6cc2f9310c9d1954eb016b0b7f2c22b
parent095fe28140411c14e1e77d6c076655c06ca191a9 (diff)
downloademacs-6a5af08f8d3bb831a78edf17e9c38813bbfbb6f8.tar.gz
emacs-6a5af08f8d3bb831a78edf17e9c38813bbfbb6f8.zip
Fix tool-bar and menu-bar toggles in Show/Hide menu to reflect the state of the current frame.
* lisp/tool-bar.el (toggle-tool-bar-mode-from-frame): New function. * lisp/menu-bar.el (toggle-menu-bar-mode-from-frame): New function. (menu-bar-showhide-menu): Use them to change "Menu-bar" and "Tool-bar" toggles to reflect the state of the current frame. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-537
-rw-r--r--README.multi-tty24
-rw-r--r--lisp/menu-bar.el18
-rw-r--r--lisp/tool-bar.el10
3 files changed, 36 insertions, 16 deletions
diff --git a/README.multi-tty b/README.multi-tty
index 2ac27bafe55..442c4c92fd2 100644
--- a/README.multi-tty
+++ b/README.multi-tty
@@ -404,17 +404,6 @@ is probably not very interesting for anyone else.)
404THINGS TO DO 404THINGS TO DO
405------------ 405------------
406 406
407** `tool-bar-mode', `scroll-bar-mode', `menu-bar-mode' and
408 'fringe-mode' are modes global to the entire Emacs session, not
409 just a single frame or a single terminal. This means that their
410 status sometimes differs from what's actually displayed on the
411 screen. As a consequence, the Options | Show/Hide menu sometimes
412 shows incorrect status, and you have to select an option twice for
413 it to have any visible effect on the current frame.
414
415 Change Emacs so that the status of the items in the Options |
416 Show/Hide menu correspond to the current frame.
417
418** emacsclient -t on the console does not work after su: 407** emacsclient -t on the console does not work after su:
419 408
420 # su lorentey 409 # su lorentey
@@ -1485,5 +1474,18 @@ DIARY OF CHANGES
1485 1474
1486 (Done in patch-500.) 1475 (Done in patch-500.)
1487 1476
1477-- `tool-bar-mode', `scroll-bar-mode', `menu-bar-mode' and
1478 'fringe-mode' are modes global to the entire Emacs session, not
1479 just a single frame or a single terminal. This means that their
1480 status sometimes differs from what's actually displayed on the
1481 screen. As a consequence, the Options | Show/Hide menu sometimes
1482 shows incorrect status, and you have to select an option twice for
1483 it to have any visible effect on the current frame.
1484
1485 Change Emacs so that the status of the items in the Options |
1486 Show/Hide menu correspond to the current frame.
1487
1488 (Done in patch-537.)
1489
1488;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d 1490;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d
1489 1491
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 75d68d0baad..a9987d589fd 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -935,15 +935,15 @@ mail status in mode line"))
935 :button `(:toggle . tooltip-mode))) 935 :button `(:toggle . tooltip-mode)))
936 936
937(define-key menu-bar-showhide-menu [menu-bar-mode] 937(define-key menu-bar-showhide-menu [menu-bar-mode]
938 '(menu-item "Menu-bar" menu-bar-mode 938 '(menu-item "Menu-bar" toggle-menu-bar-mode-from-frame
939 :help "Toggle menu-bar on/off" 939 :help "Toggle menu-bar on/off"
940 :button (:toggle . menu-bar-mode))) 940 :button (:toggle . (> (frame-parameter nil 'menu-bar-lines) 0))))
941 941
942(define-key menu-bar-showhide-menu [showhide-tool-bar] 942(define-key menu-bar-showhide-menu [showhide-tool-bar]
943 (list 'menu-item "Tool-bar" 'tool-bar-mode 943 (list 'menu-item "Tool-bar" 'toggle-tool-bar-mode-from-frame
944 :help "Turn tool-bar on/off" 944 :help "Toggle tool-bar on/off"
945 :visible `(display-graphic-p) 945 :visible `(display-graphic-p)
946 :button `(:toggle . tool-bar-mode))) 946 :button `(:toggle . (> (frame-parameter nil 'tool-bar-lines) 0))))
947 947
948(define-key menu-bar-options-menu [showhide] 948(define-key menu-bar-options-menu [showhide]
949 (list 'menu-item "Show/Hide" menu-bar-showhide-menu 949 (list 'menu-item "Show/Hide" menu-bar-showhide-menu
@@ -1778,6 +1778,14 @@ turn on menu bars; otherwise, turn off menu bars."
1778 "Menu-bar mode disabled. Use M-x menu-bar-mode to make the menu bar appear.")) 1778 "Menu-bar mode disabled. Use M-x menu-bar-mode to make the menu bar appear."))
1779 menu-bar-mode) 1779 menu-bar-mode)
1780 1780
1781(defun toggle-menu-bar-mode-from-frame (&optional arg)
1782 "Toggle menu bar on or off, based on the status of the current frame.
1783See `menu-bar-mode' for more information."
1784 (interactive (list (or current-prefix-arg 'toggle)))
1785 (if (eq arg 'toggle)
1786 (menu-bar-mode (if (> (frame-parameter nil 'menu-bar-lines) 0) 0 1))
1787 (menu-bar-mode arg)))
1788
1781(provide 'menu-bar) 1789(provide 'menu-bar)
1782 1790
1783;;; arch-tag: 6e6a3c22-4ec4-4d3d-8190-583f8ef94ced 1791;;; arch-tag: 6e6a3c22-4ec4-4d3d-8190-583f8ef94ced
diff --git a/lisp/tool-bar.el b/lisp/tool-bar.el
index be552854b13..023b90af5d9 100644
--- a/lisp/tool-bar.el
+++ b/lisp/tool-bar.el
@@ -62,6 +62,16 @@ conveniently adding tool bar items."
62 (tool-bar-setup)))) 62 (tool-bar-setup))))
63 63
64;;;###autoload 64;;;###autoload
65;; Used in the Show/Hide menu, to have the toggle reflect the current frame.
66(defun toggle-tool-bar-mode-from-frame (&optional arg)
67 "Toggle tool bar on or off, based on the status of the current frame.
68See `tool-bar-mode' for more information."
69 (interactive (list (or current-prefix-arg 'toggle)))
70 (if (eq arg 'toggle)
71 (tool-bar-mode (if (> (frame-parameter nil 'tool-bar-lines) 0) 0 1))
72 (tool-bar-mode arg)))
73
74;;;###autoload
65;; We want to pretend the toolbar by standard is on, as this will make 75;; We want to pretend the toolbar by standard is on, as this will make
66;; customize consider disabling the toolbar a customization, and save 76;; customize consider disabling the toolbar a customization, and save
67;; that. We could do this for real by setting :init-value above, but 77;; that. We could do this for real by setting :init-value above, but