diff options
| author | Agustín Martín | 2012-11-06 17:04:42 +0100 |
|---|---|---|
| committer | Agustín Martín | 2012-11-06 17:04:42 +0100 |
| commit | f0704a9a28fcc441a8950c76b048001d11cdc1dd (patch) | |
| tree | 9c90eefb13837c4158ebf0c569728e6582e7fab3 | |
| parent | 72f94d4be8224bb7f51bef559c7565fa80724ca6 (diff) | |
| download | emacs-f0704a9a28fcc441a8950c76b048001d11cdc1dd.tar.gz emacs-f0704a9a28fcc441a8950c76b048001d11cdc1dd.zip | |
ispell.el (ispell-region): Standard re-indent for better readability.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/textmodes/ispell.el | 208 |
2 files changed, 109 insertions, 104 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2347b7f6e93..1f1868745de 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-11-06 Agustín Martín Domingo <agustin.martin@hispalinux.es> | ||
| 2 | |||
| 3 | * textmodes/ispell.el (ispell-region): Standard re-indent for better | ||
| 4 | readability. | ||
| 5 | |||
| 1 | 2012-11-06 Dmitry Antipov <dmantipov@yandex.ru> | 6 | 2012-11-06 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 7 | ||
| 3 | * emacs-lisp/byte-opt.el (toplevel): Add compare-window-configurations, | 8 | * emacs-lisp/byte-opt.el (toplevel): Add compare-window-configurations, |
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index de60ac37d9e..0af619ce773 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el | |||
| @@ -2903,113 +2903,113 @@ amount for last line processed." | |||
| 2903 | (ispell-accept-buffer-local-defs)) ; set up dictionary, local words, etc. | 2903 | (ispell-accept-buffer-local-defs)) ; set up dictionary, local words, etc. |
| 2904 | (let ((skip-region-start (make-marker)) | 2904 | (let ((skip-region-start (make-marker)) |
| 2905 | (rstart (make-marker))) | 2905 | (rstart (make-marker))) |
| 2906 | (unwind-protect | 2906 | (unwind-protect |
| 2907 | (save-excursion | 2907 | (save-excursion |
| 2908 | (message "Spell-checking %s using %s with %s dictionary..." | 2908 | (message "Spell-checking %s using %s with %s dictionary..." |
| 2909 | (if (and (= reg-start (point-min)) (= reg-end (point-max))) | ||
| 2910 | (buffer-name) "region") | ||
| 2911 | (file-name-nondirectory ispell-program-name) | ||
| 2912 | (or ispell-current-dictionary "default")) | ||
| 2913 | ;; Returns cursor to original location. | ||
| 2914 | (save-window-excursion | ||
| 2915 | (goto-char reg-start) | ||
| 2916 | (let ((transient-mark-mode) | ||
| 2917 | (case-fold-search case-fold-search) | ||
| 2918 | (query-fcc t) | ||
| 2919 | in-comment key) | ||
| 2920 | (let (message-log-max) | ||
| 2921 | (message "searching for regions to skip")) | ||
| 2922 | (if (re-search-forward (ispell-begin-skip-region-regexp) reg-end t) | ||
| 2923 | (progn | ||
| 2924 | (setq key (match-string-no-properties 0)) | ||
| 2925 | (set-marker skip-region-start (- (point) (length key))) | ||
| 2926 | (goto-char reg-start))) | ||
| 2927 | (let (message-log-max) | ||
| 2928 | (message | ||
| 2929 | "Continuing spelling check using %s with %s dictionary..." | ||
| 2930 | (file-name-nondirectory ispell-program-name) | ||
| 2931 | (or ispell-current-dictionary "default"))) | ||
| 2932 | (set-marker rstart reg-start) | ||
| 2933 | (set-marker ispell-region-end reg-end) | ||
| 2934 | (while (and (not ispell-quit) | ||
| 2935 | (< (point) ispell-region-end)) | ||
| 2936 | ;; spell-check region with skipping | ||
| 2937 | (if (and (marker-position skip-region-start) | ||
| 2938 | (<= skip-region-start (point))) | ||
| 2939 | (progn | ||
| 2940 | ;; If region inside line comment, must keep comment start. | ||
| 2941 | (setq in-comment (point) | ||
| 2942 | in-comment | ||
| 2943 | (and comment-start | ||
| 2944 | (or (null comment-end) (string= "" comment-end)) | ||
| 2945 | (save-excursion | ||
| 2946 | (beginning-of-line) | ||
| 2947 | (re-search-forward comment-start in-comment t)) | ||
| 2948 | comment-start)) | ||
| 2949 | ;; Can change skip-regexps (in ispell-message) | ||
| 2950 | (ispell-skip-region key) ; moves pt past region. | ||
| 2951 | (set-marker rstart (point)) | ||
| 2952 | ;; check for saving large attachments... | ||
| 2953 | (setq query-fcc (and query-fcc | ||
| 2954 | (ispell-ignore-fcc skip-region-start | ||
| 2955 | rstart))) | ||
| 2956 | (if (and (< rstart ispell-region-end) | ||
| 2957 | (re-search-forward | ||
| 2958 | (ispell-begin-skip-region-regexp) | ||
| 2959 | ispell-region-end t)) | ||
| 2960 | (progn | ||
| 2961 | (setq key (match-string-no-properties 0)) | ||
| 2962 | (set-marker skip-region-start | ||
| 2963 | (- (point) (length key))) | ||
| 2964 | (goto-char rstart)) | ||
| 2965 | (set-marker skip-region-start nil)))) | ||
| 2966 | (setq reg-end (max (point) | ||
| 2967 | (if (marker-position skip-region-start) | ||
| 2968 | (min skip-region-start ispell-region-end) | ||
| 2969 | (marker-position ispell-region-end)))) | ||
| 2970 | (let* ((ispell-start (point)) | ||
| 2971 | (ispell-end (min (point-at-eol) reg-end)) | ||
| 2972 | (string (ispell-get-line | ||
| 2973 | ispell-start ispell-end in-comment))) | ||
| 2974 | (if in-comment ; account for comment chars added | ||
| 2975 | (setq ispell-start (- ispell-start (length in-comment)) | ||
| 2976 | in-comment nil)) | ||
| 2977 | (setq ispell-end (point)) ; "end" tracks region retrieved. | ||
| 2978 | (if string ; there is something to spell check! | ||
| 2979 | ;; (special start end) | ||
| 2980 | (setq shift (ispell-process-line string | ||
| 2981 | (and recheckp shift)))) | ||
| 2982 | (goto-char ispell-end))))) | ||
| 2983 | (if ispell-quit | ||
| 2984 | nil | ||
| 2985 | (or shift 0))) | ||
| 2986 | ;; protected | ||
| 2987 | (if (and (not (and recheckp ispell-keep-choices-win)) | ||
| 2988 | (get-buffer ispell-choices-buffer)) | ||
| 2989 | (kill-buffer ispell-choices-buffer)) | ||
| 2990 | (set-marker skip-region-start nil) | ||
| 2991 | (set-marker rstart nil) | ||
| 2992 | (if ispell-quit | ||
| 2993 | (progn | ||
| 2994 | ;; preserve or clear the region for ispell-continue. | ||
| 2995 | (if (not (numberp ispell-quit)) | ||
| 2996 | (set-marker ispell-region-end nil) | ||
| 2997 | ;; Ispell-continue enabled - ispell-region-end is set. | ||
| 2998 | (goto-char ispell-quit)) | ||
| 2999 | ;; Check for aborting | ||
| 3000 | (if (and ispell-checking-message (numberp ispell-quit)) | ||
| 3001 | (progn | ||
| 3002 | (setq ispell-quit nil) | ||
| 3003 | (error "Message send aborted"))) | ||
| 3004 | (if (not recheckp) (setq ispell-quit nil))) | ||
| 3005 | (if (not recheckp) (set-marker ispell-region-end nil)) | ||
| 3006 | ;; Only save if successful exit. | ||
| 3007 | (ispell-pdict-save ispell-silently-savep) | ||
| 3008 | (message "Spell-checking %s using %s with %s dictionary...done" | ||
| 2909 | (if (and (= reg-start (point-min)) (= reg-end (point-max))) | 3009 | (if (and (= reg-start (point-min)) (= reg-end (point-max))) |
| 2910 | (buffer-name) "region") | 3010 | (buffer-name) "region") |
| 2911 | (file-name-nondirectory ispell-program-name) | 3011 | (file-name-nondirectory ispell-program-name) |
| 2912 | (or ispell-current-dictionary "default")) | 3012 | (or ispell-current-dictionary "default")))))) |
| 2913 | ;; Returns cursor to original location. | ||
| 2914 | (save-window-excursion | ||
| 2915 | (goto-char reg-start) | ||
| 2916 | (let ((transient-mark-mode) | ||
| 2917 | (case-fold-search case-fold-search) | ||
| 2918 | (query-fcc t) | ||
| 2919 | in-comment key) | ||
| 2920 | (let (message-log-max) | ||
| 2921 | (message "searching for regions to skip")) | ||
| 2922 | (if (re-search-forward (ispell-begin-skip-region-regexp) reg-end t) | ||
| 2923 | (progn | ||
| 2924 | (setq key (match-string-no-properties 0)) | ||
| 2925 | (set-marker skip-region-start (- (point) (length key))) | ||
| 2926 | (goto-char reg-start))) | ||
| 2927 | (let (message-log-max) | ||
| 2928 | (message | ||
| 2929 | "Continuing spelling check using %s with %s dictionary..." | ||
| 2930 | (file-name-nondirectory ispell-program-name) | ||
| 2931 | (or ispell-current-dictionary "default"))) | ||
| 2932 | (set-marker rstart reg-start) | ||
| 2933 | (set-marker ispell-region-end reg-end) | ||
| 2934 | (while (and (not ispell-quit) | ||
| 2935 | (< (point) ispell-region-end)) | ||
| 2936 | ;; spell-check region with skipping | ||
| 2937 | (if (and (marker-position skip-region-start) | ||
| 2938 | (<= skip-region-start (point))) | ||
| 2939 | (progn | ||
| 2940 | ;; If region inside line comment, must keep comment start. | ||
| 2941 | (setq in-comment (point) | ||
| 2942 | in-comment | ||
| 2943 | (and comment-start | ||
| 2944 | (or (null comment-end) (string= "" comment-end)) | ||
| 2945 | (save-excursion | ||
| 2946 | (beginning-of-line) | ||
| 2947 | (re-search-forward comment-start in-comment t)) | ||
| 2948 | comment-start)) | ||
| 2949 | ;; Can change skip-regexps (in ispell-message) | ||
| 2950 | (ispell-skip-region key) ; moves pt past region. | ||
| 2951 | (set-marker rstart (point)) | ||
| 2952 | ;; check for saving large attachments... | ||
| 2953 | (setq query-fcc (and query-fcc | ||
| 2954 | (ispell-ignore-fcc skip-region-start | ||
| 2955 | rstart))) | ||
| 2956 | (if (and (< rstart ispell-region-end) | ||
| 2957 | (re-search-forward | ||
| 2958 | (ispell-begin-skip-region-regexp) | ||
| 2959 | ispell-region-end t)) | ||
| 2960 | (progn | ||
| 2961 | (setq key (match-string-no-properties 0)) | ||
| 2962 | (set-marker skip-region-start | ||
| 2963 | (- (point) (length key))) | ||
| 2964 | (goto-char rstart)) | ||
| 2965 | (set-marker skip-region-start nil)))) | ||
| 2966 | (setq reg-end (max (point) | ||
| 2967 | (if (marker-position skip-region-start) | ||
| 2968 | (min skip-region-start ispell-region-end) | ||
| 2969 | (marker-position ispell-region-end)))) | ||
| 2970 | (let* ((ispell-start (point)) | ||
| 2971 | (ispell-end (min (point-at-eol) reg-end)) | ||
| 2972 | (string (ispell-get-line | ||
| 2973 | ispell-start ispell-end in-comment))) | ||
| 2974 | (if in-comment ; account for comment chars added | ||
| 2975 | (setq ispell-start (- ispell-start (length in-comment)) | ||
| 2976 | in-comment nil)) | ||
| 2977 | (setq ispell-end (point)) ; "end" tracks region retrieved. | ||
| 2978 | (if string ; there is something to spell check! | ||
| 2979 | ;; (special start end) | ||
| 2980 | (setq shift (ispell-process-line string | ||
| 2981 | (and recheckp shift)))) | ||
| 2982 | (goto-char ispell-end))))) | ||
| 2983 | (if ispell-quit | ||
| 2984 | nil | ||
| 2985 | (or shift 0))) | ||
| 2986 | ;; protected | ||
| 2987 | (if (and (not (and recheckp ispell-keep-choices-win)) | ||
| 2988 | (get-buffer ispell-choices-buffer)) | ||
| 2989 | (kill-buffer ispell-choices-buffer)) | ||
| 2990 | (set-marker skip-region-start nil) | ||
| 2991 | (set-marker rstart nil) | ||
| 2992 | (if ispell-quit | ||
| 2993 | (progn | ||
| 2994 | ;; preserve or clear the region for ispell-continue. | ||
| 2995 | (if (not (numberp ispell-quit)) | ||
| 2996 | (set-marker ispell-region-end nil) | ||
| 2997 | ;; Ispell-continue enabled - ispell-region-end is set. | ||
| 2998 | (goto-char ispell-quit)) | ||
| 2999 | ;; Check for aborting | ||
| 3000 | (if (and ispell-checking-message (numberp ispell-quit)) | ||
| 3001 | (progn | ||
| 3002 | (setq ispell-quit nil) | ||
| 3003 | (error "Message send aborted"))) | ||
| 3004 | (if (not recheckp) (setq ispell-quit nil))) | ||
| 3005 | (if (not recheckp) (set-marker ispell-region-end nil)) | ||
| 3006 | ;; Only save if successful exit. | ||
| 3007 | (ispell-pdict-save ispell-silently-savep) | ||
| 3008 | (message "Spell-checking %s using %s with %s dictionary...done" | ||
| 3009 | (if (and (= reg-start (point-min)) (= reg-end (point-max))) | ||
| 3010 | (buffer-name) "region") | ||
| 3011 | (file-name-nondirectory ispell-program-name) | ||
| 3012 | (or ispell-current-dictionary "default")))))) | ||
| 3013 | 3013 | ||
| 3014 | 3014 | ||
| 3015 | (defun ispell-begin-skip-region-regexp () | 3015 | (defun ispell-begin-skip-region-regexp () |