diff options
| author | Juri Linkov | 2019-11-03 23:48:53 +0200 |
|---|---|---|
| committer | Juri Linkov | 2019-11-03 23:48:53 +0200 |
| commit | da087965f294bacf178892e81cb3d3e89e341029 (patch) | |
| tree | 8e4b699d8c8f06d1e3c1b3bed77a97cae09dca18 | |
| parent | c472df8ad30741a9585fb591db3189812b66e8c9 (diff) | |
| download | emacs-da087965f294bacf178892e81cb3d3e89e341029.tar.gz emacs-da087965f294bacf178892e81cb3d3e89e341029.zip | |
* lisp/tab-bar.el: Better handling of tab-bar-history.
* lisp/tab-bar.el (tab-bar-history-limit): Increase to 10 since wc
is not saved to the desktop file anymore, so doesn't affect its size.
(tab-bar-history--pre-change, tab-bar--history-change):
Store wc before possibly entering the minibuffer.
| -rw-r--r-- | lisp/tab-bar.el | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 1a0ac26f687..8777e20807a 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el | |||
| @@ -345,6 +345,7 @@ Also add the number of windows in the window configuration." | |||
| 345 | 'nomini))) | 345 | 'nomini))) |
| 346 | ", ")) | 346 | ", ")) |
| 347 | 347 | ||
| 348 | |||
| 348 | (defvar tab-bar-tabs-function #'tab-bar-tabs | 349 | (defvar tab-bar-tabs-function #'tab-bar-tabs |
| 349 | "Function to get a list of tabs to display in the tab bar. | 350 | "Function to get a list of tabs to display in the tab bar. |
| 350 | This function should return a list of alists with parameters | 351 | This function should return a list of alists with parameters |
| @@ -372,6 +373,7 @@ Return its existing value or a new value." | |||
| 372 | (set-frame-parameter nil 'tabs tabs)) | 373 | (set-frame-parameter nil 'tabs tabs)) |
| 373 | tabs)) | 374 | tabs)) |
| 374 | 375 | ||
| 376 | |||
| 375 | (defun tab-bar-make-keymap-1 () | 377 | (defun tab-bar-make-keymap-1 () |
| 376 | "Generate an actual keymap from `tab-bar-map', without caching." | 378 | "Generate an actual keymap from `tab-bar-map', without caching." |
| 377 | (let* ((separator (or tab-bar-separator (if window-system " " "|"))) | 379 | (let* ((separator (or tab-bar-separator (if window-system " " "|"))) |
| @@ -628,7 +630,7 @@ FROM-INDEX and TO-INDEX count from 1." | |||
| 628 | (let* ((tabs (funcall tab-bar-tabs-function)) | 630 | (let* ((tabs (funcall tab-bar-tabs-function)) |
| 629 | (from-index (or from-index (1+ (tab-bar--current-tab-index tabs)))) | 631 | (from-index (or from-index (1+ (tab-bar--current-tab-index tabs)))) |
| 630 | (from-tab (nth (1- from-index) tabs)) | 632 | (from-tab (nth (1- from-index) tabs)) |
| 631 | (to-index (max 0 (min (1- to-index) (1- (length tabs)))))) | 633 | (to-index (max 0 (min (1- (or to-index 1)) (1- (length tabs)))))) |
| 632 | (setq tabs (delq from-tab tabs)) | 634 | (setq tabs (delq from-tab tabs)) |
| 633 | (cl-pushnew from-tab (nthcdr to-index tabs)) | 635 | (cl-pushnew from-tab (nthcdr to-index tabs)) |
| 634 | (set-frame-parameter nil 'tabs tabs) | 636 | (set-frame-parameter nil 'tabs tabs) |
| @@ -909,7 +911,7 @@ function `tab-bar-tab-name-function'." | |||
| 909 | 911 | ||
| 910 | ;;; Tab history mode | 912 | ;;; Tab history mode |
| 911 | 913 | ||
| 912 | (defvar tab-bar-history-limit 3 | 914 | (defvar tab-bar-history-limit 10 |
| 913 | "The number of history elements to keep.") | 915 | "The number of history elements to keep.") |
| 914 | 916 | ||
| 915 | (defvar tab-bar-history-omit nil | 917 | (defvar tab-bar-history-omit nil |
| @@ -928,18 +930,18 @@ function `tab-bar-tab-name-function'." | |||
| 928 | "Minibuffer depth before the current command.") | 930 | "Minibuffer depth before the current command.") |
| 929 | 931 | ||
| 930 | (defun tab-bar-history--pre-change () | 932 | (defun tab-bar-history--pre-change () |
| 931 | (setq tab-bar-history--minibuffer-depth (minibuffer-depth) | 933 | (setq tab-bar-history--minibuffer-depth (minibuffer-depth)) |
| 932 | tab-bar-history-current | 934 | ;; Store wc before possibly entering the minibuffer |
| 933 | `((wc . ,(current-window-configuration)) | 935 | (when (zerop tab-bar-history--minibuffer-depth) |
| 934 | (wc-point . ,(point-marker))))) | 936 | (setq tab-bar-history-current |
| 937 | `((wc . ,(current-window-configuration)) | ||
| 938 | (wc-point . ,(point-marker)))))) | ||
| 935 | 939 | ||
| 936 | (defun tab-bar--history-change () | 940 | (defun tab-bar--history-change () |
| 937 | (when (and (not tab-bar-history-omit) | 941 | (when (and (not tab-bar-history-omit) |
| 938 | tab-bar-history-current | 942 | tab-bar-history-current |
| 939 | ;; Entering the minibuffer | 943 | ;; Store wc before possibly entering the minibuffer |
| 940 | (zerop tab-bar-history--minibuffer-depth) | 944 | (zerop tab-bar-history--minibuffer-depth)) |
| 941 | ;; Exiting the minibuffer | ||
| 942 | (zerop (minibuffer-depth))) | ||
| 943 | (puthash (selected-frame) | 945 | (puthash (selected-frame) |
| 944 | (seq-take (cons tab-bar-history-current | 946 | (seq-take (cons tab-bar-history-current |
| 945 | (gethash (selected-frame) tab-bar-history-back)) | 947 | (gethash (selected-frame) tab-bar-history-back)) |