:group 'frames
:group 'windows)
-(defvar frame--window-divider-previous-mode nil
- "Previous value of `window-divider-mode'.
-This is the value seen when `window-divider-mode' was switched
-off the last time. It's reused when `window-divider-mode' is
-switched on again.")
-
-(defcustom window-divider-mode nil
- "Specify whether to display window dividers and where.
-Possible values are nil (no dividers), `bottom-only' (dividers on
-the bottom of each window only), `right-only' (dividers on the
-right of each window only), and t (dividers on the bottom and on
-the right of each window)."
- :type '(choice (const :tag "None (nil)" nil)
- (const :tag "Bottom only" bottom-only)
+(defcustom window-divider-default-places 'right-only
+ "Default positions of window dividers.
+Possible values are `bottom-only' (dividers on the bottom of each
+window only), `right-only' (dividers on the right of each window
+only), and t (dividers on the bottom and on the right of each
+window). The default is `right-only'.
+
+The value takes effect if and only if dividers are enabled by
+`window-divider-mode'.
+
+To position dividers on frames individually, use the frame
+parameters `bottom-divider-width' and `right-divider-width'."
+ :type '(choice (const :tag "Bottom only" bottom-only)
(const :tag "Right only" right-only)
(const :tag "Bottom and right" t))
:initialize 'custom-initialize-default
- :set (lambda (_symbol value)
- (frame--window-divider-mode-set-and-apply value))
- :group 'window-divider
+ :set (lambda (symbol value)
+ (set-default symbol value)
+ (when window-divider-mode
+ (window-divider-mode-apply t)))
:version "25.1")
-(define-minor-mode window-divider-mode
- "Display dividers between windows (Window Divider mode).
-With a prefix argument ARG, enable Window Divider mode if ARG is
-positive, and disable it otherwise. If called from Lisp, enable
-the mode if ARG is omitted or nil.
-
-The options `window-divider-default-bottom-width' and
-`window-divider-default-right-width' allow to customize the width
-of dividers displayed by this mode."
- :group 'window-divider
- :global t
- :variable (window-divider-mode
- . (lambda (value)
- (frame--window-divider-mode-set-and-apply
- (and value
- (or frame--window-divider-previous-mode
- (default-value 'window-divider-mode)
- 'right-only))))))
-
-(defun frame-window-divider-width-valid-p (value)
+(defun window-divider-width-valid-p (value)
"Return non-nil if VALUE is a positive number."
(and (numberp value) (> value 0)))
To adjust bottom dividers for frames individually, use the frame
parameter `bottom-divider-width'."
:type '(restricted-sexp
- :tag "Default bottom divider width"
+ :tag "Default width of bottom dividers"
:match-alternatives (frame-window-divider-width-valid-p))
- :group 'window-divider
:initialize 'custom-initialize-default
:set (lambda (symbol value)
(set-default symbol value)
- (when window-divider-mode
- (frame--window-divider-mode-apply)))
+ (when window-divider-mode
+ (window-divider-mode-apply t)))
:version "25.1")
(defcustom window-divider-default-right-width 6
To adjust right dividers for frames individually, use the frame
parameter `right-divider-width'."
:type '(restricted-sexp
- :tag "Default right divider width"
+ :tag "Default width of right dividers"
:match-alternatives (frame-window-divider-width-valid-p))
- :group 'window-divider
:initialize 'custom-initialize-default
:set (lambda (symbol value)
(set-default symbol value)
- (when window-divider-mode
- (frame--window-divider-mode-apply)))
+ (when window-divider-mode
+ (window-divider-mode-apply t)))
:version "25.1")
-(defun frame--window-divider-mode-apply ()
- "Apply window divider widths."
- (let ((bottom (if (memq window-divider-mode '(bottom-only t))
+(defun window-divider-mode-apply (enable)
+ "Apply window divider places and widths to all frames.
+If ENABLE is nil, apply default places and widths. Else reset
+all divider widths to zero."
+ (let ((bottom (if (and enable
+ (memq window-divider-default-places
+ '(bottom-only t)))
window-divider-default-bottom-width
0))
- (right (if (memq window-divider-mode '(right-only t))
+ (right (if (and enable
+ (memq window-divider-default-places
+ '(right-only t)))
window-divider-default-right-width
0)))
(modify-all-frames-parameters
(cons 'right-divider-width right)
default-frame-alist)))))
-(defun frame--window-divider-mode-set-and-apply (value)
- "Set window divider mode to VALUE and apply widths."
- (unless value
- ;; Remember current mode.
- (setq frame--window-divider-previous-mode window-divider-mode))
- (set-default 'window-divider-mode value)
- ;; Pacify customize rigmarole.
- (put 'window-divider-mode 'customized-value
- (if (memq value '(nil t))
- (list value)
- (list (list 'quote value))))
- (frame--window-divider-mode-apply))
+(define-minor-mode window-divider-mode
+ "Display dividers between windows (Window Divider mode).
+With a prefix argument ARG, enable Window Divider mode if ARG is
+positive, and disable it otherwise. If called from Lisp, enable
+the mode if ARG is omitted or nil.
+
+The option `window-divider-default-places' specifies on which
+side of a window dividers are displayed. The options
+`window-divider-default-bottom-width' and
+`window-divider-default-right-width' specify their respective
+widths."
+ :group 'window-divider
+ :global t
+ (window-divider-mode-apply window-divider-mode))
\f
;; Blinking cursor
(defun menu-bar-bottom-and-right-window-divider ()
"Display dividers on the bottom and right of each window."
(interactive)
- (customize-set-variable 'window-divider-mode t))
+ (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-mode 'right-only))
+ (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-mode 'bottom-only))
+ (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)
- (customize-set-variable 'window-divider-mode nil))
+ (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
:help "Display window divider on the bottom and right of each window"
:visible (memq (window-system) '(x w32))
:button (:radio
- . (and (frame-window-divider-width-valid-p
+ . (and (window-divider-width-valid-p
(cdr (assq 'bottom-divider-width
(frame-parameters))))
- (frame-window-divider-width-valid-p
+ (window-divider-width-valid-p
(cdr (assq 'right-divider-width
(frame-parameters))))))))
(bindings--define-key menu [right-only]
:help "Display window divider on the right of each window only"
:visible (memq (window-system) '(x w32))
:button (:radio
- . (and (not (frame-window-divider-width-valid-p
+ . (and (not (window-divider-width-valid-p
(cdr (assq 'bottom-divider-width
(frame-parameters)))))
- (frame-window-divider-width-valid-p
+ (window-divider-width-valid-p
(cdr (assq 'right-divider-width
(frame-parameters))))))))
(bindings--define-key menu [bottom-only]
:help "Display window divider on the bottom of each window only"
:visible (memq (window-system) '(x w32))
:button (:radio
- . (and (frame-window-divider-width-valid-p
+ . (and (window-divider-width-valid-p
(cdr (assq 'bottom-divider-width
(frame-parameters))))
- (not (frame-window-divider-width-valid-p
+ (not (window-divider-width-valid-p
(cdr (assq 'right-divider-width
(frame-parameters)))))))))
(bindings--define-key menu [no-divider]
:help "Do not display window dividers"
:visible (memq (window-system) '(x w32))
:button (:radio
- . (and (not (frame-window-divider-width-valid-p
+ . (and (not (window-divider-width-valid-p
(cdr (assq 'bottom-divider-width
(frame-parameters)))))
- (not (frame-window-divider-width-valid-p
+ (not (window-divider-width-valid-p
(cdr (assq 'right-divider-width
(frame-parameters)))))))))
menu))