From fffab032b05d5dcb72d6729321739ca814c54a28 Mon Sep 17 00:00:00 2001 From: Eval EXEC Date: Fri, 5 Jul 2024 18:53:36 +0800 Subject: [PATCH 1/3] Improve 'tab-line-tabs-fixed-window-buffers' sorting performance * lsp/tab-line.el (tab-line-tabs-fixed-window-buffers): Enhance 'tab-line-tabs-fixed-window-buffers' performance by optimizing buffer sorting mechanism. Replace inefficient 'seq-position' calls with a hash table to cache buffer positions, significantly improving speed when handling large buffer lists (bug#71958). Copyright-paperwork-exempt: yes --- lisp/tab-line.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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)) From 130c3efa108de4db0a4a8b7521ecf6551efa89cb Mon Sep 17 00:00:00 2001 From: Jim Porter Date: Sat, 22 Jun 2024 12:45:19 -0700 Subject: [PATCH 2/3] Fix execution of MS-Windows app execution aliases in Eshell * lisp/eshell/esh-ext.el (eshell-script-interpreter): Check for 0-size files (bug#71655). --- lisp/eshell/esh-ext.el | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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]+\\(.+\\)\\)?") From 67f291ddae31cc4623fd93280b141ee8611f3f5a Mon Sep 17 00:00:00 2001 From: Po Lu Date: Mon, 8 Jul 2024 15:33:26 +0800 Subject: [PATCH 3/3] Correct conditions for iconification on Android * java/org/gnu/emacs/EmacsActivity.java (EmacsActivity) : Rename to . (attachWindow): Adjust to match. (onPause): Delete function. (onStop): Deem frames iconified after calls to onStop instead. --- java/org/gnu/emacs/EmacsActivity.java | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) 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);