unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jayden Navarro <jayden@yugabyte.com>
To: Alan Mackenzie <acm@muc.de>
Cc: 36328@debbugs.gnu.org
Subject: bug#36328: 26.2; Args out of range on search-and-replace of *.cc file
Date: Sat, 22 Jun 2019 07:25:30 -0700	[thread overview]
Message-ID: <CAEKiUEZHeGahYxK0R98v6AuBe1czJv3YQA71Esrnp1a2YPW7UQ@mail.gmail.com> (raw)
In-Reply-To: <20190622132549.84518.qmail@mail.muc.de>

[-- Attachment #1: Type: text/plain, Size: 3012 bytes --]

Hello Alan,

Thank you for your response. Apologies for the ambiguous steps. Please find
more detailed information below:

Here are the steps:

1. Open a file in c++-mode (e.g. emacs -Q test.cc).

2. Add 100 lines of some string (e.g. the word "bar" on every line for 100
lines, no quotes in the actual file):

bar
bar
bar
bar
...
bar

3. Add a unique string to line 101 (e.g. the word "foo", no quotes in the
actual file).

bar
bar
bar
bar
...
bar
foo
<INCLUDE NEWLINE AT END OF FILE>

4. Close Emacs

5. Open up the file again: emacs -Q test.cc

6. Replace the unique string with some other string: M-x query-replace
<RET> foo <RET> bar <RET>

7. You should hit: Args out of range: #<buffer test.cc>, 0, 1

Here's the backtrace when using debug-on-error:

Debugger entered--Lisp error: (args-out-of-range #<buffer test.cc> 0 1)
  buffer-substring-no-properties(0 1)
  perform-replace("foo" "a" t nil nil nil nil nil nil nil nil)
  query-replace("foo" "a" nil nil nil nil nil)
  funcall-interactively(query-replace "foo" "a" nil nil nil nil nil)
  call-interactively(query-replace nil nil)
  command-execute(query-replace)

I also wanted to add that I tried reproducing with a file that looked like
the following, but did NOT see the issue then,
either with replacing "foo" (with quotes) or just foo (no quotes):

"bar"
"bar"
"bar"
...
"bar"
"foo"

Even though I'm using "emacs -Q", could it still be interacting with some
of the packages I have installed?

Here's the list of packages I have installed under $HOME/.emacs.d/elpa:

avy-0.3.0
company-20181105.2312
company-lean-20171102.1454
dash-20180910.1856
dash-functional-20180107.1618
epl-20180205.2049
f-20180106.922
flycheck-20181127.1510
gnupg
go-mode-1.3.1
haskell-mode-13.16
lean-mode-20180906.1645
pkg-info-20150517.1143
rust-mode-20181008.1628
s-20180406.808

Best,
Jayden


On Sat, Jun 22, 2019 at 6:25 AM Alan Mackenzie <acm@muc.de> wrote:

> Hello, Jayden.
>
> In article <mailman.612.1561158667.10840.bug-gnu-emacs@gnu.org> you wrote:
> > [-- text/plain, encoding 7bit, charset: UTF-8, 97 lines --]
>
> [ .... ]
>
> > Fill a *.cc file with 100 lines of any string (e.g. "bar"). At line 101
> > write a unique string (e.g. "foo").
>
> Does your file look like:
>
> bar
> bar
> bar
> ...
> ...
> bar
> foo
>
> ?  Or does it look like:
>
> "bar"
> "bar"
> "bar"
> ...
> ...
> "bar"
> "foo"
>
> ?
>
> > Close the file and reopen (emacs -Q).
>
> OK.
>
> > and perform search-and-replace on "foo" (replacing with any other
> string).
>
> What, precisely, did you do to attempt this "search-and-replace"?  With
> emacs-26.2, after emacs -Q, I did
>
>     C-x C-f test.cc
>
> , followed by
>
>     M-% foo <CR> FOO
>
> , in both possibilities for the file (see above), yet could not
> reproduce the error.  The replacement command simply worked for me.
>
> > At this point you should see "Args out of range: #<buffer test.cc>, 0,
> 1".
>
> This is what I don't see.  :-(  At least, not yet.
>
> [ .... ]
>
> --
> Alan Mackenzie (Nuremberg, Germany).
>
>

[-- Attachment #2: Type: text/html, Size: 4642 bytes --]

  reply	other threads:[~2019-06-22 14:25 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-21 23:03 bug#36328: 26.2; Args out of range on search-and-replace of *.cc file Jayden Navarro
     [not found] ` <mailman.612.1561158667.10840.bug-gnu-emacs@gnu.org>
2019-06-22 13:25   ` Alan Mackenzie
2019-06-22 14:25     ` Jayden Navarro [this message]
2019-06-22 14:51       ` Juanma Barranquero
2019-06-22 16:09         ` Jayden Navarro
2019-06-22 20:50       ` Alan Mackenzie
2019-06-22 21:27         ` Jayden Navarro
2019-06-22 22:38           ` Jayden Navarro
2019-06-22 23:02             ` Jayden Navarro
2019-06-23 12:22             ` Alan Mackenzie
2019-06-23 16:14               ` Jayden Navarro
2019-06-23 19:32                 ` Alan Mackenzie
2019-06-23 21:19                   ` Juri Linkov
2019-06-23 21:42                     ` Jayden Navarro
2019-06-24 19:05                       ` Juri Linkov
2019-06-24 20:03                         ` Jayden Navarro
2019-06-24  7:52                     ` Alan Mackenzie
2019-06-24 19:18                       ` Juri Linkov
2019-06-25  9:47                         ` Alan Mackenzie
2019-06-25 19:58                           ` Juri Linkov
2019-07-04 21:09                             ` Juri Linkov
2019-07-05  6:11                               ` Eli Zaretskii
2019-07-05 19:12                                 ` Juri Linkov
2019-10-02 23:53                                   ` Stefan Kangas
2019-06-23 20:10 ` bug#36328: [jayden@yugabyte.com: Re: bug#36328: 26.2; Args out of range on search-and-replace of *.cc file] Alan Mackenzie

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=CAEKiUEZHeGahYxK0R98v6AuBe1czJv3YQA71Esrnp1a2YPW7UQ@mail.gmail.com \
    --to=jayden@yugabyte.com \
    --cc=36328@debbugs.gnu.org \
    --cc=acm@muc.de \
    /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).