Function: tab-line-mouse-move-tab

tab-line-mouse-move-tab is an interactive and byte-compiled function defined in tab-line.el.gz.

Signature

(tab-line-mouse-move-tab EVENT)

Documentation

Move a tab to a different position on the tab line using mouse.

This command should be bound to a drag event. It moves the tab at the mouse-down event to the position at mouse-up event. It can be used only when tab-line-tabs-function is customized to tab-line-tabs-fixed-window-buffers.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/tab-line.el.gz
(defun tab-line-mouse-move-tab (event)
  "Move a tab to a different position on the tab line using mouse.
This command should be bound to a drag event.  It moves the tab
at the mouse-down event to the position at mouse-up event.
It can be used only when `tab-line-tabs-function' is
customized to `tab-line-tabs-fixed-window-buffers'."
  (interactive "e")
  (when (eq tab-line-tabs-function #'tab-line-tabs-fixed-window-buffers)
    (let* ((posnp1 (tab-line-event-start event))
           (posnp2 (event-end event))
           (string1 (car (posn-string posnp1)))
           (string2 (car (posn-string posnp2)))
           (buffer1 (when string1 (tab-line--get-tab-property 'tab string1)))
           (buffer2 (when string2 (tab-line--get-tab-property 'tab string2)))
           (window1 (posn-window posnp1))
           (window2 (posn-window posnp2))
           (buffers (window-parameter window1 'tab-line-buffers))
           (pos2 (when buffer2 (seq-position buffers buffer2))))
      (when (and (eq window1 window2) buffer1 pos2)
        (setq buffers (delq buffer1 buffers))
        (cl-pushnew buffer1 (nthcdr pos2 buffers))
        (set-window-parameter window1 'tab-line-buffers buffers)
        (set-window-parameter window1 'tab-line-cache nil)
        (with-selected-window window1 (force-mode-line-update))))))