From: Drew Adams <drew.adams@oracle.com>
To: Juri Linkov <juri@linkov.net>
Cc: 18388@debbugs.gnu.org
Subject: bug#18388: 24.4.50; REGRESSION: incompatible change to `replace-match-maybe-edit' (and no doc)
Date: Fri, 5 Feb 2016 17:40:37 -0800 (PST) [thread overview]
Message-ID: <0d78b1ce-867e-4f1e-bcba-4dc765cf0749@default> (raw)
In-Reply-To: <871t8qps15.fsf@mail.linkov.net>
> >> You added argument BACKWARD to this function, and you did not add it as
> >> an &optional parameter. This breaks all existing code that uses the
> >> function. The parameter should be &optional.
> >>
> >> What's more, you did not even mention the new arg in the doc string.
> >
> > ping
>
> I wonder what code and how might use this internal function?
Does it matter? Could you please make the parameter optional
(and document it)?
This code uses it:
http://www.emacswiki.org/emacs/download/icicles-cmd2.el
See the definition of `icicle-search-replace-match'.
Here is that definition, if you don't want to look at it in context:
(defun icicle-search-replace-match (replacement fixedcase)
"Replace current match with REPLACEMENT, interpreting escapes.
If REPLACEMENT is a function then call that function on the match
string and use the result as the replacement.
Otherwise, REPLACEMENT is a string, and it is treated as it would be
treated by `query-replace-regexp'.
FIXEDCASE is as for `replace-match'. Non-nil means do not alter case."
(if (functionp replacement)
(condition-case icicle-search-replace-match0
(replace-match (funcall replacement (match-string 0)) fixedcase icicle-search-replace-literally-flag)
(error (replace-match (funcall replacement (match-string 0)) fixedcase t)))
(if (fboundp 'query-replace-compile-replacement) ; Emacs 22+.
(let ((compiled
(save-match-data
(query-replace-compile-replacement replacement
(not icicle-search-replace-literally-flag)))))
(condition-case icicle-search-replace-match1
(let ((enable-recursive-minibuffers t) ; So we can read input from \?.
;; Save and restore these, because we might read input from \?.
(icicle-last-completion-command icicle-last-completion-command)
(icicle-last-input icicle-last-input))
(replace-match-maybe-edit
(if (consp compiled)
;; `replace-count' is free here, bound in `icicle-search'.
(funcall (car compiled) (cdr compiled) (setq replace-count (1+ replace-count)))
compiled)
fixedcase icicle-search-replace-literally-flag nil (match-data)
nil)) ; BACKWARD parameter for Emacs 24.4+ - see bug #18388
;; @@@@@@ Hopefully this is only a temporary hack, until Emacs bug #18388 is fixed.
(wrong-number-of-arguments
(condition-case icicle-search-replace-match3
(replace-match-maybe-edit
(if (consp compiled)
;; `replace-count' is free here, bound in `icicle-search'.
(funcall (car compiled) (cdr compiled) (setq replace-count (1+ replace-count)))
compiled)
fixedcase icicle-search-replace-literally-flag nil (match-data))
(buffer-read-only (ding) (icicle-user-error "Buffer is read-only"))
(error (icicle-remove-Completions-window) (icicle-user-error "No match for `%s'" replacement))))
(buffer-read-only (ding) (icicle-user-error "Buffer is read-only"))
(error (icicle-remove-Completions-window) (icicle-user-error "No match for `%s'" replacement))))
(condition-case icicle-search-replace-match2 ; Emacs < 22. Try to interpret `\'.
(replace-match replacement fixedcase icicle-search-replace-literally-flag)
(error (replace-match replacement fixedcase t))))))
next prev parent reply other threads:[~2016-02-06 1:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-02 13:28 bug#18388: 24.4.50; REGRESSION: incompatible change to `replace-match-maybe-edit' (and no doc) Drew Adams
2016-02-05 17:16 ` Drew Adams
2016-02-06 0:34 ` Juri Linkov
2016-02-06 1:40 ` Drew Adams [this message]
2016-02-10 0:47 ` Juri Linkov
2016-02-10 2:03 ` Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0d78b1ce-867e-4f1e-bcba-4dc765cf0749@default \
--to=drew.adams@oracle.com \
--cc=18388@debbugs.gnu.org \
--cc=juri@linkov.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).