unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Small bug in flyspell.el
@ 2007-04-24 11:46 Peter Heslin
  2007-04-24 12:51 ` martin rudalics
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Heslin @ 2007-04-24 11:46 UTC (permalink / raw)
  To: emacs-devel


I believe there is a small bug in the function
flyspell-auto-correct-previous-word.  This function allows you to cycle
through suggested spellings of a previous word that flyspell has marked
as misspelled.  It is important that this action is restricted to the
visible part of the buffer -- otherwise the user might accidentally
change a word off-screen without realizing it.

So the function begins like this:

  (let (top bot)
    (save-excursion
      (move-to-window-line 0)
      (setq top (point))
      (move-to-window-line -1)
      (setq bot (point)))
    (save-excursion
      (save-restriction
	(narrow-to-region top bot)

This code intends to narrow to the visible part of the screen, but there
should be a (end-of-line) after (move-to-window-line -1).  As it stands,
the code narrows to the beginning of the last line on screen, and
excludes the last line itself.  The effect of this bug is that, if you
are typing on the last line of the screen and notice that flyspell has
highlighted a previous word on that line and you hit the key bound to
flyspell-auto-correct-previous-word, the expected word is not corrected.
Instead, if there is a word highlighted higher up on the screen, that
other word is wrongly "corrected" (since the user did not bother to
correct that word earlier, it is probably not in fact misspelled, but is
just a word that the dictionary doesn't know).

Peter

-- 
Peter Heslin (http://www.dur.ac.uk/p.j.heslin)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Small bug in flyspell.el
  2007-04-24 11:46 Small bug in flyspell.el Peter Heslin
@ 2007-04-24 12:51 ` martin rudalics
  0 siblings, 0 replies; 2+ messages in thread
From: martin rudalics @ 2007-04-24 12:51 UTC (permalink / raw)
  To: Peter Heslin; +Cc: emacs-devel

 > So the function begins like this:
 >
 >   (let (top bot)
 >     (save-excursion
 >       (move-to-window-line 0)
 >       (setq top (point))
 >       (move-to-window-line -1)
 >       (setq bot (point)))
 >     (save-excursion
 >       (save-restriction
 > 	(narrow-to-region top bot)

Is there any reason for not writing

   (let ((top (window-start))
	(bot (window-end)))

here?

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-04-24 12:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-24 11:46 Small bug in flyspell.el Peter Heslin
2007-04-24 12:51 ` martin rudalics

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).