branch: externals/substitute
commit cb15c1b4c974f9a04c60af7c58590dcd85578d69
Author: Protesilaos Stavrou <[email protected]>
Commit: Protesilaos Stavrou <[email protected]>
Upgrade substitute to version 0.5.0
This is a small release that fixes a bug and adds a relevant user option.
The bug pertained to the scope of the substitution when buffer
narrowing was in effect. All commands would ignore narrowing and also
fail to properly clear the highlights they apply (highlights are
transiently in effect to show what the target of the substitution is
while the minibuffer is waiting for user input).
Now all commands do the right thing with respect to buffer narrowing.
Though their exact behaviour depends on the value of the new user
option 'substitute-ignore-narrowing':
- When the value of 'substitute-ignore-narrowing' is non-'nil', then
substitutions apply to the actual scope of the given command. For
example, 'substitute-target-in-buffer' will cover the whole buffer
from the absolute minimum position to the absolute maximum position
even if narrowing is in effect.
- When the value of 'substitute-ignore-narrowing' is 'nil', then
substitutions apply to their scope subject to the boundaries of the
narrowed buffer. For example, 'substitute-target-in-buffer' will
understand as "whole buffer" the region between the minimum and
maximum positions of the narrowed buffer.
Users can write small convenience commands that do either of those,
depending on preference. For example:
(defun my-substitute-target-in-buffer-with-narrowing ()
"Call `substitute-target-in-buffer' with
`substitute-ignore-narrowing' as `nil'."
(let ((substitute-ignore-narrowing nil))
(call-interactively 'substitute-target-in-buffer)))
(defun my-substitute-target-in-buffer-without-narrowing ()
"Call `substitute-target-in-buffer' with
`substitute-ignore-narrowing' as non-`nil'."
(let ((substitute-ignore-narrowing t))
(call-interactively 'substitute-target-in-buffer)))
Thanks to zauberen for reporting the bug in issue 11:
<https://github.com/protesilaos/substitute/issues/11>.
---
README.org | 10 +++++-----
substitute.el | 4 ++--
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/README.org b/README.org
index 3fa2938825..98c126d042 100644
--- a/README.org
+++ b/README.org
@@ -4,9 +4,9 @@
#+language: en
#+options: ':t toc:nil author:t email:t num:t
#+startup: content
-#+macro: stable-version 0.4.0
-#+macro: release-date 2025-11-29
-#+macro: development-version 0.5.0-dev
+#+macro: stable-version 0.5.0
+#+macro: release-date 2026-01-05
+#+macro: development-version 0.6.0-dev
#+export_file_name: substitute.texi
#+texinfo_filename: substitute.info
#+texinfo_dir_category: Emacs misc features
@@ -230,7 +230,7 @@ default. This is controlled by the user option
~substitute-ignore-narrowing~.
What this means is that a command such as ~substitute-target-in-buffer~
will make changes across the buffer even if narrowing is in effect.
Users who prefer to operate only within the narrowed portion of the
-buffer must set ~substitute-ignore-narrowing~ to ~nil~. [ Part of
{{{development-version}}}. ]
+buffer must set ~substitute-ignore-narrowing~ to ~nil~.
#+vindex: substitute-post-replace-functions
#+findex: substitute-report-operation
@@ -286,7 +286,7 @@ matters.
:COPYING: t
:END:
-Copyright (C) 2023-2025 Free Software Foundation, Inc.
+Copyright (C) 2023-2026 Free Software Foundation, Inc.
#+begin_quote
Permission is granted to copy, distribute and/or modify this document
diff --git a/substitute.el b/substitute.el
index 7235258cb6..332bef3bab 100644
--- a/substitute.el
+++ b/substitute.el
@@ -1,11 +1,11 @@
;;; substitute.el --- Efficiently replace targets in the buffer or context -*-
lexical-binding: t -*-
-;; Copyright (C) 2023-2025 Free Software Foundation, Inc.
+;; Copyright (C) 2023-2026 Free Software Foundation, Inc.
;; Author: Protesilaos Stavrou <[email protected]>
;; Maintainer: Protesilaos Stavrou <[email protected]>
;; URL: https://github.com/protesilaos/substitute
-;; Version: 0.4.0
+;; Version: 0.5.0
;; Package-Requires: ((emacs "27.1"))
;; This file is NOT part of GNU Emacs.