+(defun menu-bar-window-divider-customize ()
+ "Show customization buffer for `window-divider' group."
+ (interactive)
+ (customize-group 'window-divider))
+
+(defun menu-bar-bottom-and-right-window-divider ()
+ "Display dividers on the bottom and right of each window."
+ (interactive)
+ (customize-set-variable 'window-divider-default-places t)
+ (window-divider-mode 1))
+
+(defun menu-bar-right-window-divider ()
+ "Display dividers only on the right of each window."
+ (interactive)
+ (customize-set-variable 'window-divider-default-places 'right-only)
+ (window-divider-mode 1))
+
+(defun menu-bar-bottom-window-divider ()
+ "Display dividers only at the bottom of each window."
+ (interactive)
+ (customize-set-variable 'window-divider-default-places 'bottom-only)
+ (window-divider-mode 1))
+
+(defun menu-bar-no-window-divider ()
+ "Do not display window dividers."
+ (interactive)
+ (window-divider-mode -1))
+
+;; For the radio buttons below we check whether the respective dividers
+;; are displayed on the selected frame. This is not fully congruent
+;; with `window-divider-mode' but makes the menu entries work also when
+;; dividers are displayed by manipulating frame parameters directly.
+(defvar menu-bar-showhide-window-divider-menu
+ (let ((menu (make-sparse-keymap "Window Divider")))
+ (bindings--define-key menu [customize]
+ '(menu-item "Customize" menu-bar-window-divider-customize
+ :help "Customize window dividers"
+ :visible (memq (window-system) '(x w32))))
+
+ (bindings--define-key menu [bottom-and-right]
+ '(menu-item "Bottom and Right"
+ menu-bar-bottom-and-right-window-divider
+ :help "Display window divider on the bottom and right of each window"
+ :visible (memq (window-system) '(x w32))
+ :button (:radio
+ . (and (window-divider-width-valid-p
+ (cdr (assq 'bottom-divider-width
+ (frame-parameters))))
+ (window-divider-width-valid-p
+ (cdr (assq 'right-divider-width
+ (frame-parameters))))))))
+ (bindings--define-key menu [right-only]
+ '(menu-item "Right Only"
+ menu-bar-right-window-divider
+ :help "Display window divider on the right of each window only"
+ :visible (memq (window-system) '(x w32))
+ :button (:radio
+ . (and (not (window-divider-width-valid-p
+ (cdr (assq 'bottom-divider-width
+ (frame-parameters)))))
+ (window-divider-width-valid-p
+ (cdr (assq 'right-divider-width
+ (frame-parameters))))))))
+ (bindings--define-key menu [bottom-only]
+ '(menu-item "Bottom Only"
+ menu-bar-bottom-window-divider
+ :help "Display window divider on the bottom of each window only"
+ :visible (memq (window-system) '(x w32))
+ :button (:radio
+ . (and (window-divider-width-valid-p
+ (cdr (assq 'bottom-divider-width
+ (frame-parameters))))
+ (not (window-divider-width-valid-p
+ (cdr (assq 'right-divider-width
+ (frame-parameters)))))))))
+ (bindings--define-key menu [no-divider]
+ '(menu-item "None"
+ menu-bar-no-window-divider
+ :help "Do not display window dividers"
+ :visible (memq (window-system) '(x w32))
+ :button (:radio
+ . (and (not (window-divider-width-valid-p
+ (cdr (assq 'bottom-divider-width
+ (frame-parameters)))))
+ (not (window-divider-width-valid-p
+ (cdr (assq 'right-divider-width
+ (frame-parameters)))))))))
+ menu))
+