From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thorsten Grothe Newsgroups: gmane.emacs.help Subject: flyspell-buffer add word keep higlighted errors Date: Tue, 5 Jan 2016 08:36:06 +0100 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1451979936 13254 80.91.229.3 (5 Jan 2016 07:45:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 5 Jan 2016 07:45:36 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jan 05 08:45:27 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aGMJ4-0007nF-78 for geh-help-gnu-emacs@m.gmane.org; Tue, 05 Jan 2016 08:45:26 +0100 Original-Received: from localhost ([::1]:48443 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGMJ3-00057O-K8 for geh-help-gnu-emacs@m.gmane.org; Tue, 05 Jan 2016 02:45:25 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34593) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGMIn-00053B-O8 for help-gnu-emacs@gnu.org; Tue, 05 Jan 2016 02:45:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aGMIj-0001aM-Nj for help-gnu-emacs@gnu.org; Tue, 05 Jan 2016 02:45:09 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:59344) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGMIj-0001Za-Gm for help-gnu-emacs@gnu.org; Tue, 05 Jan 2016 02:45:05 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1aGMIh-0007OG-LB for help-gnu-emacs@gnu.org; Tue, 05 Jan 2016 08:45:03 +0100 Original-Received: from ip-37-24-91-26.hsi14.unitymediagroup.de ([37.24.91.26]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 05 Jan 2016 08:45:03 +0100 Original-Received: from grothe_news by ip-37-24-91-26.hsi14.unitymediagroup.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 05 Jan 2016 08:45:03 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 88 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: ip-37-24-91-26.hsi14.unitymediagroup.de X-Mozilla-News-Host: news://news.gmane.org:119 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:108610 Archived-At: Hello, I got a small problem with flyspell. I start flyspell for my latex files with a hook (add-hook 'LaTeX-mode-hook #'turn-on-flyspell) That checks only errors for the current session of course. So sometimes I need to flyspell-buffer my old text. When I add an unknown word to the user dic *all* other marked words vanish and I have to run flyspell-buffer again, this is very frustrating for me, what I'm doing wrong? Here's my setup for flyspell and use-package: ;; Flyspell (use-package flyspell :ensure t :bind (("" . flyspell-buffer) ("C-" . flyspell-goto-next-error) ("S-" . flyspell-goto-previous-error) ) :init (add-hook 'LaTeX-mode-hook #'turn-on-flyspell) ;;(add-hook 'LaTeX-mode-hook #'flyspell-buffer) :config ;; move point to previous error ;; based on code by hatschipuh at ;; http://emacs.stackexchange.com/a/14912/2017 (defun flyspell-goto-previous-error (arg) "Go to arg previous spelling error." (interactive "p") (while (not (= 0 arg)) (let ((pos (point)) (min (point-min))) (if (and (eq (current-buffer) flyspell-old-buffer-error) (eq pos flyspell-old-pos-error)) (progn (if (= flyspell-old-pos-error min) ;; goto beginning of buffer (progn (message "Restarting from end of buffer") (goto-char (point-max))) (backward-word 1)) (setq pos (point)))) ;; seek the next error (while (and (> pos min) (let ((ovs (overlays-at pos)) (r '())) (while (and (not r) (consp ovs)) (if (flyspell-overlay-p (car ovs)) (setq r t) (setq ovs (cdr ovs)))) (not r))) (backward-word 1) (setq pos (point))) ;; save the current location for next invocation (setq arg (1- arg)) (setq flyspell-old-pos-error pos) (setq flyspell-old-buffer-error (current-buffer)) (goto-char pos) (if (= pos min) (progn (message "No more miss-spelled word!") (setq arg 0)) (forward-word))))) ;; rechte Maus für Korrekturvorschläge (progn (define-key flyspell-mouse-map [down-mouse-3] #'flyspell-correct-word) (define-key flyspell-mouse-map [mouse-3] #'undefined) ) ;; Hunspell (when (executable-find "hunspell") (setq-default ispell-program-name "hunspell") (setq ispell-really-hunspell t)) (setq ispell-dictionary "de_DE") ) Thanks in advance Regards Thorsten