aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/emacs/frames.texi15
-rw-r--r--lisp/frame.el109
-rw-r--r--lisp/menu-bar.el27
3 files changed, 72 insertions, 79 deletions
diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi
index 8d24fc5806a..4a193dd6870 100644
--- a/doc/emacs/frames.texi
+++ b/doc/emacs/frames.texi
@@ -1011,13 +1011,16 @@ scroll bar height, change the @code{scroll-bar-height} frame parameter
1011separate windows visually. Window dividers are bars that can be dragged 1011separate windows visually. Window dividers are bars that can be dragged
1012with the mouse, thus allowing to easily resize adjacent windows. 1012with the mouse, thus allowing to easily resize adjacent windows.
1013 1013
1014@vindex window-divider-mode 1014@findex window-divider-mode
1015 To control the display of window dividers, customize the variable 1015 To toggle the display of window dividers, use the command @kbd{M-x
1016@code{window-divider-mode}. Its value should be either 1016window-divider-mode}.
1017
1018@vindex window-divider-default-places
1019 To customize where dividers should appear, use the option
1020@code{window-divider-default-places}. Its value should be either
1017@code{bottom-only} (to show dividers only on the bottom of windows), 1021@code{bottom-only} (to show dividers only on the bottom of windows),
1018@code{right-only} (to show dividers only on the right of windows), 1022@code{right-only} (to show dividers only on the right of windows), or
1019@code{t} (to show them on the bottom and on the right) or @code{nil} (to 1023@code{t} (to show them on the bottom and on the right).
1020disable window dividers).
1021 1024
1022@vindex window-divider-default-bottom-width 1025@vindex window-divider-default-bottom-width
1023@vindex window-divider-default-right-width 1026@vindex window-divider-default-right-width
diff --git a/lisp/frame.el b/lisp/frame.el
index cd6823aadf2..1177a008a67 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -1756,48 +1756,29 @@ left untouched. FRAME nil or omitted means use the selected frame."
1756 :group 'frames 1756 :group 'frames
1757 :group 'windows) 1757 :group 'windows)
1758 1758
1759(defvar frame--window-divider-previous-mode nil 1759(defcustom window-divider-default-places 'right-only
1760 "Previous value of `window-divider-mode'. 1760 "Default positions of window dividers.
1761This is the value seen when `window-divider-mode' was switched 1761Possible values are `bottom-only' (dividers on the bottom of each
1762off the last time. It's reused when `window-divider-mode' is 1762window only), `right-only' (dividers on the right of each window
1763switched on again.") 1763only), and t (dividers on the bottom and on the right of each
1764 1764window). The default is `right-only'.
1765(defcustom window-divider-mode nil 1765
1766 "Specify whether to display window dividers and where. 1766The value takes effect if and only if dividers are enabled by
1767Possible values are nil (no dividers), `bottom-only' (dividers on 1767`window-divider-mode'.
1768the bottom of each window only), `right-only' (dividers on the 1768
1769right of each window only), and t (dividers on the bottom and on 1769To position dividers on frames individually, use the frame
1770the right of each window)." 1770parameters `bottom-divider-width' and `right-divider-width'."
1771 :type '(choice (const :tag "None (nil)" nil) 1771 :type '(choice (const :tag "Bottom only" bottom-only)
1772 (const :tag "Bottom only" bottom-only)
1773 (const :tag "Right only" right-only) 1772 (const :tag "Right only" right-only)
1774 (const :tag "Bottom and right" t)) 1773 (const :tag "Bottom and right" t))
1775 :initialize 'custom-initialize-default 1774 :initialize 'custom-initialize-default
1776 :set (lambda (_symbol value) 1775 :set (lambda (symbol value)
1777 (frame--window-divider-mode-set-and-apply value)) 1776 (set-default symbol value)
1778 :group 'window-divider 1777 (when window-divider-mode
1778 (window-divider-mode-apply t)))
1779 :version "25.1") 1779 :version "25.1")
1780 1780
1781(define-minor-mode window-divider-mode 1781(defun window-divider-width-valid-p (value)
1782 "Display dividers between windows (Window Divider mode).
1783With a prefix argument ARG, enable Window Divider mode if ARG is
1784positive, and disable it otherwise. If called from Lisp, enable
1785the mode if ARG is omitted or nil.
1786
1787The options `window-divider-default-bottom-width' and
1788`window-divider-default-right-width' allow to customize the width
1789of dividers displayed by this mode."
1790 :group 'window-divider
1791 :global t
1792 :variable (window-divider-mode
1793 . (lambda (value)
1794 (frame--window-divider-mode-set-and-apply
1795 (and value
1796 (or frame--window-divider-previous-mode
1797 (default-value 'window-divider-mode)
1798 'right-only))))))
1799
1800(defun frame-window-divider-width-valid-p (value)
1801 "Return non-nil if VALUE is a positive number." 1782 "Return non-nil if VALUE is a positive number."
1802 (and (numberp value) (> value 0))) 1783 (and (numberp value) (> value 0)))
1803 1784
@@ -1809,14 +1790,13 @@ dividers are displayed by `window-divider-mode'.
1809To adjust bottom dividers for frames individually, use the frame 1790To adjust bottom dividers for frames individually, use the frame
1810parameter `bottom-divider-width'." 1791parameter `bottom-divider-width'."
1811 :type '(restricted-sexp 1792 :type '(restricted-sexp
1812 :tag "Default bottom divider width" 1793 :tag "Default width of bottom dividers"
1813 :match-alternatives (frame-window-divider-width-valid-p)) 1794 :match-alternatives (frame-window-divider-width-valid-p))
1814 :group 'window-divider
1815 :initialize 'custom-initialize-default 1795 :initialize 'custom-initialize-default
1816 :set (lambda (symbol value) 1796 :set (lambda (symbol value)
1817 (set-default symbol value) 1797 (set-default symbol value)
1818 (when window-divider-mode 1798 (when window-divider-mode
1819 (frame--window-divider-mode-apply))) 1799 (window-divider-mode-apply t)))
1820 :version "25.1") 1800 :version "25.1")
1821 1801
1822(defcustom window-divider-default-right-width 6 1802(defcustom window-divider-default-right-width 6
@@ -1827,22 +1807,27 @@ dividers are displayed by `window-divider-mode'.
1827To adjust right dividers for frames individually, use the frame 1807To adjust right dividers for frames individually, use the frame
1828parameter `right-divider-width'." 1808parameter `right-divider-width'."
1829 :type '(restricted-sexp 1809 :type '(restricted-sexp
1830 :tag "Default right divider width" 1810 :tag "Default width of right dividers"
1831 :match-alternatives (frame-window-divider-width-valid-p)) 1811 :match-alternatives (frame-window-divider-width-valid-p))
1832 :group 'window-divider
1833 :initialize 'custom-initialize-default 1812 :initialize 'custom-initialize-default
1834 :set (lambda (symbol value) 1813 :set (lambda (symbol value)
1835 (set-default symbol value) 1814 (set-default symbol value)
1836 (when window-divider-mode 1815 (when window-divider-mode
1837 (frame--window-divider-mode-apply))) 1816 (window-divider-mode-apply t)))
1838 :version "25.1") 1817 :version "25.1")
1839 1818
1840(defun frame--window-divider-mode-apply () 1819(defun window-divider-mode-apply (enable)
1841 "Apply window divider widths." 1820 "Apply window divider places and widths to all frames.
1842 (let ((bottom (if (memq window-divider-mode '(bottom-only t)) 1821If ENABLE is nil, apply default places and widths. Else reset
1822all divider widths to zero."
1823 (let ((bottom (if (and enable
1824 (memq window-divider-default-places
1825 '(bottom-only t)))
1843 window-divider-default-bottom-width 1826 window-divider-default-bottom-width
1844 0)) 1827 0))
1845 (right (if (memq window-divider-mode '(right-only t)) 1828 (right (if (and enable
1829 (memq window-divider-default-places
1830 '(right-only t)))
1846 window-divider-default-right-width 1831 window-divider-default-right-width
1847 0))) 1832 0)))
1848 (modify-all-frames-parameters 1833 (modify-all-frames-parameters
@@ -1865,18 +1850,20 @@ parameter `right-divider-width'."
1865 (cons 'right-divider-width right) 1850 (cons 'right-divider-width right)
1866 default-frame-alist))))) 1851 default-frame-alist)))))
1867 1852
1868(defun frame--window-divider-mode-set-and-apply (value) 1853(define-minor-mode window-divider-mode
1869 "Set window divider mode to VALUE and apply widths." 1854 "Display dividers between windows (Window Divider mode).
1870 (unless value 1855With a prefix argument ARG, enable Window Divider mode if ARG is
1871 ;; Remember current mode. 1856positive, and disable it otherwise. If called from Lisp, enable
1872 (setq frame--window-divider-previous-mode window-divider-mode)) 1857the mode if ARG is omitted or nil.
1873 (set-default 'window-divider-mode value) 1858
1874 ;; Pacify customize rigmarole. 1859The option `window-divider-default-places' specifies on which
1875 (put 'window-divider-mode 'customized-value 1860side of a window dividers are displayed. The options
1876 (if (memq value '(nil t)) 1861`window-divider-default-bottom-width' and
1877 (list value) 1862`window-divider-default-right-width' specify their respective
1878 (list (list 'quote value)))) 1863widths."
1879 (frame--window-divider-mode-apply)) 1864 :group 'window-divider
1865 :global t
1866 (window-divider-mode-apply window-divider-mode))
1880 1867
1881;; Blinking cursor 1868;; Blinking cursor
1882 1869
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 5a69084f98d..72c05fe5e96 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -719,22 +719,25 @@ by \"Save Options\" in Custom buffers.")
719(defun menu-bar-bottom-and-right-window-divider () 719(defun menu-bar-bottom-and-right-window-divider ()
720 "Display dividers on the bottom and right of each window." 720 "Display dividers on the bottom and right of each window."
721 (interactive) 721 (interactive)
722 (customize-set-variable 'window-divider-mode t)) 722 (customize-set-variable 'window-divider-default-places t)
723 (window-divider-mode 1))
723 724
724(defun menu-bar-right-window-divider () 725(defun menu-bar-right-window-divider ()
725 "Display dividers only on the right of each window." 726 "Display dividers only on the right of each window."
726 (interactive) 727 (interactive)
727 (customize-set-variable 'window-divider-mode 'right-only)) 728 (customize-set-variable 'window-divider-default-places 'right-only)
729 (window-divider-mode 1))
728 730
729(defun menu-bar-bottom-window-divider () 731(defun menu-bar-bottom-window-divider ()
730 "Display dividers only at the bottom of each window." 732 "Display dividers only at the bottom of each window."
731 (interactive) 733 (interactive)
732 (customize-set-variable 'window-divider-mode 'bottom-only)) 734 (customize-set-variable 'window-divider-default-places 'bottom-only)
735 (window-divider-mode 1))
733 736
734(defun menu-bar-no-window-divider () 737(defun menu-bar-no-window-divider ()
735 "Do not display window dividers." 738 "Do not display window dividers."
736 (interactive) 739 (interactive)
737 (customize-set-variable 'window-divider-mode nil)) 740 (window-divider-mode -1))
738 741
739;; For the radio buttons below we check whether the respective dividers 742;; For the radio buttons below we check whether the respective dividers
740;; are displayed on the selected frame. This is not fully congruent 743;; are displayed on the selected frame. This is not fully congruent
@@ -753,10 +756,10 @@ by \"Save Options\" in Custom buffers.")
753 :help "Display window divider on the bottom and right of each window" 756 :help "Display window divider on the bottom and right of each window"
754 :visible (memq (window-system) '(x w32)) 757 :visible (memq (window-system) '(x w32))
755 :button (:radio 758 :button (:radio
756 . (and (frame-window-divider-width-valid-p 759 . (and (window-divider-width-valid-p
757 (cdr (assq 'bottom-divider-width 760 (cdr (assq 'bottom-divider-width
758 (frame-parameters)))) 761 (frame-parameters))))
759 (frame-window-divider-width-valid-p 762 (window-divider-width-valid-p
760 (cdr (assq 'right-divider-width 763 (cdr (assq 'right-divider-width
761 (frame-parameters)))))))) 764 (frame-parameters))))))))
762 (bindings--define-key menu [right-only] 765 (bindings--define-key menu [right-only]
@@ -765,10 +768,10 @@ by \"Save Options\" in Custom buffers.")
765 :help "Display window divider on the right of each window only" 768 :help "Display window divider on the right of each window only"
766 :visible (memq (window-system) '(x w32)) 769 :visible (memq (window-system) '(x w32))
767 :button (:radio 770 :button (:radio
768 . (and (not (frame-window-divider-width-valid-p 771 . (and (not (window-divider-width-valid-p
769 (cdr (assq 'bottom-divider-width 772 (cdr (assq 'bottom-divider-width
770 (frame-parameters))))) 773 (frame-parameters)))))
771 (frame-window-divider-width-valid-p 774 (window-divider-width-valid-p
772 (cdr (assq 'right-divider-width 775 (cdr (assq 'right-divider-width
773 (frame-parameters)))))))) 776 (frame-parameters))))))))
774 (bindings--define-key menu [bottom-only] 777 (bindings--define-key menu [bottom-only]
@@ -777,10 +780,10 @@ by \"Save Options\" in Custom buffers.")
777 :help "Display window divider on the bottom of each window only" 780 :help "Display window divider on the bottom of each window only"
778 :visible (memq (window-system) '(x w32)) 781 :visible (memq (window-system) '(x w32))
779 :button (:radio 782 :button (:radio
780 . (and (frame-window-divider-width-valid-p 783 . (and (window-divider-width-valid-p
781 (cdr (assq 'bottom-divider-width 784 (cdr (assq 'bottom-divider-width
782 (frame-parameters)))) 785 (frame-parameters))))
783 (not (frame-window-divider-width-valid-p 786 (not (window-divider-width-valid-p
784 (cdr (assq 'right-divider-width 787 (cdr (assq 'right-divider-width
785 (frame-parameters))))))))) 788 (frame-parameters)))))))))
786 (bindings--define-key menu [no-divider] 789 (bindings--define-key menu [no-divider]
@@ -789,10 +792,10 @@ by \"Save Options\" in Custom buffers.")
789 :help "Do not display window dividers" 792 :help "Do not display window dividers"
790 :visible (memq (window-system) '(x w32)) 793 :visible (memq (window-system) '(x w32))
791 :button (:radio 794 :button (:radio
792 . (and (not (frame-window-divider-width-valid-p 795 . (and (not (window-divider-width-valid-p
793 (cdr (assq 'bottom-divider-width 796 (cdr (assq 'bottom-divider-width
794 (frame-parameters))))) 797 (frame-parameters)))))
795 (not (frame-window-divider-width-valid-p 798 (not (window-divider-width-valid-p
796 (cdr (assq 'right-divider-width 799 (cdr (assq 'right-divider-width
797 (frame-parameters))))))))) 800 (frame-parameters)))))))))
798 menu)) 801 menu))