[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/android dcf0fc2c434 1/2: Merge remote-tracking branch 'origin/ma
From: |
Po Lu |
Subject: |
feature/android dcf0fc2c434 1/2: Merge remote-tracking branch 'origin/master' into feature/android |
Date: |
Fri, 7 Jul 2023 20:56:46 -0400 (EDT) |
branch: feature/android
commit dcf0fc2c434e055338b025572c4d06fcd50ca5e2
Merge: e40dca8361d 37101780243
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Merge remote-tracking branch 'origin/master' into feature/android
---
lisp/emacs-lisp/bytecomp.el | 3 ++-
lisp/tab-bar.el | 21 ++++++++++++---------
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 262c658e258..489a9724fc4 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1128,7 +1128,8 @@ Each function's symbol gets added to
`byte-compile-noruntime-functions'."
;; we arguably should add it to b-c-noruntime-functions,
;; but it's not clear it's worth the trouble
;; trying to recognize that case.
- (unless (get f 'function-history)
+ (unless (or (get f 'function-history)
+ (assq f byte-compile-function-environment))
(push f byte-compile-noruntime-functions)))))))))))))
(defun byte-compile-eval-before-compile (form)
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 3180d19052f..044337260ce 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -693,13 +693,18 @@ from all windows in the window configuration."
(defun tab-bar-tab-name-current ()
"Generate tab name from the buffer of the selected window."
- (buffer-name (window-buffer (minibuffer-selected-window))))
+ ;; `minibuffer-selected-window' loses its original window
+ ;; after switching to another tab while the minibuffer was active,
+ ;; so get the most recently used non-minibuffer window.
+ (buffer-name (window-buffer (or (minibuffer-selected-window)
+ (and (window-minibuffer-p)
+ (get-mru-window))))))
(defun tab-bar-tab-name-current-with-count ()
"Generate tab name from the buffer of the selected window.
Also add the number of windows in the window configuration."
(let ((count (length (window-list-1 nil 'nomini)))
- (name (window-buffer (minibuffer-selected-window))))
+ (name (tab-bar-tab-name-current)))
(if (> count 1)
(format "%s (%d)" name count)
(format "%s" name))))
@@ -726,7 +731,7 @@ to `tab-bar-tab-name-truncated'."
"Generate tab name from the buffer of the selected window.
Truncate it to the length specified by `tab-bar-tab-name-truncated-max'.
Append ellipsis `tab-bar-tab-name-ellipsis' in this case."
- (let ((tab-name (buffer-name (window-buffer (minibuffer-selected-window)))))
+ (let ((tab-name (tab-bar-tab-name-current)))
(if (< (length tab-name) tab-bar-tab-name-truncated-max)
tab-name
(propertize (truncate-string-to-width
@@ -1336,10 +1341,8 @@ inherits the current tab's `explicit-name' parameter."
This is necessary to prepare the same window configuration where
original windows were saved and will be restored. This function
is used only when `read-minibuffer-restore-windows' is non-nil."
- (when (and read-minibuffer-restore-windows
- tab-bar-minibuffer-restore-tab)
- (tab-bar-select-tab tab-bar-minibuffer-restore-tab)
- (setq tab-bar-minibuffer-restore-tab nil)))
+ (when tab-bar-minibuffer-restore-tab
+ (tab-bar-select-tab tab-bar-minibuffer-restore-tab)))
(defun tab-bar-select-tab (&optional tab-number)
"Switch to the tab by its absolute position TAB-NUMBER in the tab bar.
@@ -1368,8 +1371,8 @@ Negative TAB-NUMBER counts tabs from the end of the tab
bar."
(when (and read-minibuffer-restore-windows minibuffer-was-active
(not tab-bar-minibuffer-restore-tab))
- (setq tab-bar-minibuffer-restore-tab (1+ from-index))
- (add-hook 'minibuffer-exit-hook 'tab-bar-minibuffer-restore-tab))
+ (setq-local tab-bar-minibuffer-restore-tab (1+ from-index))
+ (add-hook 'minibuffer-exit-hook 'tab-bar-minibuffer-restore-tab nil t))
(unless (eq from-index to-index)
(let* ((from-tab (tab-bar--tab))