summaryrefslogtreecommitdiff
path: root/lisp/tab-bar.el
Commit message (Collapse)AuthorAgeFilesLines
...
* * lisp/tab-bar.el: Rename args to consistent naming convention.Juri Linkov2021-09-151-65/+65
| | | | | | | | | | | | | | | | Use the same naming scheme for function arguments. Use the term "index" when arguments count from 0, and the term "number" when arguments count from 1. * lisp/tab-bar.el (tab-bar-select-tab): Rename ‘arg’ to ‘tab-number’. (tab-bar-move-tab-to): Rename ‘from-index’ to ‘from-number’ and ‘to-index’ to ‘to-number’. (tab-bar-move-tab-to-frame): Rename ‘from-index’ to ‘from-number’ and ‘to-index’ to ‘to-number’. (tab-bar-new-tab-to): Rename ‘to-index’ to ‘tab-number’. (tab-bar-close-tab): Rename ‘arg’ to ‘tab-number’ and ‘to-index’ to ‘to-number’. (tab-bar-rename-tab): Rename ‘arg’ to ‘tab-number’. (tab-bar-change-tab-group): Rename ‘arg’ to ‘tab-number’.
* * lisp/tab-bar.el: Close tab only on mouse-1, not down-mouse-1 (bug#41343)Juri Linkov2021-09-141-10/+25
| | | | | | | | * lisp/tab-bar.el (tab-bar-mouse-select-tab): Don't close the tab when clicked on the close button. (tab-bar-mouse-close-tab-from-button): New function. (tab-bar-map): Bind [mouse-1] to 'tab-bar-mouse-close-tab-from-button'. (tab-bar-mouse-move-tab): Do nothing on non-tab events.
* Support mouse events clicked on the tab bar but outside of any tab (bug#41343)Juri Linkov2021-09-131-46/+72
| | | | | | | | | | | | | | | | * lisp/tab-bar.el (tab-bar--key-to-number): Return non-nil non-numeric t when no tab is used. Return nil for current-tab. (tab-bar-mouse-select-tab, tab-bar-mouse-close-tab): Do nothing when tab-bar--key-to-number returns non-nil non-numeric t for click events outside of any tab. (tab-bar-mouse-context-menu): Add context menu when mouse is clicked outside of tabs. Add "Duplicate" alongside with "Close" to the menu used when mouse is clicked on a tab. (toggle-tab-bar-mode-from-frame, toggle-frame-tab-bar): Move code closer to 'tab-bar-show'. * src/xdisp.c (handle_tab_bar_click): Return Qtab_bar with empty list when mouse is clicked on the tab bar but outside of any tab.
* * lisp/tab-bar.el (tab-bar-get-buffer-tab): Use 'remq' instead of 'seq-remove'Juri Linkov2021-09-121-1/+1
|
* * lisp/tab-bar.el: Improve logic of 'ignore-current-tab'.Juri Linkov2021-09-121-11/+25
| | | | | | | | | | * lisp/tab-bar.el (tab-bar-get-buffer-tab): Prefer the current tab when 'ignore-current-tab' is nil. (display-buffer-in-tab): Use alist entry 'ignore-current-tab' as the third arg of 'tab-bar-get-buffer-tab'. Improve docstring. Suggested by Feng Shu <tumashu@163.com> https://lists.gnu.org/archive/html/emacs-devel/2021-09/msg00955.html
* Improve documentation of some tab-bar featuresEli Zaretskii2021-09-121-8/+11
| | | | | | | * lisp/tab-bar.el (tab-bar-show, toggle-frame-tab-bar): Doc fixes. * etc/NEWS: Update the corresponding entries.
* Improve documentation of tab-bar functions and variablesEli Zaretskii2021-09-091-5/+12
| | | | | | | * etc/NEWS: Improve wording of tab-bar related entries. * lisp/tab-bar.el (tab-bar-show, tab-bar-select-tab-modifiers): Improve and clarify the doc strings.
* Merge branch 'feature/tab-bar-events'Juri Linkov2021-09-091-61/+111
|\
| * Improve tab-bar event handling (bug#41343)Juri Linkov2021-09-051-52/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/tab-bar.el (tab-bar--key-to-number): Rename from tab--key-to-number. (tab-bar--event-to-item): New function from tab-bar-handle-mouse. (tab-bar-mouse-select-tab, tab-bar-mouse-close-tab) (tab-bar-mouse-context-menu, tab-bar-mouse-move-tab): Use tab-bar--event-to-item. * src/menu.c (x_popup_menu_1): Handle Qtab_bar in the second list element. * src/xdisp.c (tty_get_tab_bar_item): Change arg 'end' to bool 'close_p'. (tty_get_tab_bar_item): Detect if the close button was clicked. (tty_handle_tab_bar_click): Return a list with caption that has text properties.
| * Mouse wheel scrolling on the tab barJuri Linkov2021-08-181-5/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/tab-bar.el (tab-bar-map): Bind mouse-4/wheel-up/wheel-left to tab-previous and mouse-5/wheel-down/wheel-right to tab-next. Bind S-mouse-4/wheel-up/wheel-left to tab-bar-move-tab-backward and S-mouse-5/wheel-down/wheel-right to tab-bar-move-tab. (tab-bar-move-tab-backward): New command. (tab-bar-move-repeat-map): Use tab-bar-move-tab-backward instead of lambda. * src/xterm.c (handle_one_xevent): Remove restriction to allow clicking mouse-4 and mouse-5.
| * Bind [drag-mouse-1] to tab-bar-mouse-move-tab on tab-bar-mapJuri Linkov2021-08-181-2/+15
| | | | | | | | | | | | | | | | | | * lisp/tab-bar.el (tab-bar-mouse-move-tab): New command. (tab-bar-map): Bind [drag-mouse-1] to tab-bar-mouse-move-tab. (tab-bar-select-tab): Zero or nil arg means the current tab. * src/xdisp.c (handle_tab_bar_click): Remove restriction to allow dragging the tab to another tab.
| * Redesign tab-bar event processing (bug#41342, bug#41343)Juri Linkov2021-08-181-36/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of emitting menu-item keys like [tab-1], emit normal mouse events like [mouse-1] and [down-mouse-3] for all mouse clicks issued on the tab-bar. * lisp/mouse.el (mouse-posn-property): Handle 'tab-bar' posn-area. * lisp/tab-bar.el (tab--key-to-number): New internal function. (tab-bar-handle-mouse): Use tab key to select/close tab. (tab-bar-mouse-select-tab, tab-bar-mouse-close-tab) (tab-bar-mouse-context-menu): New commands. (tab-bar-map): Bind [down-mouse-1] to tab-bar-mouse-select-tab, [down-mouse-2] to tab-bar-mouse-close-tab, [down-mouse-3] to tab-bar-mouse-context-menu. (tab-bar-keymap-cache): Remove. (tab-bar-make-keymap): Don't use cache. (tab-bar--format-tab): Remove default bindings from menu items. (tab-bar-make-keymap-1): Prepend tab-bar-map. * src/keyboard.c (make_lispy_event): Append event->arg to position for Qtab_bar. * src/term.c (handle_one_term_event): Simplify to set event arg. * src/w32inevt.c (do_mouse_event): Set emacs_ev->arg to the value returned from tty_handle_tab_bar_click. * src/w32term.c (w32_handle_tab_bar_click): Return value from handle_tab_bar_click. (w32_read_socket): Set tab_bar_key to value returned from w32_handle_tab_bar_click, and set event arg from it. * src/xdisp.c (handle_tab_bar_click): Instead of emitting event, return a list with Qtab_bar and tab caption with text properties that contain Qmenu_item with key and binding. (tty_handle_tab_bar_click): Simplify to return a list of Qtab_bar, key and close_p, instead of emitting event. * src/xterm.c (handle_one_xevent): Set tab_bar_key to value returned from handle_tab_bar_click, and set event arg from it.
* | Fix display of tab-bar buttonsEli Zaretskii2021-09-071-4/+4
| | | | | | | | | | | | | | | | | | | | * src/xterm.c (x_draw_image_relief): * src/w32term.c (w32_draw_image_relief): Fix calculation of relief thickness for tab-bar buttons. * lisp/tab-bar.el (tab-bar--load-buttons) (tab-bar-history-mode): Fix the :margin specification for tab-bar buttons. (Bug#50424)
* | ; * lisp/tab-bar.el (toggle-frame-tab-bar, tab-bar-new-tab-to): Doc fix.Eli Zaretskii2021-09-061-2/+5
|/
* * lisp/tab-bar.el (tab-bar-new-button-show): Make variable obsolete.Juri Linkov2021-08-151-0/+1
|
* * lisp/tab-bar.el (tab-bar-history-buttons-show): Remove defcustom.Juri Linkov2021-08-131-11/+4
| | | | | | (tab-bar-format-history): Don't use this recently added variable because now it's possible to customize the option 'tab-bar-format' to remove 'tab-bar-format-history' from it that gives the same result.
* Adjust tab-bar to the new mode-line-misc-info value (bug#49806)Juri Linkov2021-08-031-2/+1
| | | | | * lisp/tab-bar.el (tab-bar--define-keys): Adjust to the new default value for `mode-line-misc-info'.
* * lisp/tab-bar.el (tab-bar-format-global): Use string-trim-right (bug#30056).Juri Linkov2021-07-271-1/+1
|
* Adjust tab-bar to the new mode-line-misc-info valueLars Ingebrigtsen2021-07-241-1/+1
| | | | | * lisp/tab-bar.el (tab-bar--define-keys): Adjust to the new default value for `mode-line-misc-info'.
* * lisp/tab-bar.el (tab-bar--define-keys): Fix global-mode-string (bug#49215)Juri Linkov2021-06-251-9/+6
|
* * lisp/tab-bar.el: Add repeat-map keymaps.Juri Linkov2021-04-061-0/+22
| | | | | | | * lisp/tab-bar.el (tab-bar-switch-repeat-map): New keymap used for 'tab-next' and 'tab-previous'. (tab-bar-move-repeat-map): New keymap used for 'tab-move'. https://lists.gnu.org/archive/html/emacs-devel/2021-03/msg01103.html
* * lisp/tab-bar.el (tab-bar-tab-post-change-group-functions): New hook.Juri Linkov2021-03-241-0/+38
| | | | | (tab-bar-change-tab-group): Run it. (tab-bar-move-tab-to-group): New command for new hook.
* * lisp/tab-bar.el (tab-bar-new-tab-group): Set default to t.Juri Linkov2021-03-221-6/+9
| | | | | | | | | | (tab-bar-tabs, tab-bar-select-tab, tab-bar-new-tab-to): Use tab-bar--current-tab-make instead of tab-bar--current-tab. (tab-bar--tab): Add arg 'frame' to tab-bar--current-tab-find. (tab-bar--current-tab, tab-bar--current-tab-make): Move most of body from the former to the latter, thus reverting tab-bar--current-tab to its previous behavior. https://lists.gnu.org/archive/html/emacs-devel/2021-03/msg00959.html
* * lisp/tab-bar.el: New faces and face options.Juri Linkov2021-03-171-16/+69
| | | | | | | | | | | | | | * lisp/tab-bar.el (tab-bar-tab-group-current) (tab-bar-tab-group-inactive, tab-bar-tab-ungrouped): New deffaces. (tab-bar-tab-face-function): New defcustom. (tab-bar-tab-face-default): New function. (tab-bar-tab-name-format-default): Use it. (tab-bar-tab-group-format-default): Use tab-bar-tab-group-inactive face. (tab-bar-tab-group-face-function): New defcustom. (tab-bar-tab-group-face-default): New function. (tab-bar--format-tab-group): Add new arg 'current-p'. (tab-bar-format-tabs-groups): Prepend current group name before first tab. Override tab-bar-tab-face-function with tab-bar-tab-group-face-function.
* * lisp/tab-bar.el (tab-bar-select-tab): Support negative arg.Juri Linkov2021-03-161-2/+4
|
* * lisp/tab-bar.el: Simplify internal functions.Juri Linkov2021-03-161-25/+24
| | | | | | | | | | | | | | | | * lisp/tab-bar.el (tab-bar-tabs-set): New function. (tab-bar-tabs): Use tab-bar--current-tab-find and tab-bar-tabs-set. (tab-bar--tab): Use tab-bar--current-tab-find. (tab-bar--current-tab): Remove unused line (assq 'current-tab ...) because there is no current-tab when it's called. Remove unused arg 'frame'. (tab-bar--current-tab-find): Simplify. (tab-bar-move-tab-to, tab-bar-move-tab-to-frame) (tab-bar-new-tab-to, tab-bar-close-tab) (tab-bar-close-other-tabs, tab-bar-undo-close-tab) (tab-switcher-delete-from-list): Use tab-bar-tabs-set instead of set-frame-parameter. (tab-bar-close-group-tabs): Simplify using tab-bar--current-tab-find without arg.
* * lisp/tab-bar.el (tab-bar-new-tab-group): New defcustom.Juri Linkov2021-03-151-3/+25
| | | | (tab-bar--current-tab, tab-bar-new-tab-to, tab-bar-duplicate-tab): Use it.
* * lisp/tab-bar.el (tab-bar-tab-group-format-function): New defcustom.Juri Linkov2021-03-151-17/+39
| | | | | | (tab-bar-tab-group-default): New function. (tab-bar-tab-group-format-default, tab-bar-format-tabs-groups) (tab-bar-change-tab-group, tab-bar-close-group-tabs): Use it.
* * lisp/tab-bar.el: Tab groups can be displayed with tab-bar-format-tabs-groupsJuri Linkov2021-03-141-40/+106
| | | | | | | | | | | | * lisp/tab-bar.el (tab-bar-format): Turn defvar into defcustom. Add :options and force-mode-line-update in :set. (tab-bar--format-tab): New function refactored from tab-bar-format-tabs. (tab-bar-format-tabs): Move most of code to tab-bar--format-tab and call it. (tab-bar-tab-group-format-function): New defcustom. (tab-bar-tab-group-format-default): New function. (tab-bar--format-tab-group, tab-bar-format-tabs-groups): New functions. (tab-bar-format-align-right, tab-bar-format-global): Shorten id. (tab-bar-change-tab-group): Add refs to tab-bar-format in docstring.
* * lisp/tab-bar.el (tab-bar--current-tab-find): New function.Juri Linkov2021-03-111-9/+10
| | | | | | | (tab-bar-close-other-tabs, tab-bar-close-group-tabs): Use it. (tab-bar--history-pre-change): Rename from 'tab-bar-history--pre-change' to follow naming convention. (tab-bar-history-mode): Use renamed 'tab-bar--history-pre-change'.
* * lisp/tab-bar.el (tab-bar-close-group-tabs): New command.Juri Linkov2021-03-101-9/+39
| | | | | | | (tab-close-group): New alias. (tab-bar-close-other-tabs): Rewrite to fix old bug where regardless of the returned value from tab-bar-tab-prevent-close-functions, only one tab was retained.
* * lisp/tab-bar.el: 'C-x t G' (tab-group) assigns a group name to the tab.Juri Linkov2021-03-101-2/+51
| | | | | | | | * lisp/tab-bar.el (tab-bar--tab, tab-bar--current-tab): Add tab group if any. (tab-bar-change-tab-group): New command. (display-buffer-in-new-tab): Handle tab-group alist entry. (tab-group): New alias. (tab-prefix-map): Bind "G" to 'tab-group'.
* * lisp/tab-bar.el (tab-bar-select-tab): Set window-state-put WINDOW arg to nilJuri Linkov2021-03-091-1/+2
| | | | | | | | | WINDOW arg nil will always create a new window regardless of the value returned by 'frame-root-window' that is nondeterministic - it returns an internal window when there are more than 1 window on the frame/tab, otherwise it returns a live window that was reused between different tabs (bug#46904) (tab-prefix-map): Bind "u" to 'tab-undo'.
* * lisp/tab-bar.el: Minor stylistic fixes.Juri Linkov2021-03-021-28/+27
| | | | | (tab-bar-select-tab-modifiers): Use tab-bar--undefine-keys and tab-bar--define-keys instead of turning tab-bar-mode on/off.
* * lisp/tab-bar.el (tab-bar--define-keys): Add check for tab-bar-format-global.Juri Linkov2021-03-011-2/+3
|
* * lisp/tab-bar.el: Support displaying global-mode-string in the tab bar.Juri Linkov2021-02-271-48/+117
| | | | | | | | | | | | | | | * lisp/tab-bar.el (tab-bar--define-keys): Update global-mode-string in mode-line-misc-info with condition to disable global-mode-string in the mode line. (tab-bar-format): New variable. (tab-bar-format-history, tab-bar-format-add-tab) (tab-bar-format-tabs): New functions with body from 'tab-bar-make-keymap-1'. (tab-bar-format-align-right, tab-bar-format-global): New functions for 'tab-bar-format' list. (tab-bar-format-list): New utility function. (tab-bar-make-keymap-1): Just call 'tab-bar-format-list'. https://lists.gnu.org/archive/html/emacs-devel/2020-11/msg01210.html
* * lisp/tab-bar.el: Move aliases down closer to keybindings.Juri Linkov2021-02-241-20/+20
|
* * lisp/tab-bar.el (tab-switch): New defalias to 'tab-bar-switch-to-tab'.Juri Linkov2021-02-241-1/+3
| | | | (tab-prefix-map): Bind "O" to 'tab-previous'.
* * lisp/tab-bar.el (tab-prefix-map): Bind "n" to 'tab-duplicate'.Juri Linkov2021-02-231-3/+7
| | | | | (tab-bar-separator): New function. (tab-bar-make-keymap-1): Use it.
* * lisp/tab-bar.el: 'C-x t N' bound to tab-new-to supports a negative argumentJuri Linkov2021-02-221-11/+22
| | | | | | | | * lisp/tab-bar.el (tab-bar-new-tab-to): Negative TO-INDEX counts tabs from the end of the tab bar. (tab-bar-new-tab): Fix docstring to add reference to 'tab-bar-new-tab-to'. (tab-prefix-map): Bind "N" to tab-new-to.
* * lisp/tab-bar.el: 'C-x t M' bound to tab-move-to supports a negative argumentJuri Linkov2021-02-221-3/+11
| | | | | | | * lisp/tab-bar.el (tab-bar-move-tab-to): Negative TO-INDEX counts tabs from the end of the tab bar. (tab-bar-move-tab): Fix docstring to add reference to tab-bar-move-tab-to. (tab-prefix-map): Bind "M" to tab-move-to.
* 'Mod-9' bound to 'tab-last' now switches to the last tab like in web browsersJuri Linkov2021-02-221-5/+15
| | | | | | | | | | * lisp/tab-bar.el (tab-bar--define-keys): Rebind 0 from tab-bar-switch-to-recent-tab to its alias tab-recent. Bind 9 to tab-last. (tab-bar-switch-to-last-tab): New command. (tab-last): New alias to tab-bar-switch-to-last-tab. (tab-bar-switch-to-tab, tab-bar-undo-close-tab): Fix docstrings to avoid mentioning the term "last" for "most recently used" meaning.
* * lisp/tab-bar.el (tab-bar--undefine-keys): New function from tab-bar-mode.Juri Linkov2021-02-221-7/+10
|
* New command 'tab-duplicate' like in web browsersJuri Linkov2021-02-171-0/+9
|
* * lisp/tab-bar.el: Fix behavior of toggle-frame-tab-bar (bug #46299)Bastian Beranek2021-02-161-2/+5
| | | | | (toggle-frame-tab-bar): Add frame parameter to protect tab bar state. (tab-bar--update-tab-bar-lines): Check parameter.
* Fix showing and hiding of tab-bar on new frames (bug#46299)Bastian Beranek2021-02-141-43/+52
| | | | | | | | | | | * lisp/tab-bar.el (tab-bar--update-tab-bar-lines) (tab-bar--tab-bar-lines-for-frame): New functions to update value of tab-bar-lines in frames. (tab-bar-mode, tab-bar-new-tab-to, tab-bar-close-tab) (tab-bar-close-other-tab, tab-bar-show :set): Use new function. (tab-bar-select-tab-modifiers :set): Work around visual glitch.
* Prefer defvar-local in preloaded filesStefan Kangas2021-01-311-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/abbrev.el: * lisp/bindings.el (mode-line-mule-info, mode-line-modified) (mode-line-remote, mode-line-process) (mode-line-buffer-identification): * lisp/buff-menu.el (Buffer-menu-files-only): * lisp/files.el (buffer-file-number, buffer-file-read-only) (local-write-file-hooks, write-contents-functions) (file-local-variables-alist, dir-local-variables-alist) (save-buffer-coding-system, buffer-save-without-query): * lisp/font-core.el (font-lock-defaults): * lisp/font-lock.el (font-lock-keywords-case-fold-search) (font-lock-syntactically-fontified) (font-lock-extend-after-change-region-function) (font-lock-extend-region-functions, font-lock-major-mode): * lisp/menu-bar.el (list-buffers-directory): * lisp/simple.el (next-error--message-highlight-overlay) (next-error-buffer, next-error-function) (next-error-move-function, goto-line-history) (minibuffer-default-add-done, undo-extra-outer-limit): * lisp/tab-bar.el (tab-switcher-column): * lisp/term/ns-win.el (ns-select-overlay): * lisp/window.el (window-size-fixed, window-area-factor) (window-group-start-function, window-group-end-function) (set-window-group-start-function) (recenter-window-group-function) (pos-visible-in-window-group-p-function) (selected-window-group-function) (move-to-window-group-line-function): Prefer defvar-local.
* * lisp/tab-bar.el: Improve tab-bar-show (bug#45556)Juri Linkov2021-01-071-7/+20
| | | | | * lisp/tab-bar.el (tab-bar-show): Change :set lambda to update all frames. Improve docstring.
* * lisp/tab-bar.el (tab-bar-tab-name-format-function): New defcustom.Juri Linkov2021-01-051-14/+26
| | | | | (tab-bar-tab-name-format-default): New function as the default value. (tab-bar-make-keymap-1): Funcall tab-bar-tab-name-format-function.
* * lisp/tab-bar.el (toggle-frame-tab-bar): New command (bug#45556)Juri Linkov2021-01-051-0/+12
|