diff options
| -rw-r--r-- | lisp/tab-bar.el | 106 |
1 files changed, 65 insertions, 41 deletions
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 63ab932ac0a..85f947f598c 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el | |||
| @@ -1227,7 +1227,7 @@ to which to move the tab; ARG defaults to 1." | |||
| 1227 | 1227 | ||
| 1228 | (defun tab-bar-detach-tab (&optional from-number) | 1228 | (defun tab-bar-detach-tab (&optional from-number) |
| 1229 | "Move tab number FROM-NUMBER to a new frame. | 1229 | "Move tab number FROM-NUMBER to a new frame. |
| 1230 | Interactively or without argument, move the current tab." | 1230 | FROM-NUMBER defaults to the current tab (which happens interactively." |
| 1231 | (interactive (list (1+ (tab-bar--current-tab-index)))) | 1231 | (interactive (list (1+ (tab-bar--current-tab-index)))) |
| 1232 | (let* ((tabs (funcall tab-bar-tabs-function)) | 1232 | (let* ((tabs (funcall tab-bar-tabs-function)) |
| 1233 | (tab-index (1- (or from-number (1+ (tab-bar--current-tab-index tabs))))) | 1233 | (tab-index (1- (or from-number (1+ (tab-bar--current-tab-index tabs))))) |
| @@ -1241,7 +1241,10 @@ Interactively or without argument, move the current tab." | |||
| 1241 | (tab-bar-close-tab)))) | 1241 | (tab-bar-close-tab)))) |
| 1242 | 1242 | ||
| 1243 | (defun tab-bar-move-window-to-tab () | 1243 | (defun tab-bar-move-window-to-tab () |
| 1244 | "Detach the selected window to a new tab." | 1244 | "Move the selected window to a new tab. |
| 1245 | This command removes the selected window from the configuration stored | ||
| 1246 | on the current tab, and makes a new tab with that window in its | ||
| 1247 | configuration." | ||
| 1245 | (interactive) | 1248 | (interactive) |
| 1246 | (let ((tab-bar-new-tab-choice 'window)) | 1249 | (let ((tab-bar-new-tab-choice 'window)) |
| 1247 | (tab-bar-new-tab)) | 1250 | (tab-bar-new-tab)) |
| @@ -1251,17 +1254,17 @@ Interactively or without argument, move the current tab." | |||
| 1251 | 1254 | ||
| 1252 | 1255 | ||
| 1253 | (defcustom tab-bar-new-tab-to 'right | 1256 | (defcustom tab-bar-new-tab-to 'right |
| 1254 | "Defines where to create a new tab. | 1257 | "Where to create a new tab. |
| 1255 | If `leftmost', create as the first tab. | 1258 | If `leftmost', create as the first tab. |
| 1256 | If `left', create to the left from the current tab. | 1259 | If `left', create to the left of the current tab. |
| 1257 | If `right', create to the right from the current tab. | 1260 | If `right', create to the right of the current tab. |
| 1258 | If `rightmost', create as the last tab. | 1261 | If `rightmost', create as the last tab. |
| 1259 | If the value is a function, it should return a number as a position | 1262 | If the value is a function, it should return a number as a position |
| 1260 | on the tab bar specifying where to insert a new tab." | 1263 | on the tab bar specifying where to insert a new tab." |
| 1261 | :type '(choice (const :tag "First tab" leftmost) | 1264 | :type '(choice (const :tag "Insert first" leftmost) |
| 1262 | (const :tag "To the left" left) | 1265 | (const :tag "Insert left" left) |
| 1263 | (const :tag "To the right" right) | 1266 | (const :tag "Insert right" right) |
| 1264 | (const :tag "Last tab" rightmost) | 1267 | (const :tag "Insert last" rightmost) |
| 1265 | (function :tag "Function")) | 1268 | (function :tag "Function")) |
| 1266 | :group 'tab-bar | 1269 | :group 'tab-bar |
| 1267 | :version "27.1") | 1270 | :version "27.1") |
| @@ -1280,7 +1283,7 @@ TAB-NUMBER counts from 1. If no TAB-NUMBER is specified, then add | |||
| 1280 | a new tab at the position specified by `tab-bar-new-tab-to'. | 1283 | a new tab at the position specified by `tab-bar-new-tab-to'. |
| 1281 | Negative TAB-NUMBER counts tabs from the end of the tab bar, | 1284 | Negative TAB-NUMBER counts tabs from the end of the tab bar, |
| 1282 | and -1 means the new tab will become the last one. | 1285 | and -1 means the new tab will become the last one. |
| 1283 | Argument addressing is absolute in contrast to `tab-bar-new-tab' | 1286 | Argument addressing is absolute in contrast to `tab-bar-new-tab', |
| 1284 | where argument addressing is relative. | 1287 | where argument addressing is relative. |
| 1285 | After the tab is created, the hooks in | 1288 | After the tab is created, the hooks in |
| 1286 | `tab-bar-tab-post-open-functions' are run." | 1289 | `tab-bar-tab-post-open-functions' are run." |
| @@ -1353,7 +1356,7 @@ If a negative ARG, create a new tab ARG positions to the left. | |||
| 1353 | If ARG is zero, create a new tab in place of the current tab. | 1356 | If ARG is zero, create a new tab in place of the current tab. |
| 1354 | If no ARG is specified, then add a new tab at the position | 1357 | If no ARG is specified, then add a new tab at the position |
| 1355 | specified by `tab-bar-new-tab-to'. | 1358 | specified by `tab-bar-new-tab-to'. |
| 1356 | Argument addressing is relative in contrast to `tab-bar-new-tab-to' | 1359 | Argument addressing is relative in contrast to `tab-bar-new-tab-to', |
| 1357 | where argument addressing is absolute. | 1360 | where argument addressing is absolute. |
| 1358 | If FROM-NUMBER is a tab number, a new tab is created from that tab." | 1361 | If FROM-NUMBER is a tab number, a new tab is created from that tab." |
| 1359 | (interactive "P") | 1362 | (interactive "P") |
| @@ -1380,7 +1383,7 @@ ARG and FROM-NUMBER have the same meaning as in `tab-bar-new-tab'." | |||
| 1380 | "A list of closed tabs to be able to undo their closing.") | 1383 | "A list of closed tabs to be able to undo their closing.") |
| 1381 | 1384 | ||
| 1382 | (defcustom tab-bar-close-tab-select 'recent | 1385 | (defcustom tab-bar-close-tab-select 'recent |
| 1383 | "Defines what tab to select after closing the specified tab. | 1386 | "Which tab to make current after closing the specified tab. |
| 1384 | If `left', select the adjacent left tab. | 1387 | If `left', select the adjacent left tab. |
| 1385 | If `right', select the adjacent right tab. | 1388 | If `right', select the adjacent right tab. |
| 1386 | If `recent', select the most recently visited tab." | 1389 | If `recent', select the most recently visited tab." |
| @@ -1391,7 +1394,7 @@ If `recent', select the most recently visited tab." | |||
| 1391 | :version "27.1") | 1394 | :version "27.1") |
| 1392 | 1395 | ||
| 1393 | (defcustom tab-bar-close-last-tab-choice nil | 1396 | (defcustom tab-bar-close-last-tab-choice nil |
| 1394 | "Defines what to do when the last tab is closed. | 1397 | "What to do when the last tab is closed. |
| 1395 | If nil, do nothing and show a message, like closing the last window or frame. | 1398 | If nil, do nothing and show a message, like closing the last window or frame. |
| 1396 | If `delete-frame', delete the containing frame, as a web browser would do. | 1399 | If `delete-frame', delete the containing frame, as a web browser would do. |
| 1397 | If `tab-bar-mode-disable', disable `tab-bar-mode' so that tabs no longer show | 1400 | If `tab-bar-mode-disable', disable `tab-bar-mode' so that tabs no longer show |
| @@ -1416,9 +1419,8 @@ function returns a non-nil value, the tab will not be closed." | |||
| 1416 | 1419 | ||
| 1417 | (defcustom tab-bar-tab-pre-close-functions nil | 1420 | (defcustom tab-bar-tab-pre-close-functions nil |
| 1418 | "List of functions to call before closing a tab. | 1421 | "List of functions to call before closing a tab. |
| 1419 | The tab to be closed and a boolean indicating whether or not it | 1422 | Each function is called with two arguments: the tab to be closed |
| 1420 | is the only tab in the frame are supplied as arguments, | 1423 | and a boolean indicating whether or not it is the only tab on its frame." |
| 1421 | respectively." | ||
| 1422 | :type '(repeat function) | 1424 | :type '(repeat function) |
| 1423 | :group 'tab-bar | 1425 | :group 'tab-bar |
| 1424 | :version "27.1") | 1426 | :version "27.1") |
| @@ -1427,6 +1429,7 @@ respectively." | |||
| 1427 | "Close the tab specified by its absolute position TAB-NUMBER. | 1429 | "Close the tab specified by its absolute position TAB-NUMBER. |
| 1428 | If no TAB-NUMBER is specified, then close the current tab and switch | 1430 | If no TAB-NUMBER is specified, then close the current tab and switch |
| 1429 | to the tab specified by `tab-bar-close-tab-select'. | 1431 | to the tab specified by `tab-bar-close-tab-select'. |
| 1432 | Interactively, TAB-NUMBER is the prefix numeric argument, and defaults to 1. | ||
| 1430 | TAB-NUMBER counts from 1. | 1433 | TAB-NUMBER counts from 1. |
| 1431 | Optional TO-NUMBER could be specified to override the value of | 1434 | Optional TO-NUMBER could be specified to override the value of |
| 1432 | `tab-bar-close-tab-select' programmatically with a position | 1435 | `tab-bar-close-tab-select' programmatically with a position |
| @@ -1500,7 +1503,8 @@ for the last tab on a frame is determined by | |||
| 1500 | (message "Deleted tab and switched to %s" tab-bar-close-tab-select)))))) | 1503 | (message "Deleted tab and switched to %s" tab-bar-close-tab-select)))))) |
| 1501 | 1504 | ||
| 1502 | (defun tab-bar-close-tab-by-name (name) | 1505 | (defun tab-bar-close-tab-by-name (name) |
| 1503 | "Close the tab by NAME." | 1506 | "Close the tab given its NAME. |
| 1507 | Interactively, prompt for NAME." | ||
| 1504 | (interactive | 1508 | (interactive |
| 1505 | (list (completing-read "Close tab by name: " | 1509 | (list (completing-read "Close tab by name: " |
| 1506 | (mapcar (lambda (tab) | 1510 | (mapcar (lambda (tab) |
| @@ -1509,8 +1513,9 @@ for the last tab on a frame is determined by | |||
| 1509 | (tab-bar-close-tab (1+ (tab-bar--tab-index-by-name name)))) | 1513 | (tab-bar-close-tab (1+ (tab-bar--tab-index-by-name name)))) |
| 1510 | 1514 | ||
| 1511 | (defun tab-bar-close-other-tabs (&optional tab-number) | 1515 | (defun tab-bar-close-other-tabs (&optional tab-number) |
| 1512 | "Close all tabs on the selected frame, except TAB-NUMBER. | 1516 | "Close all tabs on the selected frame, except the tab TAB-NUMBER. |
| 1513 | TAB-NUMBER counts from 1 and defaults to the current tab." | 1517 | TAB-NUMBER counts from 1 and defaults to the current tab (which |
| 1518 | happens interactively)." | ||
| 1514 | (interactive) | 1519 | (interactive) |
| 1515 | (let* ((tabs (funcall tab-bar-tabs-function)) | 1520 | (let* ((tabs (funcall tab-bar-tabs-function)) |
| 1516 | (current-index (tab-bar--current-tab-index tabs)) | 1521 | (current-index (tab-bar--current-tab-index tabs)) |
| @@ -1576,9 +1581,12 @@ TAB-NUMBER counts from 1 and defaults to the current tab." | |||
| 1576 | 1581 | ||
| 1577 | 1582 | ||
| 1578 | (defun tab-bar-rename-tab (name &optional tab-number) | 1583 | (defun tab-bar-rename-tab (name &optional tab-number) |
| 1579 | "Rename the tab specified by its absolute position TAB-NUMBER. | 1584 | "Give the tab specified by its absolute position TAB-NUMBER a new NAME. |
| 1580 | If no TAB-NUMBER is specified, then rename the current tab. | 1585 | If no TAB-NUMBER is specified, then rename the current tab. |
| 1586 | Interactively, TAB-NUMBER is the prefix numeric argument, and defaults | ||
| 1587 | to the current tab. | ||
| 1581 | TAB-NUMBER counts from 1. | 1588 | TAB-NUMBER counts from 1. |
| 1589 | Interactively, prompt for the new NAME. | ||
| 1582 | If NAME is the empty string, then use the automatic name | 1590 | If NAME is the empty string, then use the automatic name |
| 1583 | function `tab-bar-tab-name-function'." | 1591 | function `tab-bar-tab-name-function'." |
| 1584 | (interactive | 1592 | (interactive |
| @@ -1606,7 +1614,8 @@ function `tab-bar-tab-name-function'." | |||
| 1606 | (message "Renamed tab to '%s'" tab-new-name)))) | 1614 | (message "Renamed tab to '%s'" tab-new-name)))) |
| 1607 | 1615 | ||
| 1608 | (defun tab-bar-rename-tab-by-name (tab-name new-name) | 1616 | (defun tab-bar-rename-tab-by-name (tab-name new-name) |
| 1609 | "Rename the tab named TAB-NAME. | 1617 | "Rename the tab named TAB-NAME to NEW-NAME. |
| 1618 | Interactively, prompt for TAB-NAME and NEW-NAME. | ||
| 1610 | If NEW-NAME is the empty string, then use the automatic name | 1619 | If NEW-NAME is the empty string, then use the automatic name |
| 1611 | function `tab-bar-tab-name-function'." | 1620 | function `tab-bar-tab-name-function'." |
| 1612 | (interactive | 1621 | (interactive |
| @@ -1623,7 +1632,7 @@ function `tab-bar-tab-name-function'." | |||
| 1623 | ;;; Tab groups | 1632 | ;;; Tab groups |
| 1624 | 1633 | ||
| 1625 | (defun tab-bar-move-tab-to-group (&optional tab) | 1634 | (defun tab-bar-move-tab-to-group (&optional tab) |
| 1626 | "Relocate TAB (or the current tab) closer to its group." | 1635 | "Relocate TAB (default: the current tab) closer to its group." |
| 1627 | (interactive) | 1636 | (interactive) |
| 1628 | (let* ((tabs (funcall tab-bar-tabs-function)) | 1637 | (let* ((tabs (funcall tab-bar-tabs-function)) |
| 1629 | (tab (or tab (tab-bar--current-tab-find tabs))) | 1638 | (tab (or tab (tab-bar--current-tab-find tabs))) |
| @@ -1661,6 +1670,8 @@ The current tab is supplied as an argument." | |||
| 1661 | (defun tab-bar-change-tab-group (group-name &optional tab-number) | 1670 | (defun tab-bar-change-tab-group (group-name &optional tab-number) |
| 1662 | "Add the tab specified by its absolute position TAB-NUMBER to GROUP-NAME. | 1671 | "Add the tab specified by its absolute position TAB-NUMBER to GROUP-NAME. |
| 1663 | If no TAB-NUMBER is specified, then set the GROUP-NAME for the current tab. | 1672 | If no TAB-NUMBER is specified, then set the GROUP-NAME for the current tab. |
| 1673 | Interactively, TAB-NUMBER is the prefix numeric argument, and the command | ||
| 1674 | prompts for GROUP-NAME. | ||
| 1664 | TAB-NUMBER counts from 1. | 1675 | TAB-NUMBER counts from 1. |
| 1665 | If GROUP-NAME is the empty string, then remove the tab from any group. | 1676 | If GROUP-NAME is the empty string, then remove the tab from any group. |
| 1666 | While using this command, you might also want to replace | 1677 | While using this command, you might also want to replace |
| @@ -1698,7 +1709,8 @@ While using this command, you might also want to replace | |||
| 1698 | (message "Set tab group to '%s'" group-new-name)))) | 1709 | (message "Set tab group to '%s'" group-new-name)))) |
| 1699 | 1710 | ||
| 1700 | (defun tab-bar-close-group-tabs (group-name) | 1711 | (defun tab-bar-close-group-tabs (group-name) |
| 1701 | "Close all tabs that belong to GROUP-NAME on the selected frame." | 1712 | "Close all tabs that belong to GROUP-NAME on the selected frame. |
| 1713 | Interactively, prompt for GROUP-NAME." | ||
| 1702 | (interactive | 1714 | (interactive |
| 1703 | (let ((group-name (funcall tab-bar-tab-group-function | 1715 | (let ((group-name (funcall tab-bar-tab-group-function |
| 1704 | (tab-bar--current-tab-find)))) | 1716 | (tab-bar--current-tab-find)))) |
| @@ -1745,7 +1757,7 @@ While using this command, you might also want to replace | |||
| 1745 | 1757 | ||
| 1746 | (defun tab-bar--history-pre-change () | 1758 | (defun tab-bar--history-pre-change () |
| 1747 | (setq tab-bar-history-old-minibuffer-depth (minibuffer-depth)) | 1759 | (setq tab-bar-history-old-minibuffer-depth (minibuffer-depth)) |
| 1748 | ;; Store wc before possibly entering the minibuffer | 1760 | ;; Store window-configuration before possibly entering the minibuffer. |
| 1749 | (when (zerop tab-bar-history-old-minibuffer-depth) | 1761 | (when (zerop tab-bar-history-old-minibuffer-depth) |
| 1750 | (setq tab-bar-history-old | 1762 | (setq tab-bar-history-old |
| 1751 | `((wc . ,(current-window-configuration)) | 1763 | `((wc . ,(current-window-configuration)) |
| @@ -1754,7 +1766,8 @@ While using this command, you might also want to replace | |||
| 1754 | (defun tab-bar--history-change () | 1766 | (defun tab-bar--history-change () |
| 1755 | (when (and (not tab-bar-history-omit) | 1767 | (when (and (not tab-bar-history-omit) |
| 1756 | tab-bar-history-old | 1768 | tab-bar-history-old |
| 1757 | ;; Store wc before possibly entering the minibuffer | 1769 | ;; Store window-configuration before possibly entering |
| 1770 | ;; the minibuffer. | ||
| 1758 | (zerop tab-bar-history-old-minibuffer-depth)) | 1771 | (zerop tab-bar-history-old-minibuffer-depth)) |
| 1759 | (puthash (selected-frame) | 1772 | (puthash (selected-frame) |
| 1760 | (seq-take (cons tab-bar-history-old | 1773 | (seq-take (cons tab-bar-history-old |
| @@ -1946,12 +1959,16 @@ Letters do not insert themselves; instead, they are commands. | |||
| 1946 | nil)))) | 1959 | nil)))) |
| 1947 | 1960 | ||
| 1948 | (defun tab-switcher-next-line (&optional arg) | 1961 | (defun tab-switcher-next-line (&optional arg) |
| 1962 | "Move to ARGth next line in the list of tabs. | ||
| 1963 | Interactively, ARG is the prefix numeric argument and defaults to 1." | ||
| 1949 | (interactive "p") | 1964 | (interactive "p") |
| 1950 | (forward-line arg) | 1965 | (forward-line arg) |
| 1951 | (beginning-of-line) | 1966 | (beginning-of-line) |
| 1952 | (move-to-column tab-switcher-column)) | 1967 | (move-to-column tab-switcher-column)) |
| 1953 | 1968 | ||
| 1954 | (defun tab-switcher-prev-line (&optional arg) | 1969 | (defun tab-switcher-prev-line (&optional arg) |
| 1970 | "Move to ARGth previous line in the list of tabs. | ||
| 1971 | Interactively, ARG is the prefix numeric argument and defaults to 1." | ||
| 1955 | (interactive "p") | 1972 | (interactive "p") |
| 1956 | (forward-line (- arg)) | 1973 | (forward-line (- arg)) |
| 1957 | (beginning-of-line) | 1974 | (beginning-of-line) |
| @@ -1959,7 +1976,7 @@ Letters do not insert themselves; instead, they are commands. | |||
| 1959 | 1976 | ||
| 1960 | (defun tab-switcher-unmark (&optional backup) | 1977 | (defun tab-switcher-unmark (&optional backup) |
| 1961 | "Cancel requested operations on window configuration on this line and move down. | 1978 | "Cancel requested operations on window configuration on this line and move down. |
| 1962 | Optional prefix arg means move up." | 1979 | With prefix arg, move up instead." |
| 1963 | (interactive "P") | 1980 | (interactive "P") |
| 1964 | (beginning-of-line) | 1981 | (beginning-of-line) |
| 1965 | (move-to-column tab-switcher-column) | 1982 | (move-to-column tab-switcher-column) |
| @@ -1979,7 +1996,7 @@ Optional prefix arg means move up." | |||
| 1979 | 1996 | ||
| 1980 | (defun tab-switcher-delete (&optional arg) | 1997 | (defun tab-switcher-delete (&optional arg) |
| 1981 | "Mark window configuration on this line to be deleted by \\<tab-switcher-mode-map>\\[tab-switcher-execute] command. | 1998 | "Mark window configuration on this line to be deleted by \\<tab-switcher-mode-map>\\[tab-switcher-execute] command. |
| 1982 | Prefix arg is how many window configurations to delete. | 1999 | Prefix arg says how many window configurations to delete. |
| 1983 | Negative arg means delete backwards." | 2000 | Negative arg means delete backwards." |
| 1984 | (interactive "p") | 2001 | (interactive "p") |
| 1985 | (let ((buffer-read-only nil)) | 2002 | (let ((buffer-read-only nil)) |
| @@ -2032,8 +2049,8 @@ Then move up one line. Prefix arg means move that many lines." | |||
| 2032 | 2049 | ||
| 2033 | (defun tab-switcher-select () | 2050 | (defun tab-switcher-select () |
| 2034 | "Select this line's window configuration. | 2051 | "Select this line's window configuration. |
| 2035 | This command deletes and replaces all the previously existing windows | 2052 | This command replaces all the existing windows in the selected frame |
| 2036 | in the selected frame." | 2053 | with those specified by the selected window configuration." |
| 2037 | (interactive) | 2054 | (interactive) |
| 2038 | (let* ((to-tab (tab-switcher-current-tab t))) | 2055 | (let* ((to-tab (tab-switcher-current-tab t))) |
| 2039 | (kill-buffer (current-buffer)) | 2056 | (kill-buffer (current-buffer)) |
| @@ -2059,8 +2076,8 @@ in the selected frame." | |||
| 2059 | (t (list (selected-frame))))) | 2076 | (t (list (selected-frame))))) |
| 2060 | 2077 | ||
| 2061 | (defun tab-bar-get-buffer-tab (buffer-or-name &optional all-frames ignore-current-tab) | 2078 | (defun tab-bar-get-buffer-tab (buffer-or-name &optional all-frames ignore-current-tab) |
| 2062 | "Return a tab owning a window whose buffer is BUFFER-OR-NAME. | 2079 | "Return the tab that owns the window whose buffer is BUFFER-OR-NAME. |
| 2063 | BUFFER-OR-NAME may be a buffer or a buffer name and defaults to | 2080 | BUFFER-OR-NAME may be a buffer or a buffer name, and defaults to |
| 2064 | the current buffer. | 2081 | the current buffer. |
| 2065 | 2082 | ||
| 2066 | The optional argument ALL-FRAMES specifies the frames to consider: | 2083 | The optional argument ALL-FRAMES specifies the frames to consider: |
| @@ -2108,7 +2125,7 @@ Otherwise, prefer buffers of the current tab." | |||
| 2108 | (tab-bar--reusable-frames all-frames))))) | 2125 | (tab-bar--reusable-frames all-frames))))) |
| 2109 | 2126 | ||
| 2110 | (defun display-buffer-in-tab (buffer alist) | 2127 | (defun display-buffer-in-tab (buffer alist) |
| 2111 | "Display BUFFER in a tab. | 2128 | "Display BUFFER in a tab using display actions in ALIST. |
| 2112 | ALIST is an association list of action symbols and values. See | 2129 | ALIST is an association list of action symbols and values. See |
| 2113 | Info node `(elisp) Buffer Display Action Alists' for details of | 2130 | Info node `(elisp) Buffer Display Action Alists' for details of |
| 2114 | such alists. | 2131 | such alists. |
| @@ -2116,8 +2133,8 @@ such alists. | |||
| 2116 | If ALIST contains a `tab-name' entry, it creates a new tab with that name and | 2133 | If ALIST contains a `tab-name' entry, it creates a new tab with that name and |
| 2117 | displays BUFFER in a new tab. If a tab with this name already exists, it | 2134 | displays BUFFER in a new tab. If a tab with this name already exists, it |
| 2118 | switches to that tab before displaying BUFFER. The `tab-name' entry can be | 2135 | switches to that tab before displaying BUFFER. The `tab-name' entry can be |
| 2119 | a function, then it is called with two arguments: BUFFER and ALIST, and | 2136 | a function, in which case it is called with two arguments: BUFFER and ALIST, |
| 2120 | should return the tab name. When a `tab-name' entry is omitted, create | 2137 | and should return the tab name. When a `tab-name' entry is omitted, create |
| 2121 | a new tab without an explicit name. | 2138 | a new tab without an explicit name. |
| 2122 | 2139 | ||
| 2123 | The ALIST entry `tab-group' (string or function) defines the tab group. | 2140 | The ALIST entry `tab-group' (string or function) defines the tab group. |
| @@ -2167,7 +2184,7 @@ indirectly called by the latter." | |||
| 2167 | (display-buffer-in-new-tab buffer alist)))))) | 2184 | (display-buffer-in-new-tab buffer alist)))))) |
| 2168 | 2185 | ||
| 2169 | (defun display-buffer-in-new-tab (buffer alist) | 2186 | (defun display-buffer-in-new-tab (buffer alist) |
| 2170 | "Display BUFFER in a new tab. | 2187 | "Display BUFFER in a new tab using display actions in ALIST. |
| 2171 | ALIST is an association list of action symbols and values. See | 2188 | ALIST is an association list of action symbols and values. See |
| 2172 | Info node `(elisp) Buffer Display Action Alists' for details of | 2189 | Info node `(elisp) Buffer Display Action Alists' for details of |
| 2173 | such alists. | 2190 | such alists. |
| @@ -2177,9 +2194,9 @@ without checking if a suitable tab already exists. | |||
| 2177 | 2194 | ||
| 2178 | If ALIST contains a `tab-name' entry, it creates a new tab with that name | 2195 | If ALIST contains a `tab-name' entry, it creates a new tab with that name |
| 2179 | and displays BUFFER in a new tab. The `tab-name' entry can be a function, | 2196 | and displays BUFFER in a new tab. The `tab-name' entry can be a function, |
| 2180 | then it is called with two arguments: BUFFER and ALIST, and should return | 2197 | in which case it is called with two arguments: BUFFER and ALIST, and should |
| 2181 | the tab name. When a `tab-name' entry is omitted, create a new tab without | 2198 | return the tab name. When a `tab-name' entry is omitted, create a new tab |
| 2182 | an explicit name. | 2199 | without an explicit name. |
| 2183 | 2200 | ||
| 2184 | The ALIST entry `tab-group' (string or function) defines the tab group. | 2201 | The ALIST entry `tab-group' (string or function) defines the tab group. |
| 2185 | 2202 | ||
| @@ -2203,7 +2220,8 @@ indirectly called by the latter." | |||
| 2203 | 2220 | ||
| 2204 | (defun switch-to-buffer-other-tab (buffer-or-name &optional norecord) | 2221 | (defun switch-to-buffer-other-tab (buffer-or-name &optional norecord) |
| 2205 | "Switch to buffer BUFFER-OR-NAME in another tab. | 2222 | "Switch to buffer BUFFER-OR-NAME in another tab. |
| 2206 | Like \\[switch-to-buffer-other-frame] (which see), but creates a new tab." | 2223 | Like \\[switch-to-buffer-other-frame] (which see), but creates a new tab. |
| 2224 | Interactively, prompt for the buffer to switch to." | ||
| 2207 | (interactive | 2225 | (interactive |
| 2208 | (list (read-buffer-to-switch "Switch to buffer in other tab: "))) | 2226 | (list (read-buffer-to-switch "Switch to buffer in other tab: "))) |
| 2209 | (display-buffer (window-normalize-buffer-to-switch-to buffer-or-name) | 2227 | (display-buffer (window-normalize-buffer-to-switch-to buffer-or-name) |
| @@ -2213,7 +2231,10 @@ Like \\[switch-to-buffer-other-frame] (which see), but creates a new tab." | |||
| 2213 | 2231 | ||
| 2214 | (defun find-file-other-tab (filename &optional wildcards) | 2232 | (defun find-file-other-tab (filename &optional wildcards) |
| 2215 | "Edit file FILENAME, in another tab. | 2233 | "Edit file FILENAME, in another tab. |
| 2216 | Like \\[find-file-other-frame] (which see), but creates a new tab." | 2234 | Like \\[find-file-other-frame] (which see), but creates a new tab. |
| 2235 | Interactively, prompt for FILENAME. | ||
| 2236 | If WILDCARDS is non-nil, FILENAME can include widcards, and all matching | ||
| 2237 | files will be visited." | ||
| 2217 | (interactive | 2238 | (interactive |
| 2218 | (find-file-read-args "Find file in other tab: " | 2239 | (find-file-read-args "Find file in other tab: " |
| 2219 | (confirm-nonexistent-file-or-buffer))) | 2240 | (confirm-nonexistent-file-or-buffer))) |
| @@ -2230,7 +2251,10 @@ Like \\[find-file-other-frame] (which see), but creates a new tab." | |||
| 2230 | "Edit file FILENAME, in another tab, but don't allow changes. | 2251 | "Edit file FILENAME, in another tab, but don't allow changes. |
| 2231 | Like \\[find-file-other-frame] (which see), but creates a new tab. | 2252 | Like \\[find-file-other-frame] (which see), but creates a new tab. |
| 2232 | Like \\[find-file-other-tab], but marks buffer as read-only. | 2253 | Like \\[find-file-other-tab], but marks buffer as read-only. |
| 2233 | Use \\[read-only-mode] to permit editing." | 2254 | Use \\[read-only-mode] to permit editing. |
| 2255 | Interactively, prompt for FILENAME. | ||
| 2256 | If WILDCARDS is non-nil, FILENAME can include widcards, and all matching | ||
| 2257 | files will be visited." | ||
| 2234 | (interactive | 2258 | (interactive |
| 2235 | (find-file-read-args "Find file read-only in other tab: " | 2259 | (find-file-read-args "Find file read-only in other tab: " |
| 2236 | (confirm-nonexistent-file-or-buffer))) | 2260 | (confirm-nonexistent-file-or-buffer))) |