diff options
| -rw-r--r-- | lisp/faces.el | 6 | ||||
| -rw-r--r-- | lisp/frame.el | 128 | ||||
| -rw-r--r-- | lisp/menu-bar.el | 92 | ||||
| -rw-r--r-- | lisp/mouse.el | 33 |
4 files changed, 244 insertions, 15 deletions
diff --git a/lisp/faces.el b/lisp/faces.el index 9857a7bd4de..511b3541265 100644 --- a/lisp/faces.el +++ b/lisp/faces.el | |||
| @@ -2506,7 +2506,7 @@ is used for the inner part while the first pixel line/column is | |||
| 2506 | drawn with the `window-divider-first-pixel' face and the last | 2506 | drawn with the `window-divider-first-pixel' face and the last |
| 2507 | pixel line/column with the `window-divider-last-pixel' face." | 2507 | pixel line/column with the `window-divider-last-pixel' face." |
| 2508 | :version "24.4" | 2508 | :version "24.4" |
| 2509 | :group 'frames | 2509 | :group 'window-divider |
| 2510 | :group 'basic-faces) | 2510 | :group 'basic-faces) |
| 2511 | 2511 | ||
| 2512 | (defface window-divider-first-pixel | 2512 | (defface window-divider-first-pixel |
| @@ -2517,7 +2517,7 @@ line/column is drawn with the foreground of this face. If you do | |||
| 2517 | not want to accentuate the first pixel line/column, set this to | 2517 | not want to accentuate the first pixel line/column, set this to |
| 2518 | the same as `window-divider' face." | 2518 | the same as `window-divider' face." |
| 2519 | :version "24.4" | 2519 | :version "24.4" |
| 2520 | :group 'frames | 2520 | :group 'window-divider |
| 2521 | :group 'basic-faces) | 2521 | :group 'basic-faces) |
| 2522 | 2522 | ||
| 2523 | (defface window-divider-last-pixel | 2523 | (defface window-divider-last-pixel |
| @@ -2528,7 +2528,7 @@ line/column is drawn with the foreground of this face. If you do | |||
| 2528 | not want to accentuate the last pixel line/column, set this to | 2528 | not want to accentuate the last pixel line/column, set this to |
| 2529 | the same as `window-divider' face." | 2529 | the same as `window-divider' face." |
| 2530 | :version "24.4" | 2530 | :version "24.4" |
| 2531 | :group 'frames | 2531 | :group 'window-divider |
| 2532 | :group 'basic-faces) | 2532 | :group 'basic-faces) |
| 2533 | 2533 | ||
| 2534 | (defface minibuffer-prompt | 2534 | (defface minibuffer-prompt |
diff --git a/lisp/frame.el b/lisp/frame.el index 077687eeb66..ffa01b4dcc1 100644 --- a/lisp/frame.el +++ b/lisp/frame.el | |||
| @@ -1749,6 +1749,134 @@ left untouched. FRAME nil or omitted means use the selected frame." | |||
| 1749 | 'delete-frame-functions "22.1") | 1749 | 'delete-frame-functions "22.1") |
| 1750 | 1750 | ||
| 1751 | 1751 | ||
| 1752 | ;;; Window dividers. | ||
| 1753 | (defgroup window-divider nil | ||
| 1754 | "Window dividers." | ||
| 1755 | :version "25.1" | ||
| 1756 | :group 'frames | ||
| 1757 | :group 'windows) | ||
| 1758 | |||
| 1759 | (defvar frame--window-divider-previous-mode nil | ||
| 1760 | "Previous value of `window-divider-mode'. | ||
| 1761 | This is the value seen when `window-divider-mode' was switched | ||
| 1762 | off the last time. It's reused when `window-divider-mode' is | ||
| 1763 | switched on again.") | ||
| 1764 | |||
| 1765 | (defcustom window-divider-mode nil | ||
| 1766 | "Specify whether to display window dividers and where. | ||
| 1767 | Possible values are nil (no dividers), `bottom-only' (dividers on | ||
| 1768 | the bottom of each window only), `right-only' (dividers on the | ||
| 1769 | right of each window only), and t (dividers on the bottom and on | ||
| 1770 | the right of each window)." | ||
| 1771 | :type '(choice (const :tag "None (nil)" nil) | ||
| 1772 | (const :tag "Bottom only" bottom-only) | ||
| 1773 | (const :tag "Right only" right-only) | ||
| 1774 | (const :tag "Bottom and right" t)) | ||
| 1775 | :initialize 'custom-initialize-default | ||
| 1776 | :set (lambda (_symbol value) | ||
| 1777 | (frame--window-divider-mode-set-and-apply value)) | ||
| 1778 | :group 'window-divider | ||
| 1779 | :version "25.1") | ||
| 1780 | |||
| 1781 | (define-minor-mode window-divider-mode | ||
| 1782 | "Display dividers between windows (Window Divider mode). | ||
| 1783 | With a prefix argument ARG, enable Window Divider mode if ARG is | ||
| 1784 | positive, and disable it otherwise. If called from Lisp, enable | ||
| 1785 | the mode if ARG is omitted or nil. | ||
| 1786 | |||
| 1787 | The option `window-divider-default-width' allows to customize the | ||
| 1788 | width of dividers displayed by this mode." | ||
| 1789 | :group 'window-divider | ||
| 1790 | :global t | ||
| 1791 | :variable (window-divider-mode | ||
| 1792 | . (lambda (value) | ||
| 1793 | (frame--window-divider-mode-set-and-apply | ||
| 1794 | (and value | ||
| 1795 | (or frame--window-divider-previous-mode | ||
| 1796 | (default-value 'window-divider-mode) | ||
| 1797 | 'right-only)))))) | ||
| 1798 | |||
| 1799 | (defun frame-window-divider-width-valid-p (value) | ||
| 1800 | "Return non-nil if VALUE is a positive number." | ||
| 1801 | (and (numberp value) (> value 0))) | ||
| 1802 | |||
| 1803 | (defcustom window-divider-default-bottom-width 6 | ||
| 1804 | "Default width of dividers on bottom of windows. | ||
| 1805 | The value must be a positive integer and takes effect when bottom | ||
| 1806 | dividers are displayed by `window-divider-mode'. | ||
| 1807 | |||
| 1808 | To adjust bottom dividers for frames individually, use the frame | ||
| 1809 | parameter `bottom-divider-width'." | ||
| 1810 | :type '(restricted-sexp | ||
| 1811 | :tag "Default bottom divider width" | ||
| 1812 | :match-alternatives (frame-window-divider-width-valid-p)) | ||
| 1813 | :group 'window-divider | ||
| 1814 | :initialize 'custom-initialize-default | ||
| 1815 | :set (lambda (symbol value) | ||
| 1816 | (set-default symbol value) | ||
| 1817 | (when window-divider-mode | ||
| 1818 | (frame--window-divider-mode-apply))) | ||
| 1819 | :version "25.1") | ||
| 1820 | |||
| 1821 | (defcustom window-divider-default-right-width 6 | ||
| 1822 | "Default width of dividers on the right of windows. | ||
| 1823 | The value must be a positive integer and takes effect when right | ||
| 1824 | dividers are displayed by `window-divider-mode'. | ||
| 1825 | |||
| 1826 | To adjust right dividers for frames individually, use the frame | ||
| 1827 | parameter `right-divider-width'." | ||
| 1828 | :type '(restricted-sexp | ||
| 1829 | :tag "Default right divider width" | ||
| 1830 | :match-alternatives (frame-window-divider-width-valid-p)) | ||
| 1831 | :group 'window-divider | ||
| 1832 | :initialize 'custom-initialize-default | ||
| 1833 | :set (lambda (symbol value) | ||
| 1834 | (set-default symbol value) | ||
| 1835 | (when window-divider-mode | ||
| 1836 | (frame--window-divider-mode-apply))) | ||
| 1837 | :version "25.1") | ||
| 1838 | |||
| 1839 | (defun frame--window-divider-mode-apply () | ||
| 1840 | "Apply window divider widths." | ||
| 1841 | (let ((bottom (if (memq window-divider-mode '(bottom-only t)) | ||
| 1842 | window-divider-default-bottom-width | ||
| 1843 | 0)) | ||
| 1844 | (right (if (memq window-divider-mode '(right-only t)) | ||
| 1845 | window-divider-default-right-width | ||
| 1846 | 0))) | ||
| 1847 | (modify-all-frames-parameters | ||
| 1848 | (list (cons 'bottom-divider-width bottom) | ||
| 1849 | (cons 'right-divider-width right))) | ||
| 1850 | (setq default-frame-alist | ||
| 1851 | (assq-delete-all | ||
| 1852 | 'bottom-divider-width default-frame-alist)) | ||
| 1853 | (setq default-frame-alist | ||
| 1854 | (assq-delete-all | ||
| 1855 | 'right-divider-width default-frame-alist)) | ||
| 1856 | (when (> bottom 0) | ||
| 1857 | (setq default-frame-alist | ||
| 1858 | (cons | ||
| 1859 | (cons 'bottom-divider-width bottom) | ||
| 1860 | default-frame-alist))) | ||
| 1861 | (when (> right 0) | ||
| 1862 | (setq default-frame-alist | ||
| 1863 | (cons | ||
| 1864 | (cons 'right-divider-width right) | ||
| 1865 | default-frame-alist))))) | ||
| 1866 | |||
| 1867 | (defun frame--window-divider-mode-set-and-apply (value) | ||
| 1868 | "Set window divider mode to VALUE and apply widths." | ||
| 1869 | (unless value | ||
| 1870 | ;; Remember current mode. | ||
| 1871 | (setq frame--window-divider-previous-mode window-divider-mode)) | ||
| 1872 | (set-default 'window-divider-mode value) | ||
| 1873 | ;; Pacify customize rigmarole. | ||
| 1874 | (put 'window-divider-mode 'customized-value | ||
| 1875 | (if (memq value '(nil t)) | ||
| 1876 | (list value) | ||
| 1877 | (list (list 'quote value)))) | ||
| 1878 | (frame--window-divider-mode-apply)) | ||
| 1879 | |||
| 1752 | ;; Blinking cursor | 1880 | ;; Blinking cursor |
| 1753 | 1881 | ||
| 1754 | (defgroup cursor nil | 1882 | (defgroup cursor nil |
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 22a0b8faaba..5a69084f98d 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el | |||
| @@ -683,7 +683,7 @@ by \"Save Options\" in Custom buffers.") | |||
| 683 | (dolist (elt '(scroll-bar-mode | 683 | (dolist (elt '(scroll-bar-mode |
| 684 | debug-on-quit debug-on-error | 684 | debug-on-quit debug-on-error |
| 685 | ;; Somehow this works, when tool-bar and menu-bar don't. | 685 | ;; Somehow this works, when tool-bar and menu-bar don't. |
| 686 | tooltip-mode | 686 | tooltip-mode window-divider-mode |
| 687 | save-place uniquify-buffer-name-style fringe-mode | 687 | save-place uniquify-buffer-name-style fringe-mode |
| 688 | indicate-empty-lines indicate-buffer-boundaries | 688 | indicate-empty-lines indicate-buffer-boundaries |
| 689 | case-fold-search font-use-system-font | 689 | case-fold-search font-use-system-font |
| @@ -711,6 +711,92 @@ by \"Save Options\" in Custom buffers.") | |||
| 711 | 711 | ||
| 712 | ;; The "Show/Hide" submenu of menu "Options" | 712 | ;; The "Show/Hide" submenu of menu "Options" |
| 713 | 713 | ||
| 714 | (defun menu-bar-window-divider-customize () | ||
| 715 | "Show customization buffer for `window-divider' group." | ||
| 716 | (interactive) | ||
| 717 | (customize-group 'window-divider)) | ||
| 718 | |||
| 719 | (defun menu-bar-bottom-and-right-window-divider () | ||
| 720 | "Display dividers on the bottom and right of each window." | ||
| 721 | (interactive) | ||
| 722 | (customize-set-variable 'window-divider-mode t)) | ||
| 723 | |||
| 724 | (defun menu-bar-right-window-divider () | ||
| 725 | "Display dividers only on the right of each window." | ||
| 726 | (interactive) | ||
| 727 | (customize-set-variable 'window-divider-mode 'right-only)) | ||
| 728 | |||
| 729 | (defun menu-bar-bottom-window-divider () | ||
| 730 | "Display dividers only at the bottom of each window." | ||
| 731 | (interactive) | ||
| 732 | (customize-set-variable 'window-divider-mode 'bottom-only)) | ||
| 733 | |||
| 734 | (defun menu-bar-no-window-divider () | ||
| 735 | "Do not display window dividers." | ||
| 736 | (interactive) | ||
| 737 | (customize-set-variable 'window-divider-mode nil)) | ||
| 738 | |||
| 739 | ;; For the radio buttons below we check whether the respective dividers | ||
| 740 | ;; are displayed on the selected frame. This is not fully congruent | ||
| 741 | ;; with `window-divder-mode' but makes the menu entries work also when | ||
| 742 | ;; dividers are displayed by manipulating frame parameters directly. | ||
| 743 | (defvar menu-bar-showhide-window-divider-menu | ||
| 744 | (let ((menu (make-sparse-keymap "Window Divider"))) | ||
| 745 | (bindings--define-key menu [customize] | ||
| 746 | '(menu-item "Customize" menu-bar-window-divider-customize | ||
| 747 | :help "Customize window dividers" | ||
| 748 | :visible (memq (window-system) '(x w32)))) | ||
| 749 | |||
| 750 | (bindings--define-key menu [bottom-and-right] | ||
| 751 | '(menu-item "Bottom and Right" | ||
| 752 | menu-bar-bottom-and-right-window-divider | ||
| 753 | :help "Display window divider on the bottom and right of each window" | ||
| 754 | :visible (memq (window-system) '(x w32)) | ||
| 755 | :button (:radio | ||
| 756 | . (and (frame-window-divider-width-valid-p | ||
| 757 | (cdr (assq 'bottom-divider-width | ||
| 758 | (frame-parameters)))) | ||
| 759 | (frame-window-divider-width-valid-p | ||
| 760 | (cdr (assq 'right-divider-width | ||
| 761 | (frame-parameters)))))))) | ||
| 762 | (bindings--define-key menu [right-only] | ||
| 763 | '(menu-item "Right Only" | ||
| 764 | menu-bar-right-window-divider | ||
| 765 | :help "Display window divider on the right of each window only" | ||
| 766 | :visible (memq (window-system) '(x w32)) | ||
| 767 | :button (:radio | ||
| 768 | . (and (not (frame-window-divider-width-valid-p | ||
| 769 | (cdr (assq 'bottom-divider-width | ||
| 770 | (frame-parameters))))) | ||
| 771 | (frame-window-divider-width-valid-p | ||
| 772 | (cdr (assq 'right-divider-width | ||
| 773 | (frame-parameters)))))))) | ||
| 774 | (bindings--define-key menu [bottom-only] | ||
| 775 | '(menu-item "Bottom Only" | ||
| 776 | menu-bar-bottom-window-divider | ||
| 777 | :help "Display window divider on the bottom of each window only" | ||
| 778 | :visible (memq (window-system) '(x w32)) | ||
| 779 | :button (:radio | ||
| 780 | . (and (frame-window-divider-width-valid-p | ||
| 781 | (cdr (assq 'bottom-divider-width | ||
| 782 | (frame-parameters)))) | ||
| 783 | (not (frame-window-divider-width-valid-p | ||
| 784 | (cdr (assq 'right-divider-width | ||
| 785 | (frame-parameters))))))))) | ||
| 786 | (bindings--define-key menu [no-divider] | ||
| 787 | '(menu-item "None" | ||
| 788 | menu-bar-no-window-divider | ||
| 789 | :help "Do not display window dividers" | ||
| 790 | :visible (memq (window-system) '(x w32)) | ||
| 791 | :button (:radio | ||
| 792 | . (and (not (frame-window-divider-width-valid-p | ||
| 793 | (cdr (assq 'bottom-divider-width | ||
| 794 | (frame-parameters))))) | ||
| 795 | (not (frame-window-divider-width-valid-p | ||
| 796 | (cdr (assq 'right-divider-width | ||
| 797 | (frame-parameters))))))))) | ||
| 798 | menu)) | ||
| 799 | |||
| 714 | (defun menu-bar-showhide-fringe-ind-customize () | 800 | (defun menu-bar-showhide-fringe-ind-customize () |
| 715 | "Show customization buffer for `indicate-buffer-boundaries'." | 801 | "Show customization buffer for `indicate-buffer-boundaries'." |
| 716 | (interactive) | 802 | (interactive) |
| @@ -1072,6 +1158,10 @@ mail status in mode line")) | |||
| 1072 | (frame-visible-p | 1158 | (frame-visible-p |
| 1073 | (symbol-value 'speedbar-frame)))))) | 1159 | (symbol-value 'speedbar-frame)))))) |
| 1074 | 1160 | ||
| 1161 | (bindings--define-key menu [showhide-window-divider] | ||
| 1162 | `(menu-item "Window Divider" ,menu-bar-showhide-window-divider-menu | ||
| 1163 | :visible (memq (window-system) '(x w32)))) | ||
| 1164 | |||
| 1075 | (bindings--define-key menu [showhide-fringe] | 1165 | (bindings--define-key menu [showhide-fringe] |
| 1076 | `(menu-item "Fringe" ,menu-bar-showhide-fringe-menu | 1166 | `(menu-item "Fringe" ,menu-bar-showhide-fringe-menu |
| 1077 | :visible (display-graphic-p))) | 1167 | :visible (display-graphic-p))) |
diff --git a/lisp/mouse.el b/lisp/mouse.el index 9bb00cb105e..221d30bc3d8 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el | |||
| @@ -338,9 +338,12 @@ This command must be bound to a mouse click." | |||
| 338 | (first-line window-min-height) | 338 | (first-line window-min-height) |
| 339 | (last-line (- (window-height) window-min-height))) | 339 | (last-line (- (window-height) window-min-height))) |
| 340 | (if (< last-line first-line) | 340 | (if (< last-line first-line) |
| 341 | (error "Window too short to split") | 341 | (user-error "Window too short to split") |
| 342 | (split-window-vertically | 342 | ;; Bind `window-combination-resize' to nil so we are sure to get |
| 343 | (min (max new-height first-line) last-line)))))) | 343 | ;; the split right at the line clicked on. |
| 344 | (let (window-combination-resize) | ||
| 345 | (split-window-vertically | ||
| 346 | (min (max new-height first-line) last-line))))))) | ||
| 344 | 347 | ||
| 345 | (defun mouse-split-window-horizontally (click) | 348 | (defun mouse-split-window-horizontally (click) |
| 346 | "Select Emacs window mouse is on, then split it horizontally in half. | 349 | "Select Emacs window mouse is on, then split it horizontally in half. |
| @@ -354,9 +357,12 @@ This command must be bound to a mouse click." | |||
| 354 | (first-col window-min-width) | 357 | (first-col window-min-width) |
| 355 | (last-col (- (window-width) window-min-width))) | 358 | (last-col (- (window-width) window-min-width))) |
| 356 | (if (< last-col first-col) | 359 | (if (< last-col first-col) |
| 357 | (error "Window too narrow to split") | 360 | (user-error "Window too narrow to split") |
| 358 | (split-window-horizontally | 361 | ;; Bind `window-combination-resize' to nil so we are sure to get |
| 359 | (min (max new-width first-col) last-col)))))) | 362 | ;; the split right at the column clicked on. |
| 363 | (let (window-combination-resize) | ||
| 364 | (split-window-horizontally | ||
| 365 | (min (max new-width first-col) last-col))))))) | ||
| 360 | 366 | ||
| 361 | (defun mouse-drag-line (start-event line) | 367 | (defun mouse-drag-line (start-event line) |
| 362 | "Drag a mode line, header line, or vertical line with the mouse. | 368 | "Drag a mode line, header line, or vertical line with the mouse. |
| @@ -1915,20 +1921,25 @@ choose a font." | |||
| 1915 | ;; vertical-line prevents Emacs from signaling an error when the mouse | 1921 | ;; vertical-line prevents Emacs from signaling an error when the mouse |
| 1916 | ;; button is released after dragging these lines, on non-toolkit | 1922 | ;; button is released after dragging these lines, on non-toolkit |
| 1917 | ;; versions. | 1923 | ;; versions. |
| 1918 | (global-set-key [mode-line mouse-1] 'mouse-select-window) | ||
| 1919 | (global-set-key [mode-line drag-mouse-1] 'mouse-select-window) | ||
| 1920 | (global-set-key [mode-line down-mouse-1] 'mouse-drag-mode-line) | ||
| 1921 | (global-set-key [header-line down-mouse-1] 'mouse-drag-header-line) | 1924 | (global-set-key [header-line down-mouse-1] 'mouse-drag-header-line) |
| 1922 | (global-set-key [header-line mouse-1] 'mouse-select-window) | 1925 | (global-set-key [header-line mouse-1] 'mouse-select-window) |
| 1926 | ;; (global-set-key [mode-line drag-mouse-1] 'mouse-select-window) | ||
| 1927 | (global-set-key [mode-line down-mouse-1] 'mouse-drag-mode-line) | ||
| 1928 | (global-set-key [mode-line mouse-1] 'mouse-select-window) | ||
| 1923 | (global-set-key [mode-line mouse-2] 'mouse-delete-other-windows) | 1929 | (global-set-key [mode-line mouse-2] 'mouse-delete-other-windows) |
| 1924 | (global-set-key [mode-line mouse-3] 'mouse-delete-window) | 1930 | (global-set-key [mode-line mouse-3] 'mouse-delete-window) |
| 1925 | (global-set-key [mode-line C-mouse-2] 'mouse-split-window-horizontally) | 1931 | (global-set-key [mode-line C-mouse-2] 'mouse-split-window-horizontally) |
| 1926 | (global-set-key [vertical-scroll-bar C-mouse-2] 'mouse-split-window-vertically) | 1932 | (global-set-key [vertical-scroll-bar C-mouse-2] 'mouse-split-window-vertically) |
| 1927 | (global-set-key [vertical-line C-mouse-2] 'mouse-split-window-vertically) | 1933 | (global-set-key [horizontal-scroll-bar C-mouse-2] 'mouse-split-window-horizontally) |
| 1928 | (global-set-key [vertical-line down-mouse-1] 'mouse-drag-vertical-line) | 1934 | (global-set-key [vertical-line down-mouse-1] 'mouse-drag-vertical-line) |
| 1935 | (global-set-key [vertical-line mouse-1] 'mouse-select-window) | ||
| 1936 | (global-set-key [vertical-line C-mouse-2] 'mouse-split-window-vertically) | ||
| 1929 | (global-set-key [right-divider down-mouse-1] 'mouse-drag-vertical-line) | 1937 | (global-set-key [right-divider down-mouse-1] 'mouse-drag-vertical-line) |
| 1938 | (global-set-key [right-divider mouse-1] 'ignore) | ||
| 1939 | (global-set-key [right-divider C-mouse-2] 'mouse-split-window-vertically) | ||
| 1930 | (global-set-key [bottom-divider down-mouse-1] 'mouse-drag-mode-line) | 1940 | (global-set-key [bottom-divider down-mouse-1] 'mouse-drag-mode-line) |
| 1931 | (global-set-key [vertical-line mouse-1] 'mouse-select-window) | 1941 | (global-set-key [bottom-divider mouse-1] 'ignore) |
| 1942 | (global-set-key [bottom-divider C-mouse-2] 'mouse-split-window-horizontally) | ||
| 1932 | 1943 | ||
| 1933 | (provide 'mouse) | 1944 | (provide 'mouse) |
| 1934 | 1945 | ||