diff options
| author | Stefan Kangas | 2023-01-31 06:30:26 +0100 |
|---|---|---|
| committer | Stefan Kangas | 2023-01-31 06:30:26 +0100 |
| commit | a73b046c7d5cb1d0eb2a69f2c96646d71dfbf66e (patch) | |
| tree | 18d04a295ded174262f97068c688f42ae4226a3b | |
| parent | e7d0aa248e684a6de0d655d93bfcfee06cc8ff09 (diff) | |
| parent | 1684e254a3b95b474753275fa9bfc2567a83b2fa (diff) | |
| download | emacs-a73b046c7d5cb1d0eb2a69f2c96646d71dfbf66e.tar.gz emacs-a73b046c7d5cb1d0eb2a69f2c96646d71dfbf66e.zip | |
Merge from origin/emacs-29
1684e254a3b Update to Transient v0.3.7-196-gb91f509
327941b2112 CC Mode: Fix a coding bug in c-make-keywords-re. This sh...
2f3683cd4dc * lisp/isearch.el (isearch-emoji-by-name): Disable derive...
86b03046c00 Merge branch 'emacs-29' of git.savannah.gnu.org:/srv/git/...
e866490a077 Fix keymap inheritance in descendants of 'c-ts-base-mode'
f67a9a12b7b Fix interactive use of `keymap-local-set' and `keymap-glo...
| -rw-r--r-- | doc/misc/transient.texi | 20 | ||||
| -rw-r--r-- | lisp/isearch.el | 9 | ||||
| -rw-r--r-- | lisp/progmodes/c-ts-mode.el | 6 | ||||
| -rw-r--r-- | lisp/progmodes/cc-defs.el | 7 | ||||
| -rw-r--r-- | lisp/transient.el | 40 |
5 files changed, 59 insertions, 23 deletions
diff --git a/doc/misc/transient.texi b/doc/misc/transient.texi index 62ab0ff3fcf..8ac5df9904c 100644 --- a/doc/misc/transient.texi +++ b/doc/misc/transient.texi | |||
| @@ -64,6 +64,15 @@ reading a new value in the minibuffer. | |||
| 64 | Calling a suffix command usually causes the transient to be exited | 64 | Calling a suffix command usually causes the transient to be exited |
| 65 | but suffix commands can also be configured to not exit the transient. | 65 | but suffix commands can also be configured to not exit the transient. |
| 66 | 66 | ||
| 67 | @quotation | ||
| 68 | The second part of this manual, which describes how to modify existing | ||
| 69 | transients and create new transients from scratch, can be hard to | ||
| 70 | digest if you are just getting started. A useful resource to get over | ||
| 71 | that hurdle is Psionic K's interactive tutorial, available at | ||
| 72 | @uref{https://github.com/positron-solutions/transient-showcase}. | ||
| 73 | |||
| 74 | @end quotation | ||
| 75 | |||
| 67 | @noindent | 76 | @noindent |
| 68 | This manual is for Transient version 0.3.7.50. | 77 | This manual is for Transient version 0.3.7.50. |
| 69 | 78 | ||
| @@ -893,7 +902,16 @@ same customization. | |||
| 893 | 902 | ||
| 894 | To an extent, transients can be customized interactively, see | 903 | To an extent, transients can be customized interactively, see |
| 895 | @ref{Enabling and Disabling Suffixes}. This section explains how existing | 904 | @ref{Enabling and Disabling Suffixes}. This section explains how existing |
| 896 | transients can be further modified non-interactively. | 905 | transients can be further modified non-interactively. Let's begin |
| 906 | with an example: | ||
| 907 | |||
| 908 | @lisp | ||
| 909 | (transient-append-suffix 'magit-patch-apply "-3" | ||
| 910 | '("-R" "Apply in reverse" "--reverse")) | ||
| 911 | @end lisp | ||
| 912 | |||
| 913 | This inserts a new infix argument to toggle the @code{--reverse} argument | ||
| 914 | after the infix argument that toggles @code{-3} in @code{magit-patch-apply}. | ||
| 897 | 915 | ||
| 898 | The following functions share a few arguments: | 916 | The following functions share a few arguments: |
| 899 | 917 | ||
diff --git a/lisp/isearch.el b/lisp/isearch.el index bb46c89ae20..22e27764127 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el | |||
| @@ -2774,6 +2774,7 @@ With argument, add COUNT copies of the character." | |||
| 2774 | (mapconcat 'isearch-text-char-description | 2774 | (mapconcat 'isearch-text-char-description |
| 2775 | string "")))))))) | 2775 | string "")))))))) |
| 2776 | 2776 | ||
| 2777 | (defvar emoji--derived) | ||
| 2777 | (defun isearch-emoji-by-name (&optional count) | 2778 | (defun isearch-emoji-by-name (&optional count) |
| 2778 | "Read an Emoji name and add it to the search string COUNT times. | 2779 | "Read an Emoji name and add it to the search string COUNT times. |
| 2779 | COUNT (interactively, the prefix argument) defaults to 1. | 2780 | COUNT (interactively, the prefix argument) defaults to 1. |
| @@ -2782,7 +2783,13 @@ The command accepts Unicode names like \"smiling face\" or | |||
| 2782 | (interactive "p") | 2783 | (interactive "p") |
| 2783 | (with-isearch-suspended | 2784 | (with-isearch-suspended |
| 2784 | (let ((emoji (with-temp-buffer | 2785 | (let ((emoji (with-temp-buffer |
| 2785 | (emoji-search) | 2786 | ;; Derived emoji not supported yet (bug#60740). |
| 2787 | ;; So first load `emoji--labels', then `emoji--init' | ||
| 2788 | ;; will not fill `emoji--derived' that is set | ||
| 2789 | ;; to an empty hash table below. | ||
| 2790 | (ignore-errors (require 'emoji-labels)) | ||
| 2791 | (let ((emoji--derived (make-hash-table :test #'equal))) | ||
| 2792 | (emoji-search)) | ||
| 2786 | (if (and (integerp count) (> count 1)) | 2793 | (if (and (integerp count) (> count 1)) |
| 2787 | (apply 'concat (make-list count (buffer-string))) | 2794 | (apply 'concat (make-list count (buffer-string))) |
| 2788 | (buffer-string))))) | 2795 | (buffer-string))))) |
diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 8e9852ed4ee..884fe6c3f15 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el | |||
| @@ -697,8 +697,8 @@ the semicolon. This function skips the semicolon." | |||
| 697 | 697 | ||
| 698 | ;;; Modes | 698 | ;;; Modes |
| 699 | 699 | ||
| 700 | (defvar-keymap c-ts-mode-map | 700 | (defvar-keymap c-ts-base-mode-map |
| 701 | :doc "Keymap for the C language with tree-sitter" | 701 | :doc "Keymap for C and C-like languages with tree-sitter" |
| 702 | :parent prog-mode-map | 702 | :parent prog-mode-map |
| 703 | "C-c C-q" #'c-ts-mode-indent-defun | 703 | "C-c C-q" #'c-ts-mode-indent-defun |
| 704 | "C-c ." #'c-ts-mode-set-style) | 704 | "C-c ." #'c-ts-mode-set-style) |
| @@ -707,7 +707,7 @@ the semicolon. This function skips the semicolon." | |||
| 707 | (define-derived-mode c-ts-base-mode prog-mode "C" | 707 | (define-derived-mode c-ts-base-mode prog-mode "C" |
| 708 | "Major mode for editing C, powered by tree-sitter. | 708 | "Major mode for editing C, powered by tree-sitter. |
| 709 | 709 | ||
| 710 | \\{c-ts-mode-map}" | 710 | \\{c-ts-base-mode-map}" |
| 711 | :syntax-table c-ts-mode--syntax-table | 711 | :syntax-table c-ts-mode--syntax-table |
| 712 | 712 | ||
| 713 | ;; Navigation. | 713 | ;; Navigation. |
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index bdbc03e7c94..aa6f33e9cab 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el | |||
| @@ -1994,7 +1994,7 @@ when it's needed. The default is the current language taken from | |||
| 1994 | ;; doesn't occur in any word in LIST. Append it to all | 1994 | ;; doesn't occur in any word in LIST. Append it to all |
| 1995 | ;; the alternatives where we want to add \>. Run through | 1995 | ;; the alternatives where we want to add \>. Run through |
| 1996 | ;; `regexp-opt' and then replace it with \>. | 1996 | ;; `regexp-opt' and then replace it with \>. |
| 1997 | (let ((unique "") pos) | 1997 | (let ((unique "") (list1 (copy-tree list)) pos) |
| 1998 | (while (let (found) | 1998 | (while (let (found) |
| 1999 | (setq unique (concat unique "@") | 1999 | (setq unique (concat unique "@") |
| 2000 | pos list) | 2000 | pos list) |
| @@ -2005,13 +2005,12 @@ when it's needed. The default is the current language taken from | |||
| 2005 | t)) | 2005 | t)) |
| 2006 | (setq pos (cdr pos))) | 2006 | (setq pos (cdr pos))) |
| 2007 | found)) | 2007 | found)) |
| 2008 | (setq pos (copy-tree list) | 2008 | (setq pos list1) |
| 2009 | ) | ||
| 2010 | (while pos | 2009 | (while pos |
| 2011 | (if (string-match "\\w\\'" (car pos)) | 2010 | (if (string-match "\\w\\'" (car pos)) |
| 2012 | (setcar pos (concat (car pos) unique))) | 2011 | (setcar pos (concat (car pos) unique))) |
| 2013 | (setq pos (cdr pos))) | 2012 | (setq pos (cdr pos))) |
| 2014 | (setq re (regexp-opt list)) | 2013 | (setq re (regexp-opt list1)) |
| 2015 | (setq pos 0) | 2014 | (setq pos 0) |
| 2016 | (while (string-match unique re pos) | 2015 | (while (string-match unique re pos) |
| 2017 | (setq pos (+ (match-beginning 0) 2) | 2016 | (setq pos (+ (match-beginning 0) 2) |
diff --git a/lisp/transient.el b/lisp/transient.el index 42268aedab7..0b41bc44adb 100644 --- a/lisp/transient.el +++ b/lisp/transient.el | |||
| @@ -798,8 +798,8 @@ They become the value of this argument.") | |||
| 798 | (defclass transient-columns (transient-group) () | 798 | (defclass transient-columns (transient-group) () |
| 799 | "Group class that displays elements organized in columns. | 799 | "Group class that displays elements organized in columns. |
| 800 | Direct elements have to be groups whose elements have to be | 800 | Direct elements have to be groups whose elements have to be |
| 801 | commands or string. Each subgroup represents a column. This | 801 | commands or strings. Each subgroup represents a column. |
| 802 | class takes care of inserting the subgroups' elements.") | 802 | This class takes care of inserting the subgroups' elements.") |
| 803 | 803 | ||
| 804 | (defclass transient-subgroups (transient-group) () | 804 | (defclass transient-subgroups (transient-group) () |
| 805 | "Group class that wraps other groups. | 805 | "Group class that wraps other groups. |
| @@ -860,7 +860,7 @@ to the setup function: | |||
| 860 | (indent defun) | 860 | (indent defun) |
| 861 | (doc-string 3)) | 861 | (doc-string 3)) |
| 862 | (pcase-let ((`(,class ,slots ,suffixes ,docstr ,body) | 862 | (pcase-let ((`(,class ,slots ,suffixes ,docstr ,body) |
| 863 | (transient--expand-define-args args))) | 863 | (transient--expand-define-args args arglist))) |
| 864 | `(progn | 864 | `(progn |
| 865 | (defalias ',name | 865 | (defalias ',name |
| 866 | ,(if body | 866 | ,(if body |
| @@ -913,7 +913,7 @@ ARGLIST. The infix arguments are usually accessed by using | |||
| 913 | (indent defun) | 913 | (indent defun) |
| 914 | (doc-string 3)) | 914 | (doc-string 3)) |
| 915 | (pcase-let ((`(,class ,slots ,_ ,docstr ,body) | 915 | (pcase-let ((`(,class ,slots ,_ ,docstr ,body) |
| 916 | (transient--expand-define-args args))) | 916 | (transient--expand-define-args args arglist))) |
| 917 | `(progn | 917 | `(progn |
| 918 | (defalias ',name (lambda ,arglist ,@body)) | 918 | (defalias ',name (lambda ,arglist ,@body)) |
| 919 | (put ',name 'interactive-only t) | 919 | (put ',name 'interactive-only t) |
| @@ -921,7 +921,7 @@ ARGLIST. The infix arguments are usually accessed by using | |||
| 921 | (put ',name 'transient--suffix | 921 | (put ',name 'transient--suffix |
| 922 | (,(or class 'transient-suffix) :command ',name ,@slots))))) | 922 | (,(or class 'transient-suffix) :command ',name ,@slots))))) |
| 923 | 923 | ||
| 924 | (defmacro transient-define-infix (name _arglist &rest args) | 924 | (defmacro transient-define-infix (name arglist &rest args) |
| 925 | "Define NAME as a transient infix command. | 925 | "Define NAME as a transient infix command. |
| 926 | 926 | ||
| 927 | ARGLIST is always ignored and reserved for future use. | 927 | ARGLIST is always ignored and reserved for future use. |
| @@ -962,7 +962,7 @@ keyword. | |||
| 962 | (indent defun) | 962 | (indent defun) |
| 963 | (doc-string 3)) | 963 | (doc-string 3)) |
| 964 | (pcase-let ((`(,class ,slots ,_ ,docstr ,_) | 964 | (pcase-let ((`(,class ,slots ,_ ,docstr ,_) |
| 965 | (transient--expand-define-args args))) | 965 | (transient--expand-define-args args arglist))) |
| 966 | `(progn | 966 | `(progn |
| 967 | (defalias ',name ,(transient--default-infix-command)) | 967 | (defalias ',name ,(transient--default-infix-command)) |
| 968 | (put ',name 'interactive-only t) | 968 | (put ',name 'interactive-only t) |
| @@ -980,7 +980,9 @@ example, sets a variable use `transient-define-infix' instead. | |||
| 980 | 980 | ||
| 981 | \(fn NAME ARGLIST [DOCSTRING] [KEYWORD VALUE]...)") | 981 | \(fn NAME ARGLIST [DOCSTRING] [KEYWORD VALUE]...)") |
| 982 | 982 | ||
| 983 | (defun transient--expand-define-args (args) | 983 | (defun transient--expand-define-args (args &optional arglist) |
| 984 | (unless (listp arglist) | ||
| 985 | (error "Mandatory ARGLIST is missing")) | ||
| 984 | (let (class keys suffixes docstr) | 986 | (let (class keys suffixes docstr) |
| 985 | (when (stringp (car args)) | 987 | (when (stringp (car args)) |
| 986 | (setq docstr (pop args))) | 988 | (setq docstr (pop args))) |
| @@ -1150,7 +1152,7 @@ example, sets a variable use `transient-define-infix' instead. | |||
| 1150 | PREFIX is a prefix command, a symbol. | 1152 | PREFIX is a prefix command, a symbol. |
| 1151 | SUFFIX is a suffix command or a group specification (of | 1153 | SUFFIX is a suffix command or a group specification (of |
| 1152 | the same forms as expected by `transient-define-prefix'). | 1154 | the same forms as expected by `transient-define-prefix'). |
| 1153 | Intended for use in PREFIX's `:setup-children' function." | 1155 | Intended for use in a group's `:setup-children' function." |
| 1154 | (eval (car (transient--parse-child prefix suffix)))) | 1156 | (eval (car (transient--parse-child prefix suffix)))) |
| 1155 | 1157 | ||
| 1156 | (defun transient-parse-suffixes (prefix suffixes) | 1158 | (defun transient-parse-suffixes (prefix suffixes) |
| @@ -1158,7 +1160,7 @@ Intended for use in PREFIX's `:setup-children' function." | |||
| 1158 | PREFIX is a prefix command, a symbol. | 1160 | PREFIX is a prefix command, a symbol. |
| 1159 | SUFFIXES is a list of suffix command or a group specification | 1161 | SUFFIXES is a list of suffix command or a group specification |
| 1160 | (of the same forms as expected by `transient-define-prefix'). | 1162 | (of the same forms as expected by `transient-define-prefix'). |
| 1161 | Intended for use in PREFIX's `:setup-children' function." | 1163 | Intended for use in a group's `:setup-children' function." |
| 1162 | (mapcar (apply-partially #'transient-parse-suffix prefix) suffixes)) | 1164 | (mapcar (apply-partially #'transient-parse-suffix prefix) suffixes)) |
| 1163 | 1165 | ||
| 1164 | ;;; Edit | 1166 | ;;; Edit |
| @@ -1469,14 +1471,24 @@ probably use this instead: | |||
| 1469 | (cl-check-type command command)) | 1471 | (cl-check-type command command)) |
| 1470 | (if (or transient--prefix | 1472 | (if (or transient--prefix |
| 1471 | transient-current-prefix) | 1473 | transient-current-prefix) |
| 1472 | (cl-find-if (lambda (obj) | 1474 | (let ((suffixes |
| 1473 | (eq (transient--suffix-command obj) | 1475 | (cl-remove-if-not |
| 1476 | (lambda (obj) | ||
| 1477 | (eq (transient--suffix-command obj) | ||
| 1478 | (or command | ||
| 1474 | ;; When `this-command' is `transient-set-level', | 1479 | ;; When `this-command' is `transient-set-level', |
| 1475 | ;; its reader needs to know what command is being | 1480 | ;; its reader needs to know what command is being |
| 1476 | ;; configured. | 1481 | ;; configured. |
| 1477 | (or command this-original-command))) | 1482 | this-original-command))) |
| 1478 | (or transient--suffixes | 1483 | (or transient--suffixes |
| 1479 | transient-current-suffixes)) | 1484 | transient-current-suffixes)))) |
| 1485 | (or (and (cdr suffixes) | ||
| 1486 | (cl-find-if | ||
| 1487 | (lambda (obj) | ||
| 1488 | (equal (listify-key-sequence (transient--kbd (oref obj key))) | ||
| 1489 | (listify-key-sequence (this-command-keys)))) | ||
| 1490 | suffixes)) | ||
| 1491 | (car suffixes))) | ||
| 1480 | (when-let* ((obj (get (or command this-command) 'transient--suffix)) | 1492 | (when-let* ((obj (get (or command this-command) 'transient--suffix)) |
| 1481 | (obj (clone obj))) | 1493 | (obj (clone obj))) |
| 1482 | ;; Cannot use and-let* because of debbugs#31840. | 1494 | ;; Cannot use and-let* because of debbugs#31840. |