emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 0571a3cc87f: Merge from origin/emacs-29


From: Stefan Kangas
Subject: master 0571a3cc87f: Merge from origin/emacs-29
Date: Thu, 2 Feb 2023 00:46:03 -0500 (EST)

branch: master
commit 0571a3cc87f7c449796bb3eef38af4b2719b0bdf
Merge: c831f55b234 9715715ac16
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>

    Merge from origin/emacs-29
    
    9715715ac16 (eshell--complete-commands-list): Fix regression in fix t...
    ea1bb263153 * doc/emacs/basic.texi (Repeating): Mention describe-repe...
    f91bf9df892 Unbreak the MS-Windows build
---
 doc/emacs/basic.texi   | 17 +++++++++--------
 lisp/eshell/em-cmpl.el | 43 +++++++++++++------------------------------
 lisp/repeat.el         |  3 ++-
 src/treesit.c          |  4 ++++
 4 files changed, 28 insertions(+), 39 deletions(-)

diff --git a/doc/emacs/basic.texi b/doc/emacs/basic.texi
index 2cc45a8805e..d8a354ff42d 100644
--- a/doc/emacs/basic.texi
+++ b/doc/emacs/basic.texi
@@ -887,6 +887,7 @@ z z z}.  The first @kbd{C-x z} repeats the command once, 
and each
 subsequent @kbd{z} repeats it once again.
 
 @findex repeat-mode
+@findex describe-repeat-maps
 @vindex repeat-exit-key
 @vindex repeat-exit-timeout
   Also you can activate @code{repeat-mode} that temporarily enables a
@@ -895,11 +896,11 @@ Currently supported shorter key sequences are @kbd{C-x u 
u} instead of
 @kbd{C-x u C-x u} to undo many changes, @kbd{C-x o o} instead of
 @kbd{C-x o C-x o} to switch several windows, @kbd{C-x @{ @{ @} @} ^ ^
 v v} to resize the selected window interactively, @kbd{M-g n n p p} to
-navigate @code{next-error} matches, and @kbd{C-x ] ] [ [} to navigate
-through pages.  Any other key exits transient mode and then is
-executed normally.  The user option @code{repeat-exit-key} defines an
-additional key to exit this transient mode.  Also it's possible to
-break the repetition chain automatically after some idle time by
-customizing the user option @code{repeat-exit-timeout} to specify the
-idle time in seconds after which this transient mode will be turned
-off.
+navigate @code{next-error} matches, @kbd{C-x ] ] [ [} to navigate
+through pages, and other keys listed by @code{describe-repeat-maps}.
+Any other key exits transient mode and then is executed normally.  The
+user option @code{repeat-exit-key} defines an additional key to exit
+this transient mode.  Also it's possible to break the repetition chain
+automatically after some idle time by customizing the user option
+@code{repeat-exit-timeout} to specify the idle time in seconds after
+which this transient mode will be turned off.
diff --git a/lisp/eshell/em-cmpl.el b/lisp/eshell/em-cmpl.el
index acbf206a3c6..2439f1ed804 100644
--- a/lisp/eshell/em-cmpl.el
+++ b/lisp/eshell/em-cmpl.el
@@ -402,31 +402,6 @@ to writing a completion function."
           args)
          posns)))
 
-(defun eshell--pcomplete-executables ()
-  "Complete amongst a list of directories and executables.
-
-Wrapper for `pcomplete-executables' or `pcomplete-dirs-or-entries',
-depending on the value of `eshell-force-execution'.
-
-Adds path prefix to candidates independent of `action' value."
-  ;; `pcomplete-entries' returns filenames without path on `action' to
-  ;; use current string directory as done in `completion-file-name-table'
-  ;; when `action' is nil to construct executable candidates.
-  (let ((table (if eshell-force-execution
-                   (pcomplete-dirs-or-entries nil #'file-readable-p)
-                 (pcomplete-executables))))
-    (lambda (string pred action)
-      (let ((cands (funcall table string pred action)))
-        (if (eq action t)
-            (let ((specdir (file-name-directory string)))
-              (mapcar
-               (lambda (cand)
-                 (if (stringp cand)
-                     (file-name-concat specdir cand)
-                   cand))
-               cands))
-          cands)))))
-
 (defun eshell--complete-commands-list ()
   "Generate list of applicable, visible commands."
   ;; Building the commands list can take quite a while, especially over Tramp
@@ -437,11 +412,19 @@ Adds path prefix to candidates independent of `action' 
value."
          ;; we complete.  Adjust `pcomplete-stub' accordingly!
         (if (and (> (length pcomplete-stub) 0)
                  (eq (aref pcomplete-stub 0) eshell-explicit-command-char))
-            (setq pcomplete-stub (substring pcomplete-stub 1)))))
-    (completion-table-dynamic
-     (lambda (filename)
-       (if (file-name-directory filename)
-           (eshell--pcomplete-executables)
+             (setq pcomplete-stub (substring pcomplete-stub 1))))
+        (filename (pcomplete-arg)))
+    ;; Do not use `completion-table-dynamic' when completing a command file
+    ;; name since it doesn't know about boundaries and would end up doing silly
+    ;; things like adding a SPC char when completing to "/usr/sbin/".
+    ;;
+    ;; If you work on this function, be careful not to reintroduce bug#48995.
+    (if (file-name-directory filename)
+        (if eshell-force-execution
+            (pcomplete-dirs-or-entries nil #'file-readable-p)
+          (pcomplete-executables))
+      (completion-table-dynamic
+       (lambda (filename)
         (let* ((paths (eshell-get-path))
                (cwd (file-name-as-directory
                      (expand-file-name default-directory)))
diff --git a/lisp/repeat.el b/lisp/repeat.el
index 0124ff4bc0c..ce59b310792 100644
--- a/lisp/repeat.el
+++ b/lisp/repeat.el
@@ -597,7 +597,8 @@ This function can be used to force exit of repetition while 
it's active."
 
 (defun describe-repeat-maps ()
   "Describe mappings of commands repeatable by symbol property `repeat-map'.
-Used in `repeat-mode'."
+If `repeat-mode' is enabled, these keymaps determine which single key
+can be used to repeat a command invoked via a full key sequence."
   (interactive)
   (require 'help-fns)
   (let ((help-buffer-under-preparation t))
diff --git a/src/treesit.c b/src/treesit.c
index b163685419f..405aec1f47e 100644
--- a/src/treesit.c
+++ b/src/treesit.c
@@ -72,6 +72,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #undef ts_query_cursor_set_byte_range
 #undef ts_query_delete
 #undef ts_query_new
+#undef ts_query_pattern_count
 #undef ts_query_predicates_for_pattern
 #undef ts_query_string_value_for_id
 #undef ts_set_allocator
@@ -135,6 +136,7 @@ DEF_DLL_FN (void, ts_query_cursor_set_byte_range,
 DEF_DLL_FN (void, ts_query_delete, (TSQuery *));
 DEF_DLL_FN (TSQuery *, ts_query_new,
            (const TSLanguage *, const char *, uint32_t, uint32_t *, 
TSQueryError *));
+DEF_DLL_FN (uint32_t, ts_query_pattern_count, (const TSQuery *));
 DEF_DLL_FN (const TSQueryPredicateStep *, ts_query_predicates_for_pattern,
            ( const TSQuery *, uint32_t, uint32_t *));
 DEF_DLL_FN (const char *, ts_query_string_value_for_id,
@@ -200,6 +202,7 @@ init_treesit_functions (void)
   LOAD_DLL_FN (library, ts_query_cursor_set_byte_range);
   LOAD_DLL_FN (library, ts_query_delete);
   LOAD_DLL_FN (library, ts_query_new);
+  LOAD_DLL_FN (library, ts_query_pattern_count);
   LOAD_DLL_FN (library, ts_query_predicates_for_pattern);
   LOAD_DLL_FN (library, ts_query_string_value_for_id);
   LOAD_DLL_FN (library, ts_set_allocator);
@@ -256,6 +259,7 @@ init_treesit_functions (void)
 #define ts_query_cursor_set_byte_range fn_ts_query_cursor_set_byte_range
 #define ts_query_delete fn_ts_query_delete
 #define ts_query_new fn_ts_query_new
+#define ts_query_pattern_count fn_ts_query_pattern_count
 #define ts_query_predicates_for_pattern fn_ts_query_predicates_for_pattern
 #define ts_query_string_value_for_id fn_ts_query_string_value_for_id
 #define ts_set_allocator fn_ts_set_allocator



reply via email to

[Prev in Thread] Current Thread [Next in Thread]