[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
ispell-word breaks when buffer contents change automatically
From: |
Ryan Yeske |
Subject: |
ispell-word breaks when buffer contents change automatically |
Date: |
Sun, 13 May 2007 14:30:29 -0700 (PDT) |
When using modes such as rcirc where the buffer contents can change
without user input, ispell-word can fail since the spelling
replacement currently works on absolute buffer positions. The
following patch uses markers instead.
2007-05-13 Ryan Yeske <address@hidden>
* textmodes/ispell.el (ispell-word, ispell-get-word): Use markers
instead of absolute buffer positions to remember the start and end
of words.
*** ispell.el 29 Mar 2007 14:43:14 -0800 1.209
--- ispell.el 13 May 2007 14:21:53 -0700
***************
*** 1669,1675 ****
;; to avoid collapsing markers before and after
;; into a single place.
(ispell-insert-word new-word)
! (delete-region (point) (+ (point) (- end start)))
;; It is meaningless to preserve the cursor position
;; inside a word that has changed.
(setq cursor-location (point))
--- 1669,1675 ----
;; to avoid collapsing markers before and after
;; into a single place.
(ispell-insert-word new-word)
! (delete-region (point) end)
;; It is meaningless to preserve the cursor position
;; inside a word that has changed.
(setq cursor-location (point))
***************
*** 1719,1725 ****
extra-otherchars)
"*" "?")))
did-it-once prevpt
! start end word)
;; find the word
(if (not (looking-at ispell-casechars))
(if following
--- 1719,1727 ----
extra-otherchars)
"*" "?")))
did-it-once prevpt
! (start (make-marker))
! (end (make-marker))
! word)
;; find the word
(if (not (looking-at ispell-casechars))
(if following
***************
*** 1751,1759 ****
;; return dummy word when just flagging misspellings
(list "" (point) (point))
(error "No word found to check!"))
! (setq start (match-beginning 0)
! end (point)
! word (buffer-substring-no-properties start end))
(list word start end))))
--- 1753,1761 ----
;; return dummy word when just flagging misspellings
(list "" (point) (point))
(error "No word found to check!"))
! (set-marker start (match-beginning 0))
! (set-marker end (point))
! (setq word (buffer-substring-no-properties start end))
(list word start end))))
In GNU Emacs 22.0.99.1 (i386-unknown-openbsd4.0, X toolkit)
of 2007-05-02 on owie.localdomain
Windowing system distributor `The X.Org Foundation', version 11.0.60900000
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: nil
locale-coding-system: nil
default-enable-multibyte-characters: t
Major mode: Emacs-Lisp
Minor modes in effect:
shell-dirtrack-mode: t
display-battery-mode: t
auto-insert-mode: t
display-time-mode: t
iswitchb-mode: t
show-paren-mode: t
rcirc-track-minor-mode: t
auto-image-file-mode: t
tooltip-mode: t
mouse-wheel-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
unify-8859-on-encoding-mode: t
utf-translate-cjk-mode: t
auto-compression-mode: t
size-indication-mode: t
line-number-mode: t
Recent input:
<return> C-c C-SPC C-x b <return> o d C-a C-k M-- C-l
C-x b C-s <return> C-c C-SPC C-x b i s p e l l . e
l <return> C-x v = C-x 1 C-n C-n C-n C-n C-n C-n C-n
C-n C-n C-n C-n C-n C-n C-n C-n C-x 4 a C-x o C-n C-n
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n
C-n C-n C-n C-x 4 a C-x o C-v C-n C-n C-n C-n C-n C-x
C-g C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-x 4 a
C-x o C-x o U s e SPC m a r k e r s SPC i n s t e a
d SPC o f SPC a b s o l u t e SPC b u f f e r SPC p
o s i t i o n s SPC t o SPC r e m e m b e r SPC t h
e SPC s t a r t SPC a n d SPC o <backspace> e n d SPC
o f SPC w o r d s . M-q C-x 1 C-x 1 C-l C-x 2 C-x C-s
C-n C-SPC C-p C-p C-p C-p C-p C-p C-w C-x C-s C-x b
C-s <return> C-x 1 C-l C-x m e m a c s - d e v e l
@ g n u . o r g C-n i s p e l l . e l <backspace> <backspace>
<backspace> - w o r d C-h k M-$ SPC b r e a k s SPC
C-a C-e w h e n C-x C-g C-x k <return> M-x r e p o
r t - e m a c s - b u g <return>
Recent messages:
"
Quit
Notice activity in this buffer
Saving file /home/rcyeske/emacs/lisp/ChangeLog...
Wrote /home/rcyeske/emacs/lisp/ChangeLog
Mark set
Saving file /home/rcyeske/emacs/lisp/ChangeLog...
Wrote /home/rcyeske/emacs/lisp/ChangeLog
Type C-x 1 to remove help window.
Loading emacsbug...done
--
- ispell-word breaks when buffer contents change automatically,
Ryan Yeske <=