diff --git a/java/org/gnu/emacs/EmacsActivity.java b/java/org/gnu/emacs/EmacsActivity.java index 7d02e4f4834..0c9e8312b90 100644 --- a/java/org/gnu/emacs/EmacsActivity.java +++ b/java/org/gnu/emacs/EmacsActivity.java @@ -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 @@ public class EmacsActivity extends Activity 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 @@ public class EmacsActivity extends Activity 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 @@ public class EmacsActivity extends Activity 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); diff --git a/lisp/eshell/esh-ext.el b/lisp/eshell/esh-ext.el index 3c4deb32601..cf93d2904da 100644 --- a/lisp/eshell/esh-ext.el +++ b/lisp/eshell/esh-ext.el @@ -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]+\\(.+\\)\\)?") diff --git a/lisp/tab-line.el b/lisp/tab-line.el index 1d14fda9825..462a0a27692 100644 --- a/lisp/tab-line.el +++ b/lisp/tab-line.el @@ -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))