unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#27047: 26.0.50; Scroll bar menu UI glitches [patch]
@ 2017-05-23 21:08 Stephen Berman
  2017-05-24  6:15 ` martin rudalics
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Berman @ 2017-05-23 21:08 UTC (permalink / raw)
  To: 27047

[-- Attachment #1: Type: text/plain, Size: 1403 bytes --]

The Options->Show/Hide->Scroll-bar menu functions correctly -- when you
press any of the five radio buttons, the result is what it should be --
but the UI is broken.  With -Q the vertical scroll bar is on the right,
there is no horizontal scroll bar and the menu shows the radio button
"None-horizontal" [sic] pressed.  If you press any of the other buttons
in that menu, the scroll bars change accordingly, but the menu continues
to show the same "None-horizontal" button pressed.  The attached patch
fixes this UI glitch.  In addition, I find the current scroll bar menu
somewhat incoherent and the patch offers an improvement (IMO): the radio
buttons are confined to the vertical scroll bar, and the two buttons for
the horizontal scroll bar are replaced by a single check box toggle, and
a separator is added to visually emphasize that two UI components are
involved.

While I was looking at the Show/Hide menu, I noticed that the spelling
there is not consistent with the convention of the Emacs manual, which
uses "scroll bar", "tool bar" and "menu bar" without hyphenation.  So
the patch changes the spelling of these in the menu and tooltips too.

In GNU Emacs 26.0.50 (build 19, x86_64-pc-linux-gnu, GTK+ Version 3.22.8)
 of 2017-05-22 built on rosalinde
Repository revision: bc78276e81956b3caa8a5eb7ef26959fa4c84b7b
Windowing system distributor 'The X.Org Foundation', version 11.0.11901000



[-- Attachment #2: ChangeLog entry --]
[-- Type: text/plain, Size: 685 bytes --]

2017-05-23  Stephen Berman  <Stephen.Berman@gmx.net>

	Fix and improve UI of scroll bar menu

        In addition, since the Emacs manual writes "scroll bar", "tool
	bar" and "menu bar", use this convention in the Show/Hide menues
	and tooltips as well.

	* lisp/menu-bar.el (menu-bar-showhide-scroll-bar-menu): Make
	pressing a radio button in the menu actually show that it was
	pressed.  Replace the two radio buttons to turn the horizontal
	scroll bar on and off with a single check-box toggle and add a
	separator between this and the vertical scroll bar radio
	buttons.
	(menu-bar-showhide-tool-bar-menu):
	(menu-bar-showhide-menu):
	(menu-bar-mode): Use conventional spelling.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: Show/Hide menu patch --]
[-- Type: text/x-patch, Size: 8554 bytes --]

diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 6befa6d234..c8eb565942 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -981,43 +981,39 @@ menu-bar-no-horizontal-scroll-bar
   (customize-set-variable 'horizontal-scroll-bar-mode nil))
 
 (defvar menu-bar-showhide-scroll-bar-menu
-  (let ((menu (make-sparse-keymap "Scroll-bar"))
-        (vsb (frame-parameter nil 'vertical-scroll-bars))
-        (hsb (frame-parameter nil 'horizontal-scroll-bars)))
+  (let ((menu (make-sparse-keymap "Scroll Bar")))
+
     (bindings--define-key menu [horizontal]
-      `(menu-item "Horizontal"
-                  menu-bar-horizontal-scroll-bar
-                  :help "Horizontal scroll bar"
-                  :visible (horizontal-scroll-bars-available-p)
-                  :button (:radio . ,hsb)))
-
-    (bindings--define-key menu [none-horizontal]
-      `(menu-item "None-horizontal"
-                  menu-bar-no-horizontal-scroll-bar
-                  :help "Turn off horizontal scroll bars"
-                  :visible (horizontal-scroll-bars-available-p)
-                  :button (:radio . (not ,hsb))))
+      (menu-bar-make-mm-toggle horizontal-scroll-bar-mode
+                               "Horizontal"
+                               "Horizontal scroll bar"))
+
+    (bindings--define-key menu [scrollbar-separator]
+      menu-bar-separator)
 
     (bindings--define-key menu [right]
-      `(menu-item "On the Right"
-                  menu-bar-right-scroll-bar
-                  :help "Scroll-bar on the right side"
+      '(menu-item "On the Right" menu-bar-right-scroll-bar
+                  :help "Scroll bar on the right side"
                   :visible (display-graphic-p)
-                  :button (:radio . (eq ,vsb 'right))))
+                  :button (:radio . (and scroll-bar-mode
+                                         (eq (frame-parameter
+                                              nil 'vertical-scroll-bars)
+                                             'right)))))
 
     (bindings--define-key menu [left]
-      `(menu-item "On the Left"
-                  menu-bar-left-scroll-bar
-                  :help "Scroll-bar on the left side"
+      '(menu-item "On the Left" menu-bar-left-scroll-bar
+                  :help "Scroll bar on the left side"
                   :visible (display-graphic-p)
-                  :button (:radio . (eq ,vsb 'left))))
+                  :button (:radio . (and scroll-bar-mode
+                                         (eq (frame-parameter
+                                              nil 'vertical-scroll-bars)
+                                             'left)))))
 
     (bindings--define-key menu [none]
-      `(menu-item "None"
-                  menu-bar-no-scroll-bar
-                  :help "Turn off scroll-bar"
+      '(menu-item "No Vertical Scroll Bar" menu-bar-no-scroll-bar
+                  :help "Turn off vertical scroll bar"
                   :visible (display-graphic-p)
-                  :button (:radio . (not ,vsb))))
+                  :button (:radio . (eq scroll-bar-mode nil))))
     menu))
 
 (defun menu-bar-frame-for-menubar ()
@@ -1057,24 +1053,24 @@ menu-bar-showhide-tool-bar-menu-customize-enable-bottom
 
 (when (featurep 'move-toolbar)
   (defvar menu-bar-showhide-tool-bar-menu
-    (let ((menu (make-sparse-keymap "Tool-bar")))
+    (let ((menu (make-sparse-keymap "Tool Bar")))
 
       (bindings--define-key menu [showhide-tool-bar-left]
         '(menu-item "On the Left"
                     menu-bar-showhide-tool-bar-menu-customize-enable-left
-                    :help "Tool-bar at the left side"
+                    :help "Tool bar at the left side"
                     :visible (display-graphic-p)
                     :button
                     (:radio . (and tool-bar-mode
-                                   (eq (frame-parameter
+                                   (frame-parameter
                                         (menu-bar-frame-for-menubar)
                                         'tool-bar-position)
-                                       'left)))))
+                                       'left))))
 
       (bindings--define-key menu [showhide-tool-bar-right]
         '(menu-item "On the Right"
                     menu-bar-showhide-tool-bar-menu-customize-enable-right
-                    :help "Tool-bar at the right side"
+                    :help "Tool bar at the right side"
                     :visible (display-graphic-p)
                     :button
                     (:radio . (and tool-bar-mode
@@ -1086,7 +1082,7 @@ menu-bar-showhide-tool-bar-menu-customize-enable-bottom
       (bindings--define-key menu [showhide-tool-bar-bottom]
         '(menu-item "On the Bottom"
                     menu-bar-showhide-tool-bar-menu-customize-enable-bottom
-                    :help "Tool-bar at the bottom"
+                    :help "Tool bar at the bottom"
                     :visible (display-graphic-p)
                     :button
                     (:radio . (and tool-bar-mode
@@ -1098,7 +1094,7 @@ menu-bar-showhide-tool-bar-menu-customize-enable-bottom
       (bindings--define-key menu [showhide-tool-bar-top]
         '(menu-item "On the Top"
                     menu-bar-showhide-tool-bar-menu-customize-enable-top
-                    :help "Tool-bar at the top"
+                    :help "Tool bar at the top"
                     :visible (display-graphic-p)
                     :button
                     (:radio . (and tool-bar-mode
@@ -1110,7 +1106,7 @@ menu-bar-showhide-tool-bar-menu-customize-enable-bottom
       (bindings--define-key menu [showhide-tool-bar-none]
         '(menu-item "None"
                     menu-bar-showhide-tool-bar-menu-customize-disable
-                    :help "Turn tool-bar off"
+                    :help "Turn tool bar off"
                     :visible (display-graphic-p)
                     :button (:radio . (eq tool-bar-mode nil))))
       menu)))
@@ -1168,7 +1164,7 @@ menu-bar-showhide-menu
                   :visible (display-graphic-p)))
 
     (bindings--define-key menu [showhide-scroll-bar]
-      `(menu-item "Scroll-bar" ,menu-bar-showhide-scroll-bar-menu
+      `(menu-item "Scroll Bar" ,menu-bar-showhide-scroll-bar-menu
                   :visible (display-graphic-p)))
 
     (bindings--define-key menu [showhide-tooltip-mode]
@@ -1178,8 +1174,8 @@ menu-bar-showhide-menu
                   :button (:toggle . tooltip-mode)))
 
     (bindings--define-key menu [menu-bar-mode]
-      '(menu-item "Menu-bar" toggle-menu-bar-mode-from-frame
-                  :help "Turn menu-bar on/off"
+      '(menu-item "Menu Bar" toggle-menu-bar-mode-from-frame
+                  :help "Turn menu bar on/off"
                   :button
                   (:toggle . (menu-bar-positive-p
                               (frame-parameter (menu-bar-frame-for-menubar)
@@ -1188,12 +1184,12 @@ menu-bar-showhide-menu
     (if (and (boundp 'menu-bar-showhide-tool-bar-menu)
              (keymapp menu-bar-showhide-tool-bar-menu))
         (bindings--define-key menu [showhide-tool-bar]
-          `(menu-item "Tool-bar" ,menu-bar-showhide-tool-bar-menu
+          `(menu-item "Tool Bar" ,menu-bar-showhide-tool-bar-menu
                       :visible (display-graphic-p)))
       ;; else not tool bar that can move.
       (bindings--define-key menu [showhide-tool-bar]
-        '(menu-item "Tool-bar" toggle-tool-bar-mode-from-frame
-                    :help "Turn tool-bar on/off"
+        '(menu-item "Tool Bar" toggle-tool-bar-mode-from-frame
+                    :help "Turn tool bar on/off"
                     :visible (display-graphic-p)
                     :button
                     (:toggle . (menu-bar-positive-p
@@ -2268,11 +2264,11 @@ menu-bar-mode
 		    (assq-delete-all 'menu-bar-lines
 				     default-frame-alist)))))
   ;; Make the message appear when Emacs is idle.  We can not call message
-  ;; directly.  The minor-mode message "Menu-bar mode disabled" comes
+  ;; directly.  The minor-mode message "Menu Bar mode disabled" comes
   ;; after this function returns, overwriting any message we do here.
   (when (and (called-interactively-p 'interactive) (not menu-bar-mode))
     (run-with-idle-timer 0 nil 'message
-			 "Menu-bar mode disabled.  Use M-x menu-bar-mode to make the menu bar appear.")))
+			 "Menu Bar mode disabled.  Use M-x menu-bar-mode to make the menu bar appear.")))
 
 ;;;###autoload
 ;; (This does not work right unless it comes after the above definition.)

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-05-24 12:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-23 21:08 bug#27047: 26.0.50; Scroll bar menu UI glitches [patch] Stephen Berman
2017-05-24  6:15 ` martin rudalics
2017-05-24 11:39   ` Stephen Berman
2017-05-24 12:27     ` martin rudalics

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).