aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/tab-bar.el38
1 files changed, 28 insertions, 10 deletions
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index ccecdbc0440..63ab932ac0a 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -260,6 +260,10 @@ a list of frames to update."
260 keymap)))))) 260 keymap))))))
261 261
262(defun tab-bar-mouse-select-tab (event) 262(defun tab-bar-mouse-select-tab (event)
263 "Select the tab at mouse click, or add a new tab on the tab bar.
264Whether this command adds a new tab or selects an existing tab
265depends on whether the click is on the \"+\" button or on an
266existing tab."
263 (interactive "e") 267 (interactive "e")
264 (let* ((item (tab-bar--event-to-item (event-start event))) 268 (let* ((item (tab-bar--event-to-item (event-start event)))
265 (tab-number (tab-bar--key-to-number (nth 0 item)))) 269 (tab-number (tab-bar--key-to-number (nth 0 item))))
@@ -272,7 +276,9 @@ a list of frames to update."
272 (tab-bar-select-tab tab-number)))))) 276 (tab-bar-select-tab tab-number))))))
273 277
274(defun tab-bar-mouse-close-tab-from-button (event) 278(defun tab-bar-mouse-close-tab-from-button (event)
275 "Close the tab only when clicked on the close button." 279 "Close the tab whose \"x\" close button you click.
280See also `tab-bar-mouse-close-tab', which closes the tab
281regardless of where you click on it."
276 (interactive "e") 282 (interactive "e")
277 (let* ((item (tab-bar--event-to-item (event-start event))) 283 (let* ((item (tab-bar--event-to-item (event-start event)))
278 (tab-number (tab-bar--key-to-number (nth 0 item)))) 284 (tab-number (tab-bar--key-to-number (nth 0 item))))
@@ -281,9 +287,9 @@ a list of frames to update."
281 (tab-bar-close-tab tab-number))))) 287 (tab-bar-close-tab tab-number)))))
282 288
283(defun tab-bar-mouse-close-tab (event) 289(defun tab-bar-mouse-close-tab (event)
284 "Close the tab when clicked anywhere on the tab. 290 "Close the tab you click on.
285This is in contrast with `tab-bar-mouse-close-tab-from-button' 291This is in contrast with `tab-bar-mouse-close-tab-from-button'
286that closes only when clicked on the close button." 292that closes a tab only when you click on its \"x\" close button."
287 (interactive "e") 293 (interactive "e")
288 (let* ((item (tab-bar--event-to-item (event-start event))) 294 (let* ((item (tab-bar--event-to-item (event-start event)))
289 (tab-number (tab-bar--key-to-number (nth 0 item)))) 295 (tab-number (tab-bar--key-to-number (nth 0 item))))
@@ -291,6 +297,7 @@ that closes only when clicked on the close button."
291 (tab-bar-close-tab tab-number)))) 297 (tab-bar-close-tab tab-number))))
292 298
293(defun tab-bar-mouse-context-menu (event) 299(defun tab-bar-mouse-context-menu (event)
300 "Pop up the context menu for the tab on which you click."
294 (interactive "e") 301 (interactive "e")
295 (let* ((item (tab-bar--event-to-item (event-start event))) 302 (let* ((item (tab-bar--event-to-item (event-start event)))
296 (tab-number (tab-bar--key-to-number (nth 0 item))) 303 (tab-number (tab-bar--key-to-number (nth 0 item)))
@@ -330,6 +337,9 @@ that closes only when clicked on the close button."
330 (popup-menu menu event))) 337 (popup-menu menu event)))
331 338
332(defun tab-bar-mouse-move-tab (event) 339(defun tab-bar-mouse-move-tab (event)
340 "Move a tab to a different position on the tab bar.
341This command should be bound to a drag event. It moves the tab
342at the mouse-down event to the position at mouse-up event."
333 (interactive "e") 343 (interactive "e")
334 (let ((from (tab-bar--key-to-number 344 (let ((from (tab-bar--key-to-number
335 (nth 0 (tab-bar--event-to-item 345 (nth 0 (tab-bar--event-to-item
@@ -1089,7 +1099,8 @@ the tab bar."
1089 (force-mode-line-update)))) 1099 (force-mode-line-update))))
1090 1100
1091(defun tab-bar-switch-to-next-tab (&optional arg) 1101(defun tab-bar-switch-to-next-tab (&optional arg)
1092 "Switch to ARGth next tab." 1102 "Switch to ARGth next tab.
1103Interactively, ARG is the prefix numeric argument and defaults to 1."
1093 (interactive "p") 1104 (interactive "p")
1094 (unless (integerp arg) 1105 (unless (integerp arg)
1095 (setq arg 1)) 1106 (setq arg 1))
@@ -1099,20 +1110,24 @@ the tab bar."
1099 (tab-bar-select-tab (1+ to-index)))) 1110 (tab-bar-select-tab (1+ to-index))))
1100 1111
1101(defun tab-bar-switch-to-prev-tab (&optional arg) 1112(defun tab-bar-switch-to-prev-tab (&optional arg)
1102 "Switch to ARGth previous tab." 1113 "Switch to ARGth previous tab.
1114Interactively, ARG is the prefix numeric argument and defaults to 1."
1103 (interactive "p") 1115 (interactive "p")
1104 (unless (integerp arg) 1116 (unless (integerp arg)
1105 (setq arg 1)) 1117 (setq arg 1))
1106 (tab-bar-switch-to-next-tab (- arg))) 1118 (tab-bar-switch-to-next-tab (- arg)))
1107 1119
1108(defun tab-bar-switch-to-last-tab (&optional arg) 1120(defun tab-bar-switch-to-last-tab (&optional arg)
1109 "Switch to the last tab or ARGth tab from the end of the tab bar." 1121 "Switch to the last tab or ARGth tab from the end of the tab bar.
1122Interactively, ARG is the prefix numeric argument; it defaults to 1,
1123which means the last tab on the tab bar."
1110 (interactive "p") 1124 (interactive "p")
1111 (tab-bar-select-tab (- (length (funcall tab-bar-tabs-function)) 1125 (tab-bar-select-tab (- (length (funcall tab-bar-tabs-function))
1112 (1- (or arg 1))))) 1126 (1- (or arg 1)))))
1113 1127
1114(defun tab-bar-switch-to-recent-tab (&optional arg) 1128(defun tab-bar-switch-to-recent-tab (&optional arg)
1115 "Switch to ARGth most recently visited tab." 1129 "Switch to ARGth most recently visited tab.
1130Interactively, ARG is the prefix numeric argument and defaults to 1."
1116 (interactive "p") 1131 (interactive "p")
1117 (unless (integerp arg) 1132 (unless (integerp arg)
1118 (setq arg 1)) 1133 (setq arg 1))
@@ -1160,8 +1175,9 @@ where argument addressing is relative."
1160 1175
1161(defun tab-bar-move-tab (&optional arg) 1176(defun tab-bar-move-tab (&optional arg)
1162 "Move the current tab ARG positions to the right. 1177 "Move the current tab ARG positions to the right.
1163If a negative ARG, move the current tab ARG positions to the left. 1178Interactively, ARG is the prefix numeric argument and defaults to 1.
1164Argument addressing is relative in contrast to `tab-bar-move-tab-to' 1179If ARG is negative, move the current tab ARG positions to the left.
1180Argument addressing is relative in contrast to `tab-bar-move-tab-to',
1165where argument addressing is absolute." 1181where argument addressing is absolute."
1166 (interactive "p") 1182 (interactive "p")
1167 (let* ((tabs (funcall tab-bar-tabs-function)) 1183 (let* ((tabs (funcall tab-bar-tabs-function))
@@ -1171,6 +1187,7 @@ where argument addressing is absolute."
1171 1187
1172(defun tab-bar-move-tab-backward (&optional arg) 1188(defun tab-bar-move-tab-backward (&optional arg)
1173 "Move the current tab ARG positions to the left. 1189 "Move the current tab ARG positions to the left.
1190Interactively, ARG is the prefix numeric argument and defaults to 1.
1174Like `tab-bar-move-tab', but moves in the opposite direction." 1191Like `tab-bar-move-tab', but moves in the opposite direction."
1175 (interactive "p") 1192 (interactive "p")
1176 (tab-bar-move-tab (- (or arg 1)))) 1193 (tab-bar-move-tab (- (or arg 1))))
@@ -1181,7 +1198,8 @@ FROM-NUMBER defaults to the current tab number.
1181FROM-NUMBER and TO-NUMBER count from 1. 1198FROM-NUMBER and TO-NUMBER count from 1.
1182FROM-FRAME specifies the source frame and defaults to the selected frame. 1199FROM-FRAME specifies the source frame and defaults to the selected frame.
1183TO-FRAME specifies the target frame and defaults the next frame. 1200TO-FRAME specifies the target frame and defaults the next frame.
1184Interactively, ARG selects the ARGth different frame to move to." 1201Interactively, ARG selects the ARGth next frame on the same terminal,
1202to which to move the tab; ARG defaults to 1."
1185 (interactive "P") 1203 (interactive "P")
1186 (unless from-frame 1204 (unless from-frame
1187 (setq from-frame (selected-frame))) 1205 (setq from-frame (selected-frame)))