Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find and replace not working in split frame in branch develop (but fine in master) #9700

Closed
hchapman opened this issue Oct 4, 2017 · 17 comments
Labels

Comments

@hchapman
Copy link

hchapman commented Oct 4, 2017

Description :octocat:

Find and replace (M-%) does not work in a frame which has been split vertically or horizontally on develop

Reproduction guide 🪲

  • Start Emacs
  • Open a buffer (C-x C-f [filename])
  • Split the frame (C-x 3) or (C-x 2)
  • Try to find and replace (M-% a [ret] b [ret])

Observed behaviour: 👀 💔
Cursor moves to end of first find result, then throws error in minibuffer,

perform-replace: Args out of range: #<buffer [filename]>, 0, 0

Expected behaviour: ❤️ 😄
Found string marked, usual options to replace or skip appear

System Info 💻

  • OS: gnu/linux
  • Emacs: 27.0.50
  • Spacemacs: 0.200.9
  • Spacemacs branch: develop (rev. 0e06bba)
  • Graphic display: t
  • Distribution: spacemacs
  • Editing style: emacs
  • Completion: helm
  • Layers:
nil

Not sure what happened here, but this is happening with many layers installed, and on a fresh .spacemacs file, too

  • System configuration features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 MODULES XWIDGETS LIBSYSTEMD LCMS2

Backtrace 🐾

Debugger entered--Lisp error: (args-out-of-range #<buffer [filename]> 0 0)
  buffer-substring-no-properties(0 0)
  perform-replace("is" "feh" t nil nil nil nil nil nil nil nil)
  query-replace("is" "feh" nil nil nil nil nil)
  funcall-interactively(query-replace "is" "feh" nil nil nil nil nil)
  call-interactively(query-replace nil nil)
  command-execute(query-replace)
@hchapman hchapman changed the title Find and replace not working in branch develop (but fine in master) Find and replace not working in split frame in branch develop (but fine in master) Oct 4, 2017
@Alexander-Miller
Copy link
Contributor

I used to run into this, too, though I never quite made the connection with splits.
Tried again now and it seems to work. Maybe an update to spacemacs/a plugin fixed things?

@hchapman
Copy link
Author

hchapman commented Oct 31, 2017

Any idea what changed? It's still not working for me on most recent emacs (Ubuntu; elisp-ppa) and spacemacs develop.

@hchapman
Copy link
Author

Still doesn't work for me. Am I the only one?

@troyp
Copy link
Contributor

troyp commented Dec 29, 2017

No, this has been happening to me lately as well, on Emacs 26 (GTK) + Spacemacs develop (on Ubuntu). It's pretty annoying, since I usually prefer emacs-style interactive replace. I didn't realise it works on a single-window frame until I read your comment, though. That makes things easier, at least.

It seems to work on terminal emacs, though.

@braineo
Copy link
Contributor

braineo commented Mar 29, 2018

Wow, I also ran into this problem but never realized it was because of split frame. How did you find out?

@George9000
Copy link

Issue persists on the development branch. I too am using Emacs 26.

@AshKash
Copy link

AshKash commented May 9, 2018

Problem also happens on MacOS with Emacs-pretest-26.1-rc1-universal.dmg

@syl20bnr
Copy link
Owner

mmmh this is weird that it is only a bug on develop, the stack shows nothing that could come from spacemacs. Looks like an Emacs bug, to be sure can you reproduce it with emacs -Q ?

@braineo
Copy link
Contributor

braineo commented May 11, 2018

@syl20bnr I tested with emacs -Q and prelude, they are both fine. What interesting is something you can still do query-replace right after splitting panels once, but after that it does not work.

@braineo
Copy link
Contributor

braineo commented May 11, 2018

and using evil seems to be no problem at all by doing %s/a/b/gc

@braineo
Copy link
Contributor

braineo commented Jun 4, 2018

and seems you can do query replace in the newly splitted frame, but not the previous one. Is it because something happens during splitting?

@syl20bnr
Copy link
Owner

syl20bnr commented Jun 7, 2018

I debug it and found the culprit but I have no idea how to fix it, the issue is this line: https://github.com/emacs-mirror/emacs/blob/8a6521260dc650b4b713ea8bc71348cbe730f6e4/lisp/isearch.el#L3213

(sit-for 0)     ;make sure (window-start) is credible

which causes a redisplay.

if I pass t to prevent the redisplay with (sit-for 0 t) the bug disappear.

It's from a commit 18 year ago :-)
emacs-mirror/emacs@c982ab2

I let you guys continue on this one with this info. I hope you'll find the culprit.

@jaseemabid
Copy link

projectile-replace with SPC p R exhibits the same issue. I'm on Linux with a pretty new spacemacs version b54ea8e and Emacs 26.1

@Miciah
Copy link
Contributor

Miciah commented Aug 16, 2018

I suggested the following workaround in #10938:

(setq frame-title-format nil)

It looks like the issue has been reported upstream as https://debbugs.gnu.org/cgi/bugreport.cgi?bug=31586.

kommen added a commit to kommen/spacemacs that referenced this issue Oct 28, 2018
This works around an issue in Emacs which args-out-or-range errors when
trying to query-replace in frames which are split vertically or horizontally.

See syl20bnr#9700 and
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=31586
@kommen
Copy link
Contributor

kommen commented Oct 28, 2018

I have submitted a pull request which fixes this issue: #11519

d12frosted pushed a commit that referenced this issue Nov 4, 2018
This works around an issue in Emacs which args-out-or-range errors when
trying to query-replace in frames which are split vertically or horizontally.

See #9700 and
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=31586
@d12frosted
Copy link
Collaborator

The PR was merged into develop. Please try again with the latest develop.

@github-actions
Copy link

github-actions bot commented Sep 1, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Sep 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests