kickingvegas / casual-editkit

Casual EditKit is a Transient library for Emacs editing commands.
GNU General Public License v3.0
9 stars 2 forks source link

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

[[file:docs/images/casual-editkit-main-screenshot.png]]

Casual EditKit endeavors to surface the many different editing commands offered by Emacs via Transient menus. Included in this library are menus for:

A main menu (~casual-editkit-main-tmenu~) demonstrating all of the above is provided as a reference model. This reference model can be used as is. More motivated users can use the reference model as a template to build their own customized menus.

** Goals

** Non-Goals

Casual EditKit has been verified with the following configuration.

+begin_src elisp :lexical no

(require 'casual-editkit) ;; optional (keymap-global-set "C-o" #'casual-editkit-main-tmenu)

+end_src

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

+begin_src elisp :lexical no

(use-package casual-editkit :ensure nil :bind (("C-o" . casual-editkit-main-tmenu)))

+end_src

For motivated users desiring a bespoke solution, it is recommended that they use Casual EditKit as a library of menus to build their own workflows.

** A Note on Package Dependencies Casual EditKit 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 EditKit. 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-editkit~)

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 EditKit can also pick up the latest version of Transient.

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.

Transient supports nested menus. Exiting a menu can be done in two ways:

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 or ~C-h~ 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~) and an optional argument can be entered before selecting a menu item.

** Register commands (~casual-editkit-registers-tmenu~) Register commands for saving and recalling text, point, window configuration, and keyboard macros are supported here.

[[file:docs/images/casual-editkit-registers-screenshot.png]]

** Rectangle commands (~casual-editkit-rectangle-tmenu~) This menu offers all the rectangle commands. It is packaged as a sub-menu of ~casual-editkit-edit-tmenu~.

[[file:docs/images/casual-editkit-rectangle-screenshot.png]]

** Edit commands (~casual-editkit-edit-tmenu~) This menu contains commands and sub-menus related to editing text.

[[file:docs/images/casual-editkit-edit-screenshot.png]]

Depending on the buffer mode, text can be operated on with different granularity as words, sentences, paragraphs, balanced expressions, functions (defuns). The following sub-menus illustrate what operations can be done on the different text granularity.

*** Mark (~casual-editkit-mark-tmenu~) Text can be marked with different granularity with this menu. Note that marking functions (Defun) is only supported for modes derived from ~prog-mode~.

[[file:docs/images/casual-editkit-mark-screenshot.png]]

*** Copy (~casual-editkit-copy-tmenu~) Text can be copied with different granularity with this menu. [[file:docs/images/casual-editkit-copy-screenshot.png]]

*** Kill (Cut) (~casual-editkit-kill-tmenu~) Text can be cut (killed) with different granularity with this menu. [[file:docs/images/casual-editkit-kill-screenshot.png]]

*** Move (~casual-editkit-move-tmenu~) Text can be moved forwards or backwards with different granularity with this menu. Note that selecting a granularity will raise another menu to allow selection of direction (forward, backward) the text is to be moved. To enable repeat operation, that menu is persisted and must be dismissed either with either ~C-q~ (dismiss all) or ~C-g~ (dismiss to previous menu). [[file:docs/images/casual-editkit-move-screenshot.png]]

*** Transpose (~casual-editkit-transpose-tmenu~) Text can be transposed with different granularity with this menu.

[[file:docs/images/casual-editkit-transpose-screenshot.png]]

*** Transform (~casual-editkit-transform-tmenu~) Text can be transformed with different granularity with this menu. Supported transformations are capitalization, lower and upper casing of text.

[[file:docs/images/casual-editkit-transform-screenshot.png]]

*** Delete (~casual-editkit-delete-tmenu~) Operations involving text deletion are included in this menu, including joining lines and zapping to a character.

[[file:docs/images/casual-editkit-delete-screenshot.png]]

*** Sort (~casual-editkit-sort-tmenu~) Sorting operations on different sections of text are supported, as well as support for sorting off a field. Press ~?~ or ~C-h~ to get help for a specific command.

[[file:docs/images/casual-editkit-sort-screenshot.png]]

** Window management (~casual-editkit-window-tmenu~) This menu provides support for different Emacs window management commands. Note that in Emacs, /window/ is defined [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Basic-Windows.html#:~:text=A%20window%20is%20an%20area,view%20several%20buffers%20at%20once.][differently]] than its usage in contemporary graphical user interfaces. [[file:docs/images/casual-editkit-window-screenshot.png]]

If the variable ~casual-lib-use-unicode~ is set to ~t~, then Unicode symbols are used in the labels.

[[file:docs/images/casual-editkit-window-unicode-screenshot.png]]

*** Deletion (~casual-editkit-window-delete-tmenu~) This menu provides support for deleting windows. [[file:docs/images/casual-editkit-window-delete-screenshot.png]]

** Search & Replace commands (~casual-editkit-search-tmenu~) Operations related to search and replace are captured by this menu. Note that this menu uses Transient prefix arguments (~--backward~ and ~--regexp~). This is because some commands have variants involving direction and whether to search using a regexp. Commands that support direction will by default operate forward of the current point if ~--backward~ is not enabled.

[[file:docs/images/casual-editkit-search-screenshot.png]]

* Open commands (~casual-editkit-open-tmenu~) Commands related to opening a file (either for writing or read-only) are supported here. The Project* sub-menu is also offered here.

[[file:docs/images/casual-editkit-open-screenshot.png]]

** Project commands (~casual-editkit-project-tmenu~) Project-related commands are listed in this menu.

[[file:docs/images/casual-editkit-project-screenshot.png]]

** Bookmark commands (~casual-editkit-bookmarks-tmenu~) Commands edit, add, or jump to a bookmark are captured in this menu.

[[file:docs/images/casual-editkit-bookmarks-screenshot.png]]

** Tool commands (~casual-editkit-tools-tmenu~) This menu holds an assorted collection of different tools/utilities provided by Emacs. Motivated users can use this Transient prefix as starting point to create a menu customized to their needs.

[[file:docs/images/casual-editkit-tools-screenshot.png]]

** Macro (~casual-editkit-macro-tmenu~) Commands for managing macros are provided for by this menu. Note that macro creation commands are /not/ supported as they are tightly-bound to keybindings.

[[file:docs/images/casual-editkit-macro-screenshot.png]]

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

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