Merge from savannah/emacs-30

67f291ddae Correct conditions for iconification on Android
130c3efa10 Fix execution of MS-Windows app execution aliases in Eshell
fffab032b0 Improve 'tab-line-tabs-fixed-window-buffers' sorting perf...
This commit is contained in:
Po Lu 2024-07-08 15:43:55 +08:00
commit ce56f939af
3 changed files with 27 additions and 17 deletions

View file

@ -78,7 +78,7 @@ public class EmacsActivity extends Activity
public static EmacsWindow focusedWindow;
/* Whether or not this activity is paused. */
private boolean isPaused;
private boolean isStopped;
/* Whether or not this activity is fullscreen. */
private boolean isFullscreen;
@ -196,7 +196,7 @@ children and RESETWHENCHILDLESS is set (implying it is a
window.view.requestFocus ();
/* If the activity is iconified, send that to the window. */
if (isPaused)
if (isStopped)
window.noticeIconified ();
/* Invalidate the focus. Since attachWindow may be called from
@ -308,8 +308,13 @@ children and RESETWHENCHILDLESS is set (implying it is a
public final void
onStop ()
{
timeOfLastInteraction = SystemClock.elapsedRealtime ();
/* Iconification was previously reported in onPause, but that was
misinformed, as `onStop' is the actual callback activated upon
changes in an activity's visibility. */
isStopped = true;
EmacsWindowManager.MANAGER.noticeIconified (this);
timeOfLastInteraction = SystemClock.elapsedRealtime ();
super.onStop ();
}
@ -403,21 +408,11 @@ children and RESETWHENCHILDLESS is set (implying it is a
invalidateFocus (3);
}
@Override
public final void
onPause ()
{
isPaused = true;
EmacsWindowManager.MANAGER.noticeIconified (this);
super.onPause ();
}
@Override
public final void
onResume ()
{
isPaused = false;
isStopped = false;
timeOfLastInteraction = 0;
EmacsWindowManager.MANAGER.noticeDeiconified (this);

View file

@ -301,7 +301,17 @@ Return nil, or a list of the form:
(INTERPRETER [ARGS] FILE)"
(let ((maxlen eshell-command-interpreter-max-length))
(if (and (file-readable-p file)
(file-regular-p file))
(file-regular-p file)
;; If the file is zero bytes, it can't possibly have a
;; shebang. This check may seem redundant, but we can
;; encounter files that Emacs considers both readable and
;; regular, but which aren't *actually* readable. This can
;; happen, for example, with certain kinds of reparse
;; points like APPEXECLINK on NTFS filesystems (MS-Windows
;; uses these for "app execution aliases"). In these
;; cases, the file size is 0, so this check protects us
;; from errors.
(> (file-attribute-size (file-attributes file)) 0))
(with-temp-buffer
(insert-file-contents-literally file nil 0 maxlen)
(if (looking-at "#![ \t]*\\([^ \r\t\n]+\\)\\([ \t]+\\(.+\\)\\)?")

View file

@ -555,10 +555,15 @@ This means that switching to a buffer previously shown in the same
window will keep the same order of tabs that was before switching.
And newly displayed buffers are added to the end of the tab line."
(let* ((old-buffers (window-parameter nil 'tab-line-buffers))
(buffer-positions (let ((index-table (make-hash-table :test 'eq)))
(seq-do-indexed
(lambda (buf idx) (puthash buf idx index-table))
old-buffers)
index-table))
(new-buffers (sort (tab-line-tabs-window-buffers)
:key (lambda (buffer)
(or (seq-position old-buffers buffer)
most-positive-fixnum)))))
(gethash buffer buffer-positions
most-positive-fixnum)))))
(set-window-parameter nil 'tab-line-buffers new-buffers)
new-buffers))