~protesilaos/substitute

2e971d244c03a4b29925fc33a991355ceaa9318a — Protesilaos Stavrou 1 year, 5 months ago b81bb77 0.2.0
Update to version 0.2.0

The package has been in a stable state since its inception, to the
point where I thought I had already formalised its latest version as a
release...

The value proposition of 'substitute' is shown in the video I did for
it: <https://protesilaos.com/codelog/2023-01-16-emacs-substitute-package-demo/>.

Notable refinements:

* It is now possible to substitute a target with an empty string.  We
  could not do that with 'read-string' function that was originally in
  use, as the empty input is automatically interpreted as the value of
  the DEFAULT-VALUE argument that 'read-string' gets.  This is
  standard for most Emacs minibuffer interactions, though in our case
  it makes sense to accept an empty string that is distinct from the
  default value, as we may, e.g., want to remove a prefix from a
  target.  Thanks to Kostas Andreadis for discussing this with me in
  issue 2 on the GitHub mirror as well as pull request 3:

  - <https://github.com/protesilaos/substitute/issues/2>
  - <https://github.com/protesilaos/substitute/pull/3>

* Target strings that contain escape sequences do not confuse
  Substitute anymore.  The substitution will be performed as expected.
  Thanks to Kostas Andreadis for the contribution, which was done in
  pull request 3 on the GitHub mirror:
  <https://github.com/protesilaos/substitute/pull/3>.

* Calling 'undo' after a substitution no longer moves the point.  This
  is consistent with the behaviour of Substitute when it replaces the
  target text.  Thanks to Ed Tavinor for the patch, which was done via
  a private channel.

* Normally, Substitute will retain the letter casing of the underlying
  target.  This means that if it is replacing "hello" with "hey" and
  there is a "HELLO" instance, it will replace it with "HEY".  This is
  often the desired behaviour.  Though now all Substitute commands
  accept an optional prefix argument ('C-u' with default key
  bindings), which is interpreted as a "fixed case" substitution: the
  user input is applied as-is, regardless of the underlying letter
  casing.  To always have fixed letter casing, set the user option
  'substitute-fixed-letter-case' to a non-nil value.  Doing so is the
  same as always calling the commands with a prefix argument.  Thanks
  to revrari for bringing this matter to my attention in issue 4 on
  the GitHub mirror:
  <https://github.com/protesilaos/substitute/issues/4>.

* Substitute will not even try to perform its task in a read-only
  buffer.  Thanks to ersi-dnd for bringing this matter to my
  attention.  This was done in issue 6 on the GitHub mirror:
  <https://github.com/protesilaos/substitute/issues/6>.

* The built-in 'subr-x' library is explicitly required to avoid byte
  compilation warnings.  Thanks to Chunye Wang for the contribution,
  which was done in pull request 1 on the GitHub mirror:
  <https://github.com/protesilaos/substitute/pull/1>.

The code contributions from Ed Tavinor, Kostas Andreadis, and Chunye
Wang are small, meaning that their respective authors do not need to
assign copyright to the Free Software Foundation.
2 files changed, 4 insertions(+), 7 deletions(-)

M README.org
M substitute.el
M README.org => README.org +3 -6
@@ 4,9 4,9 @@
#+language:              en
#+options:               ':t toc:nil author:t email:t num:t
#+startup:               content
#+macro:                 stable-version 0.1.0
#+macro:                 release-date 2023-01-16
#+macro:                 development-version 0.2.0-dev
#+macro:                 stable-version 0.2.0
#+macro:                 release-date 2023-07-01
#+macro:                 development-version 0.3.0-dev
#+export_file_name:      substitute.texi
#+texinfo_filename:      substitute.info
#+texinfo_dir_category:  Emacs misc features


@@ 99,9 99,6 @@ scope are as follows:
4. ~substitute-target-above-point~: Substitute the target from point
   to the beginning of the buffer (alias ~substitute-target-to-beginning-of-buffer~).

[ The ~substitute-fixed-letter-case~ and the =FIXED-CASE= prefix
  argument for all commands is part of {{{development-version}}}. ]

#+vindex: substitute-fixed-letter-case
All of the aforementioned commands accept an optional prefix argument
(=C-u= with the default key bindings).  This passes the =FIXED-CASE=

M substitute.el => substitute.el +1 -1
@@ 6,7 6,7 @@
;; Maintainer: Protesilaos Stavrou General Issues <~protesilaos/general-issues@lists.sr.ht>
;; URL: https://git.sr.ht/~protesilaos/substitute
;; Mailing-List: https://lists.sr.ht/~protesilaos/general-issues
;; Version: 0.1.8
;; Version: 0.2.0
;; Package-Requires: ((emacs "27.1"))

;; This file is NOT part of GNU Emacs.