[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r108281: textmodes/flyspell.el: Prote
From: |
Agustin Martin |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r108281: textmodes/flyspell.el: Protect delay handling for otherchars against empty otherchars. |
Date: |
Fri, 18 May 2012 09:04:04 +0200 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 108281
committer: Agustin Martin <address@hidden>
branch nick: trunk
timestamp: Fri 2012-05-18 09:04:04 +0200
message:
textmodes/flyspell.el: Protect delay handling for otherchars against empty
otherchars.
(flyspell-check-pre-word-p,
flyspell-check-word-p,flyspell-debug-signal-word-checked)
modified:
lisp/ChangeLog
lisp/textmodes/flyspell.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-05-18 01:46:20 +0000
+++ b/lisp/ChangeLog 2012-05-18 07:04:04 +0000
@@ -1,3 +1,9 @@
+2012-05-18 Agustín Martín Domingo <address@hidden>
+
+ * flyspell.el (flyspell-check-pre-word-p, flyspell-check-word-p)
+ (flyspell-debug-signal-word-checked): Protect delay handling for
+ otherchars against empty otherchars.
+
2012-05-18 Stefan Monnier <address@hidden>
* emacs-lisp/lisp-mode.el (doc-string-elt): Move those properties to
=== modified file 'lisp/textmodes/flyspell.el'
--- a/lisp/textmodes/flyspell.el 2012-05-16 08:35:11 +0000
+++ b/lisp/textmodes/flyspell.el 2012-05-18 07:04:04 +0000
@@ -730,45 +730,50 @@
"Return non-nil if we should check the word before point.
More precisely, it applies to the word that was before point
before the current command."
- (cond
- ((or (not (numberp flyspell-pre-point))
- (not (bufferp flyspell-pre-buffer))
- (not (buffer-live-p flyspell-pre-buffer)))
- nil)
- ((and (eq flyspell-pre-pre-point flyspell-pre-point)
- (eq flyspell-pre-pre-buffer flyspell-pre-buffer))
- nil)
- ((or (and (= flyspell-pre-point (- (point) 1))
- (or (eq (char-syntax (char-after flyspell-pre-point)) ?w)
- (string-match-p (ispell-get-otherchars)
- (buffer-substring-no-properties
- flyspell-pre-point (1+ flyspell-pre-point)))))
- (= flyspell-pre-point (point))
- (= flyspell-pre-point (+ (point) 1)))
- nil)
- ((and (symbolp this-command)
- (not executing-kbd-macro)
- (or (get this-command 'flyspell-delayed)
- (and (get this-command 'flyspell-deplacement)
- (eq flyspell-previous-command this-command)))
- (or (= (current-column) 0)
- (= (current-column) flyspell-pre-column)
- ;; If other post-command-hooks change the buffer,
- ;; flyspell-pre-point can lie past eob (bug#468).
- (null (char-after flyspell-pre-point))
- (or (eq (char-syntax (char-after flyspell-pre-point)) ?w)
- (string-match-p (ispell-get-otherchars)
- (buffer-substring-no-properties
- flyspell-pre-point (1+
flyspell-pre-point))))))
- nil)
- ((not (eq (current-buffer) flyspell-pre-buffer))
- t)
- ((not (and (numberp flyspell-word-cache-start)
- (numberp flyspell-word-cache-end)))
- t)
- (t
- (or (< flyspell-pre-point flyspell-word-cache-start)
- (> flyspell-pre-point flyspell-word-cache-end)))))
+ (let ((ispell-otherchars (ispell-get-otherchars)))
+ (cond
+ ((or (not (numberp flyspell-pre-point))
+ (not (bufferp flyspell-pre-buffer))
+ (not (buffer-live-p flyspell-pre-buffer)))
+ nil)
+ ((and (eq flyspell-pre-pre-point flyspell-pre-point)
+ (eq flyspell-pre-pre-buffer flyspell-pre-buffer))
+ nil)
+ ((or (and (= flyspell-pre-point (- (point) 1))
+ (or (eq (char-syntax (char-after flyspell-pre-point)) ?w)
+ (and (not (string= "" ispell-otherchars))
+ (string-match-p
+ ispell-otherchars
+ (buffer-substring-no-properties
+ flyspell-pre-point (1+ flyspell-pre-point))))))
+ (= flyspell-pre-point (point))
+ (= flyspell-pre-point (+ (point) 1)))
+ nil)
+ ((and (symbolp this-command)
+ (not executing-kbd-macro)
+ (or (get this-command 'flyspell-delayed)
+ (and (get this-command 'flyspell-deplacement)
+ (eq flyspell-previous-command this-command)))
+ (or (= (current-column) 0)
+ (= (current-column) flyspell-pre-column)
+ ;; If other post-command-hooks change the buffer,
+ ;; flyspell-pre-point can lie past eob (bug#468).
+ (null (char-after flyspell-pre-point))
+ (or (eq (char-syntax (char-after flyspell-pre-point)) ?w)
+ (and (not (string= "" ispell-otherchars))
+ (string-match-p
+ ispell-otherchars
+ (buffer-substring-no-properties
+ flyspell-pre-point (1+ flyspell-pre-point)))))))
+ nil)
+ ((not (eq (current-buffer) flyspell-pre-buffer))
+ t)
+ ((not (and (numberp flyspell-word-cache-start)
+ (numberp flyspell-word-cache-end)))
+ t)
+ (t
+ (or (< flyspell-pre-point flyspell-word-cache-start)
+ (> flyspell-pre-point flyspell-word-cache-end))))))
;;*---------------------------------------------------------------------*/
;;* The flyspell after-change-hook, store the change position. In */
@@ -812,31 +817,33 @@
"Return t when the word at `point' has to be checked.
The answer depends of several criteria.
Mostly we check word delimiters."
- (cond
- ((<= (- (point-max) 1) (point-min))
- ;; the buffer is not filled enough
- nil)
- ((and (and (> (current-column) 0)
- (not (eq (current-column) flyspell-pre-column)))
- (save-excursion
- (backward-char 1)
- (and (looking-at (flyspell-get-not-casechars))
- (not (looking-at (ispell-get-otherchars)))
- (or flyspell-consider-dash-as-word-delimiter-flag
- (not (looking-at "-"))))))
- ;; yes because we have reached or typed a word delimiter.
- t)
- ((symbolp this-command)
+ (let ((ispell-otherchars (ispell-get-otherchars)))
(cond
- ((get this-command 'flyspell-deplacement)
- (not (eq flyspell-previous-command this-command)))
- ((get this-command 'flyspell-delayed)
- ;; the current command is not delayed, that
- ;; is that we must check the word now
- (and (not unread-command-events)
- (sit-for flyspell-delay)))
- (t t)))
- (t t)))
+ ((<= (- (point-max) 1) (point-min))
+ ;; the buffer is not filled enough
+ nil)
+ ((and (and (> (current-column) 0)
+ (not (eq (current-column) flyspell-pre-column)))
+ (save-excursion
+ (backward-char 1)
+ (and (looking-at (flyspell-get-not-casechars))
+ (or (string= "" ispell-otherchars)
+ (not (looking-at (ispell-get-otherchars))))
+ (or flyspell-consider-dash-as-word-delimiter-flag
+ (not (looking-at "-"))))))
+ ;; yes because we have reached or typed a word delimiter.
+ t)
+ ((symbolp this-command)
+ (cond
+ ((get this-command 'flyspell-deplacement)
+ (not (eq flyspell-previous-command this-command)))
+ ((get this-command 'flyspell-delayed)
+ ;; the current command is not delayed, that
+ ;; is that we must check the word now
+ (and (not unread-command-events)
+ (sit-for flyspell-delay)))
+ (t t)))
+ (t t))))
;;*---------------------------------------------------------------------*/
;;* flyspell-debug-signal-no-check ... */
@@ -866,7 +873,8 @@
;;*---------------------------------------------------------------------*/
(defun flyspell-debug-signal-word-checked ()
(setq debug-on-error t)
- (let ((oldbuf (current-buffer))
+ (let ((ispell-otherchars (ispell-get-otherchars))
+ (oldbuf (current-buffer))
(point (point)))
(with-current-buffer (get-buffer-create "*flyspell-debug*")
(insert "WORD:\n")
@@ -887,7 +895,8 @@
(save-excursion
(backward-char 1)
(and (and (looking-at
(flyspell-get-not-casechars)) 1)
- (not (looking-at
(ispell-get-otherchars)))
+ (or (string= "" ispell-otherchars)
+ (not (looking-at
(ispell-get-otherchars))))
(and (or
flyspell-consider-dash-as-word-delimiter-flag
(not (looking-at "\\-")))
2))))))
c))))
@@ -903,7 +912,8 @@
(save-excursion
(backward-char 1)
(and (looking-at
(flyspell-get-not-casechars))
- (not (looking-at
(ispell-get-otherchars)))
+ (or (string= "" ispell-otherchars)
+ (not (looking-at
(ispell-get-otherchars))))
(or
flyspell-consider-dash-as-word-delimiter-flag
(not (looking-at "\\-"))))))))
c))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r108281: textmodes/flyspell.el: Protect delay handling for otherchars against empty otherchars.,
Agustin Martin <=