kickingvegas / casual-re-builder

A Transient porcelain for Emacs RE-Builder.
GNU General Public License v3.0
15 stars 1 forks source link

[[https://melpa.org/#/casual-re-builder][file:https://melpa.org/packages/casual-re-builder-badge.svg]]

[[file:docs/images/casual-re-builder-screenshot.png]]

** Goals

** Non-Goals

Casual RE-Builder has been verified with the following configuration.

If you use ~use-package~, here is the recipe for installing and configuring it.

+begin_src elisp :lexical no

(use-package re-builder :defer t)

(use-package casual-re-builder :ensure t :bind (:map reb-mode-map ("C-o" . casual-re-builder-tmenu) :map reb-lisp-mode-map ("C-o" . casual-re-builder-tmenu)) :after (re-builder))

+end_src

** A Note on Package Dependencies Casual RE-Builder requires Casual Lib which in turn requires a recent installation of Transient 0.6.0+ from either [[https://elpa.gnu.org/packages/transient.html][ELPA]] or [[https://melpa.org/#/transient][MELPA]]. As an older version of Transient is built-in to the Emacs release, the package manager ~package.el~ will /not/ update this package unless the customizable variable ~package-install-upgrade-built-in~ is set to ~t~. Set this variable and proceed with installing Casual RE-Builder. Alternately invoking ~package-install~ with a prefix (~C-u~) will temporarily coerce the update of the built-in package. (example: ~C-u M-x package-install~ ~casual-re-builder~)

As Transient is closely tied to Magit, installing the latest version of Magit (via [[https://elpa.nongnu.org/nongnu/magit.html][non-GNU ELPA]] or [[https://melpa.org/#/magit][MELPA]]) before installing Casual RE-Builder can also pick up the latest version of Transient.

** Basic Usage When the command ~re-builder~ is invoked, a buffer named "✳︎RE-Builder✳︎" is created. Activate Casual RE-Builder with the binding ~C-o~ (or one of your preference).

At the top of the menu shows the title "RE-Builder" with the target buffer enclosed in parenthesis. The regexp pattern will be applied to the target buffer. The target buffer can be changed with the /(b) Target buffer/ menu item.

Emacs supports three different regexp syntax: 1) read, 2) string, 3) Rx. Use the /(x) Syntax/ menu item to alter it. The current syntax is shown in parenthesis.

If multiple sub-expressions are in the regexp pattern, then they can be observed via the /(s) Subexp mode/ menu item.

If the regexp pattern entered in the "✳︎RE-Builder✳︎" finds multiple matches, a match can be navigated to via the /(p) Previous/ and /(n) Next/ menu items.

** Exporting the Regexp Pattern Once a desired regexp pattern is defined, there are two menu items that can be used to export (copy) it to the kill-ring for further use.

** Regexp Syntax Help The menu item /(i)/ will invoke the Info page for regexp syntax with respect to the current syntax type.

** Quitting RE-Builder Select /(q) Quit/ to exit the RE-Builder tool.

** Unicode Symbol Support By enabling “Use Unicode Symbols” from the Settings menu, Casual RE-Builder will use Unicode symbols as appropriate in its menus. The following mapping is shown in the table below:

| Name | Plain | Unicode | |-----------+----------+---------| | :previous | Previous | ↑ | | :next | Next | ↓ |

Each menu item has a /key/ and a /label/. The /key/ is what is typed by the user to select the menu item. A key can be prefixed with a meta (M-) or control (C-) key.

Dismissing a menu regardless of how deep you are in sub-menus can be done by entering ~C-q~. A menu can also be dismissed by entering ~C-g~, but this will return you to the parent menu.

If a mouse is available, a menu item can be selected by moving the mouse cursor over its label and pressing down button 1.

Pressing the ~?~ key will toggle help for all the menu items. Press the key of interest to get help for it.

When a Transient menu is raised, a prefix argument (~C-u~) can be entered before selecting a menu item.

[[https://www.buymeacoffee.com/kickingvegas][file:docs/images/default-yellow.png]]

Different interfaces include those for I-Search, Dired, Info, Calc, Bookmarks, IBuffer, and others. Learn more about them today!