aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mouse.el28
1 files changed, 28 insertions, 0 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 3f448f018a4..4a4fe52c872 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -1916,6 +1916,34 @@ CLICK position, kill the secondary selection."
1916 (> (length str) 0) 1916 (> (length str) 0)
1917 (gui-set-selection 'SECONDARY str)))) 1917 (gui-set-selection 'SECONDARY str))))
1918 1918
1919(defun secondary-selection-exist-p ()
1920 "Return non-nil if there is the secondary selection in current buffer."
1921 (memq mouse-secondary-overlay (overlays-in (point-min) (point-max))))
1922
1923(defun secondary-selection-to-region ()
1924 "Set beginning and end of the region to those of the secondary selection.
1925This puts mark and point at the beginning and the end of the
1926secondary selection, respectively. This works when the secondary
1927selection exists and the region does not exist in current buffer;
1928the secondary selection will be deleted afterward.
1929If the region is active, or the secondary selection doesn't exist,
1930this function does nothing."
1931 (when (and (not (region-active-p))
1932 (secondary-selection-exist-p))
1933 (let ((beg (overlay-start mouse-secondary-overlay))
1934 (end (overlay-end mouse-secondary-overlay)))
1935 (push-mark beg t t)
1936 (goto-char end))
1937 ;; Delete the secondary selection on current buffer.
1938 (delete-overlay mouse-secondary-overlay)))
1939
1940(defun secondary-selection-from-region ()
1941 "Set beginning and end of the secondary selection to those of the region.
1942When there is no region, this function does nothing."
1943 (when (region-active-p) ; Create the secondary selection from the region.
1944 (delete-overlay mouse-secondary-overlay) ; Delete the secondary selection even on a different buffer.
1945 (move-overlay mouse-secondary-overlay (region-beginning) (region-end))))
1946
1919 1947
1920(defcustom mouse-buffer-menu-maxlen 20 1948(defcustom mouse-buffer-menu-maxlen 20
1921 "Number of buffers in one pane (submenu) of the buffer menu. 1949 "Number of buffers in one pane (submenu) of the buffer menu.