diff --git a/docs/configuration.org b/docs/configuration.org index 7915362..66d60a2 100644 --- a/docs/configuration.org +++ b/docs/configuration.org @@ -512,4 +512,46 @@ :PROPERTIES: :CUSTOM_ID: customizing_the_menu :END: - Please refer to the [[https://magit.vc/manual/transient/Modifying-Existing-Transients.html#Modifying-Existing-Transients][transient]] documentation for customizing the menu. + The menu can be modified from the emacs configuration file. + + To add a new *switch* before the option triggered by =-n= at suffix + level 3: + #+BEGIN_SRC elisp + (transient-insert-suffix 'rg-menu "-n" '(3 "-o" "Only print matches" "--only-matching")) + #+END_SRC + To add a new *option* before the option triggered by =-g= at suffix + level 4: + #+BEGIN_SRC elisp + (transient-insert-suffix 'rg-menu "-g" '(4 "-f" "Pattern file" "--file=")) + #+END_SRC + The === in =--file== triggers argument input for the flag. + + To remove an item from the menu specify the trigger key in the + transient remove command. + For example, to remove the =Search hidden files= switch use the following: + #+BEGIN_SRC elisp + (transient-remove-suffix 'rg-menu "-h") + #+END_SRC + + Please refer to the [[https://magit.vc/manual/transient/Modifying-Existing-Transients.html#Modifying-Existing-Transients][transient]] documentation for details on customizing the menu. + + This package also adds a convenience function for appending new + *commands* to the menu in the groups at the bottom. + + :FUNCTION: + #+BEGIN_SRC elisp :results value raw :exports results + (rg-function-info 'rg-menu-transient-insert) + #+END_SRC + This inserts a new command under =group= if it exists, otherwise a + new group is created. =key=, =description= and =command= is as for + the =transient-insert-suffix= function. + + For example to insert a new command under =Search= group: + #+BEGIN_SRC elisp + (rg-menu-transient-insert "Search" "m" "My search" 'my-search-command) + #+END_SRC + + It's usually better to use the =:menu= key of the [[func:rg-define-search]] + macro to define a search function and adding it to the menu in one go. + :END: +