mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-08 15:35:02 +00:00
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)
This commit is contained in:
parent
ed0ba302d3
commit
3f1b25b580
@ -1,3 +1,9 @@
|
||||
2012-05-18 Agustín Martín Domingo <agustin.martin@hispalinux.es>
|
||||
|
||||
* 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 <monnier@iro.umontreal.ca>
|
||||
|
||||
* emacs-lisp/lisp-mode.el (doc-string-elt): Move those properties to
|
||||
|
@ -730,45 +730,50 @@ not the very same deplacement command."
|
||||
"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 @@ Mostly we check word delimiters."
|
||||
"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 @@ Mostly we check word delimiters."
|
||||
;;*---------------------------------------------------------------------*/
|
||||
(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 @@ Mostly we check word delimiters."
|
||||
(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 @@ Mostly we check word delimiters."
|
||||
(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))
|
||||
|
Loading…
Reference in New Issue
Block a user