[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/substitute 591d6df15b 38/39: Expand README; add video d
From: |
ELPA Syncer |
Subject: |
[elpa] externals/substitute 591d6df15b 38/39: Expand README; add video demo |
Date: |
Mon, 16 Jan 2023 11:58:52 -0500 (EST) |
branch: externals/substitute
commit 591d6df15b485a697a26fcc6cb3e0ba1cfc57cdb
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Expand README; add video demo
---
README.md | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++----------
1 file changed, 74 insertions(+), 14 deletions(-)
diff --git a/README.md b/README.md
index e879fbc2fe..b119573262 100644
--- a/README.md
+++ b/README.md
@@ -1,19 +1,72 @@
# Substitute (substitute.el)
-Read: <https://protesilaos.com/codelog/2023-01-14-emacs-substitute-package/>.
-
Efficiently replace targets in the buffer or context.
-Sample configuration:
+**Video demo:**
<https://protesilaos.com/codelog/2023-01-16-emacs-substitute-package-demo/>
+
++ Package name (GNU ELPA): `substitute`
++ Git repo on SourceHut: <https://git.sr.ht/~protesilaos/substitute>
+ - Mirrors:
+ + GitHub: <https://github.com/protesilaos/substitute>
+ + GitLab: <https://gitlab.com/protesilaos/substitute>
++ Mailing list: <https://lists.sr.ht/~protesilaos/general-issues>
++ Backronym: Some Utilities Built to Substitute Targets Independent of
+ Their Utterances, Thoroughly and Easily.
+
+## Overview
+
+Substitute is a set of commands that perform text replacement (i)
+throughout the buffer, (ii) limited to the current definition (per
+`narrow-to-defun`), (iii) from point to the end of the buffer, and
+(iv) from point to the beginning of the buffer.
+
+These substitutions are meant to be as quick as possible and, as such,
+differ from the standard `query-replace` (which I still use). The
+provided commands prompt for substitute text and perform the
+substitution outright.
+
+The substitution prompt mentions the target-to-be-substituted. It is
+possible to use the "future history" at this prompt (by typing `M-n`
+with the default key bindings for the `next-history-element` command).
+This populates the prompt with the text of the target. As such, if we
+want to operate on `FOO` to make it `FOO-BAR`, we use `M-n` and then
+append `-BAR`.
+
+By default, the design is visually austere: the substitution prompt
+informs the user about the target but otherwise does not highlight
+anything. The post-substitution stage is also silent, with no report
+on how many occurrences were replaced. This can be changed so that
+the substitution prompt highlights occurrences (like `isearch`) and
+the post-substitution stage prints an informative message on what
+changed and where. Refer to the "Sample configuration" further below.
+
+The substitution commands behave the same way except for their scope
+of application. What they have in common is how they identify the
+target of the substitution: it is either the symbol at point or the
+text within the boundaries of the active region. The differences in
+scope are as follows:
+
+1. `substitute-target-in-buffer`: Substitute the target across the
+ entire buffer.
+2. `substitute-target-in-defun`: Substitute the target only in the
+ current definition (per `narrow-to-defun`).
+3. `substitute-target-below-point`: Substitute the target from point
+ to the end of the buffer (alias
+ `substitute-target-to-end-of-buffer`).
+4. `substitute-target-above-point`: Substitute the target from point
+ to the beginning of the buffer (alias
+ `substitute-target-to-beginning-of-buffer`).
+
+## Sample configuration
```elisp
(require 'substitute)
-;; If you like visual feedback on matching target. Default is nil.
+;; If you like visual feedback on the matching target. Default is nil.
(setq substitute-highlight t)
-;; If you want a message reporting the matches that changed. We don't
-;; do it by default
+;; If you want a message reporting the matches that changed in the
+;; given context. We don't do it by default.
(add-hook 'substitute-post-replace-hook #'substitute-report-operation)
;; We do not bind any keys. This is just an idea. The mnemonic is
@@ -25,11 +78,18 @@ Sample configuration:
(define-key map (kbd "M-# b") #'substitute-target-in-buffer))
```
-+ Package name (GNU ELPA): `substitute` (not available yet)
-+ Git repo on SourceHut: <https://git.sr.ht/~protesilaos/substitute>
- - Mirrors:
- + GitHub: <https://github.com/protesilaos/substitute>
- + GitLab: <https://gitlab.com/protesilaos/substitute>
-+ Mailing list: <https://lists.sr.ht/~protesilaos/general-issues>
-+ Backronym: Some Utilities Built to Substitute Targets Independent of
- Their Utterances, Thoroughly and Easily.
+## Why this instead of `multiple-cursors` or `iedit`
+
+What I do not like about those packages is that they are visually
+"busy". Oftentimes, I want to perform a replacement in some context
+with multiple occurrences of a given target. Using either of those
+echoes my input across all occurrences, resulting in a dance of sorts
+within the buffer as texts moves around. I find that disorienting.
+Beside that, I do not need the visual feedback as I already know what
+I want to do: the default minimalist presentation of `substitute`
+provides all the information I need.
+
+Otherwise, this package is small and limited in scope. Beside
+`substitute`, I also use, keyboard macros, `query-replace`, and,
+rarely `rectangle-mark-mode` in tandem with `string-rectangle`. I
+have no need for `multiple-cursors` or `iedit`.
- [elpa] externals/substitute cdb23ab35c 17/39: Reference blog post in the README, (continued)
- [elpa] externals/substitute cdb23ab35c 17/39: Reference blog post in the README, ELPA Syncer, 2023/01/16
- [elpa] externals/substitute e90152fc90 18/39: Bump version for package-vc-rebuild to do its job, ELPA Syncer, 2023/01/16
- [elpa] externals/substitute e55a121666 25/39: Make minor formatting change, ELPA Syncer, 2023/01/16
- [elpa] externals/substitute be5b7f3e71 11/39: Streamline all commands with a macro, ELPA Syncer, 2023/01/16
- [elpa] externals/substitute a1382f1860 19/39: Tweak substitute backronym, ELPA Syncer, 2023/01/16
- [elpa] externals/substitute 8431c6b54d 20/39: Make local variables less verbose, ELPA Syncer, 2023/01/16
- [elpa] externals/substitute 178453e3a4 22/39: Rename scope functions; make code cleaner, ELPA Syncer, 2023/01/16
- [elpa] externals/substitute 0c3e1c79ca 26/39: Add indentation in one place, ELPA Syncer, 2023/01/16
- [elpa] externals/substitute b8cd86b7b8 28/39: Add FIXME, ELPA Syncer, 2023/01/16
- [elpa] externals/substitute f5b7b373b1 30/39: Make link to blog easier to find, ELPA Syncer, 2023/01/16
- [elpa] externals/substitute 591d6df15b 38/39: Expand README; add video demo,
ELPA Syncer <=
- [elpa] externals/substitute af56e87099 31/39: Refine how description of scope is made, ELPA Syncer, 2023/01/16
- [elpa] externals/substitute 86423acf44 37/39: Use correct word in a couple of places, ELPA Syncer, 2023/01/16
- [elpa] externals/substitute 731cb688e2 39/39: Bump version to trigger GNU ELPA build, ELPA Syncer, 2023/01/16
- [elpa] externals/substitute 3f2e429e2d 32/39: Refine substitute-command macro, ELPA Syncer, 2023/01/16
- [elpa] externals/substitute b665f84d4b 14/39: Reuse code in substitute--prompt-with-highlight, ELPA Syncer, 2023/01/16
- [elpa] externals/substitute 89c3389e1c 15/39: Rename local variable for clarity, ELPA Syncer, 2023/01/16
- [elpa] externals/substitute 45096c23d2 16/39: Update symbol of command for clarity, ELPA Syncer, 2023/01/16
- [elpa] externals/substitute f45d238078 21/39: Add missing word in doc string, ELPA Syncer, 2023/01/16
- [elpa] externals/substitute 8ac3904158 23/39: Simplify substitute--setup-scope, ELPA Syncer, 2023/01/16
- [elpa] externals/substitute 73a1904ea4 24/39: Do not check for fn in 'while' loop, ELPA Syncer, 2023/01/16