diff options
Diffstat (limited to 'lisp/textmodes')
| -rw-r--r-- | lisp/textmodes/artist.el | 2 | ||||
| -rw-r--r-- | lisp/textmodes/conf-mode.el | 4 | ||||
| -rw-r--r-- | lisp/textmodes/ispell.el | 594 | ||||
| -rw-r--r-- | lisp/textmodes/paragraphs.el | 4 | ||||
| -rw-r--r-- | lisp/textmodes/po.el | 4 | ||||
| -rw-r--r-- | lisp/textmodes/reftex-cite.el | 2 | ||||
| -rw-r--r-- | lisp/textmodes/reftex-vars.el | 12 | ||||
| -rw-r--r-- | lisp/textmodes/reftex.el | 2 | ||||
| -rw-r--r-- | lisp/textmodes/remember.el | 3 | ||||
| -rw-r--r-- | lisp/textmodes/sgml-mode.el | 37 | ||||
| -rw-r--r-- | lisp/textmodes/tex-mode.el | 4 | ||||
| -rw-r--r-- | lisp/textmodes/tildify.el | 4 | ||||
| -rw-r--r-- | lisp/textmodes/two-column.el | 6 |
13 files changed, 478 insertions, 200 deletions
diff --git a/lisp/textmodes/artist.el b/lisp/textmodes/artist.el index c2978b0ea40..2bd7283676e 100644 --- a/lisp/textmodes/artist.el +++ b/lisp/textmodes/artist.el @@ -198,7 +198,7 @@ ;; Variables (defconst artist-version "1.2.6") -(defconst artist-maintainer-address "tab@lysator.liu.se") +(defconst artist-maintainer-address "tab@lysator.liu.se, bug-gnu-emacs@gnu.org") (defvar x-pointer-crosshair) diff --git a/lisp/textmodes/conf-mode.el b/lisp/textmodes/conf-mode.el index 93ff179229b..67f2d96d003 100644 --- a/lisp/textmodes/conf-mode.el +++ b/lisp/textmodes/conf-mode.el @@ -1,4 +1,4 @@ -;;; conf-mode.el --- Simple major mode for editing conf/ini/properties files +;;; conf-mode.el --- Simple major mode for editing conf/ini/properties files -*- coding: utf-8 -*- ;; Copyright (C) 2004-2013 Free Software Foundation, Inc. @@ -23,7 +23,7 @@ ;;; Commentary: ;; ;; This mode is designed to edit many similar varieties of Conf/Ini files and -;; Java properties. It started out from Aurélien Tisné's ini-mode. +;; Java properties. It started out from Aurélien Tisné's ini-mode. ;; `conf-space-keywords' were inspired by Robert Fitzgerald's any-ini-mode. diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 52e97b8248d..467ac004420 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -749,8 +749,10 @@ OTHERCHARS slots of the alist should contain the same character set as casechars and otherchars in the LANGUAGE.aff file \(e.g., english.aff\). aspell and hunspell don't have this limitation.") -(defvar ispell-really-aspell nil) ; Non-nil if we can use aspell extensions. -(defvar ispell-really-hunspell nil) ; Non-nil if we can use hunspell extensions. +(defvar ispell-really-aspell nil + "Non-nil if we can use aspell extensions.") +(defvar ispell-really-hunspell nil + "Non-nil if we can use hunspell extensions.") (defvar ispell-encoding8-command nil "Command line option prefix to select encoding if supported, nil otherwise. If setting the encoding is supported by spellchecker and is selectable from @@ -773,6 +775,41 @@ here just for backwards compatibility.") (make-obsolete-variable 'ispell-aspell-supports-utf8 'ispell-encoding8-command "23.1") +(defvar ispell-hunspell-dictionary-equivs-alist + '(("american" "en_US") + ("brasileiro" "pt_BR") + ("british" "en_GB") + ("castellano" "es_ES") + ("castellano8" "es_ES") + ("czech" "cs_CZ") + ("dansk" "da_DK") + ("deutsch" "de_DE") + ("deutsch8" "de_DE") + ("english" "en_US") + ("esperanto" "eo") + ("esperanto-tex" "eo") + ("finnish" "fi_FI") + ("francais7" "fr_FR") + ("francais" "fr_FR") + ("francais-tex" "fr_FR") + ("german" "de_DE") + ("german8" "de_DE") + ("italiano" "it_IT") + ("nederlands" "nl_NL") + ("nederlands8" "nl_NL") + ("norsk" "nn_NO") + ("norsk7-tex" "nn_NO") + ("polish" "pl_PL") + ("portugues" "pt_PT") + ("russian" "ru_RU") + ("russianw" "ru_RU") + ("slovak" "sk_SK") + ("slovenian" "sl_SI") + ("svenska" "sv_SE") + ("hebrew" "he_IL")) + "Alist with matching hunspell dict names for standard dict names in + `ispell-dictionary-base-alist'.") + (defvar ispell-emacs-alpha-regexp (if (string-match "^[[:alpha:]]+$" "abcde") "[[:alpha:]]" @@ -825,7 +862,7 @@ Otherwise returns the library directory name, if that is defined." (if (string-match "\\`aspell" speller) "-v" "-vv")))) (goto-char (point-min)) (if interactivep - ;; report version information of ispell and ispell.el + ;; Report version information of ispell and ispell.el (progn (end-of-line) (setq result (concat (buffer-substring-no-properties (point-min) @@ -920,11 +957,12 @@ See `ispell-buffer-with-debug' for an example of use." (erase-buffer))) ispell-debug-buffer)) -(defsubst ispell-print-if-debug (string) - "Print STRING to `ispell-debug-buffer' buffer if enabled." +(defsubst ispell-print-if-debug (format &rest args) + "Print message to `ispell-debug-buffer' buffer if enabled." (if (boundp 'ispell-debug-buffer) (with-current-buffer ispell-debug-buffer - (insert string)))) + (goto-char (point-max)) + (insert (apply #'format format args))))) ;; The preparation of the menu bar menu must be autoloaded @@ -1094,6 +1132,176 @@ Return the new dictionary alist." (push (cons aliasname (cdr realdict)) alist)))))) alist)) +;; Make ispell.el work better with hunspell. + +(defvar ispell-hunspell-dict-paths-alist nil + "Alist of parsed hunspell dicts and associated affix files. +Will be used to parse corresponding .aff file and create associated +parameters to be inserted into `ispell-hunspell-dictionary-alist'. +Internal use.") + +(defvar ispell-hunspell-dictionary-alist nil + "Alist of parsed hunspell dicts and associated parameters. +This alist will initially contain names of found dicts. Associated +parameters will be added when dict is used for the first time. +Internal use.") + +(defun ispell-hunspell-fill-dictionary-entry (dict) + "Fill `ispell-dictionary-alist' uninitialized entries for `DICT' and aliases. +Value will be extracted from hunspell affix file and used for +all uninitialized dicts using that affix file." + (if (cadr (assoc dict ispell-dictionary-alist)) + (message "ispell-hfde: Non void entry for %s. Skipping.\n" dict) + (let ((dict-alias + (cadr (assoc dict ispell-hunspell-dictionary-equivs-alist))) + (use-for-dicts (list dict)) + (dict-args-cdr (cdr (ispell-parse-hunspell-affix-file dict))) + newlist) + ;; Get a list of uninitialized dicts using the same affix file. + (dolist (dict-equiv-alist-entry ispell-hunspell-dictionary-equivs-alist) + (let ((dict-equiv-key (car dict-equiv-alist-entry)) + (dict-equiv-value (cadr dict-equiv-alist-entry))) + (if (or (member dict dict-equiv-alist-entry) + (member dict-alias dict-equiv-alist-entry)) + (dolist ( tmp-dict (list dict-equiv-key dict-equiv-value)) + (if (cadr (assoc tmp-dict ispell-dictionary-alist)) + (ispell-print-if-debug + "ispell-hfde: %s already expanded. Skipping.\n" tmp-dict) + (add-to-list 'use-for-dicts tmp-dict)))))) + (ispell-print-if-debug + "ispell-hfde: Filling %s entry. Use for %s.\n" dict use-for-dicts) + ;; The final loop. + (dolist (entry ispell-dictionary-alist) + (if (member (car entry) use-for-dicts) + (add-to-list 'newlist + (append (list (car entry)) dict-args-cdr)) + (add-to-list 'newlist entry))) + (setq ispell-dictionary-alist newlist)))) + +(defun ispell-parse-hunspell-affix-file (dict-key) + "Parse hunspell affix file to extract parameters for `DICT-KEY'. +Return a list in `ispell-dictionary-alist' format." + (let ((affix-file (cadr (assoc dict-key ispell-hunspell-dict-paths-alist)))) + (unless affix-file + (error "ispell-phaf: No matching entry for %s.\n" dict-key)) + (if (not (file-exists-p affix-file)) + (error "ispell-phaf: File \"%s\" not found.\n" affix-file)) + (let ((dict-name (file-name-sans-extension + (file-name-nondirectory affix-file))) + otherchars-string otherchars-list) + (with-temp-buffer + (insert-file-contents affix-file) + (setq otherchars-string + (save-excursion + (goto-char (point-min)) + (if (search-forward-regexp "^WORDCHARS +" nil t ) + (buffer-substring (point) + (progn (end-of-line) (point)))))) + ;; Remove trailing whitespace and extra stuff. Make list if + ;; non-nil. + (setq otherchars-list + (if otherchars-string + (split-string + (if (string-match " +.*$" otherchars-string) + (replace-match "" nil nil otherchars-string) + otherchars-string) + "" t))) + + ;; Fill dict entry + (list dict-key + "[[:alpha:]]" + "[^[:alpha:]]" + (if otherchars-list + (regexp-opt otherchars-list) + "") + t ; many-otherchars-p: We can't tell, set to t. + (list "-d" dict-name) + nil ; extended-char-mode: not supported by hunspell! + 'utf-8))))) + +(defun ispell-find-hunspell-dictionaries () + "Look for installed hunspell dictionaries. +Will initialize `ispell-hunspell-dictionary-alist' and +`ispell-hunspell-dictionary-alist' after values found +and remove `ispell-hunspell-dictionary-equivs-alist' +entries if a specific dict was found." + (let ((hunspell-found-dicts + (split-string + (with-temp-buffer + (ispell-call-process ispell-program-name + null-device + t + nil + "-D") + (buffer-string)) + "[\n\r]+" + t)) + hunspell-default-dict + hunspell-default-dict-entry) + (dolist (dict hunspell-found-dicts) + (let* ((full-name (file-name-nondirectory dict)) + (basename (file-name-sans-extension full-name)) + (affix-file (concat dict ".aff"))) + (if (string-match "\\.aff$" dict) + ;; Found default dictionary + (if hunspell-default-dict + (error "ispell-fhd: Default dict already defined as %s. Not using %s.\n" + hunspell-default-dict dict) + (setq affix-file dict) + (setq hunspell-default-dict (list basename affix-file))) + (if (and (not (assoc basename ispell-hunspell-dict-paths-alist)) + (file-exists-p affix-file)) + ;; Entry has an associated .aff file and no previous value. + (let ((affix-file (expand-file-name affix-file))) + (ispell-print-if-debug + "++ ispell-fhd: dict-entry:%s name:%s basename:%s affix-file:%s\n" + dict full-name basename affix-file) + (add-to-list 'ispell-hunspell-dict-paths-alist + (list basename affix-file))) + (ispell-print-if-debug + "-- ispell-fhd: Skipping entry: %s\n" dict))))) + ;; Remove entry from aliases alist if explicit dict was found. + (let (newlist) + (dolist (dict ispell-hunspell-dictionary-equivs-alist) + (if (assoc (car dict) ispell-hunspell-dict-paths-alist) + (ispell-print-if-debug + "-- ispell-fhd: Excluding %s alias. Standalone dict found.\n" + (car dict)) + (add-to-list 'newlist dict))) + (setq ispell-hunspell-dictionary-equivs-alist newlist)) + ;; Add known hunspell aliases + (dolist (dict-equiv ispell-hunspell-dictionary-equivs-alist) + (let ((dict-equiv-key (car dict-equiv)) + (dict-equiv-value (cadr dict-equiv)) + (exclude-aliases (list ;; Exclude TeX aliases + "esperanto-tex" + "francais7" + "francais-tex" + "norsk7-tex"))) + (if (and (assoc dict-equiv-value ispell-hunspell-dict-paths-alist) + (not (assoc dict-equiv-key ispell-hunspell-dict-paths-alist)) + (not (member dict-equiv-key exclude-aliases))) + (let ((affix-file (cadr (assoc dict-equiv-value + ispell-hunspell-dict-paths-alist)))) + (ispell-print-if-debug "++ ispell-fhd: Adding alias %s -> %s.\n" + dict-equiv-key affix-file) + (add-to-list + 'ispell-hunspell-dict-paths-alist + (list dict-equiv-key affix-file)))))) + ;; Parse and set values for default dictionary. + (setq hunspell-default-dict (car hunspell-default-dict)) + (setq hunspell-default-dict-entry + (ispell-parse-hunspell-affix-file hunspell-default-dict)) + ;; Create an alist of found dicts with only names, except for default dict. + (setq ispell-hunspell-dictionary-alist + (list (append (list nil) (cdr hunspell-default-dict-entry)))) + (dolist (dict (mapcar 'car ispell-hunspell-dict-paths-alist)) + (if (string= dict hunspell-default-dict) + (add-to-list 'ispell-hunspell-dictionary-alist + hunspell-default-dict-entry) + (add-to-list 'ispell-hunspell-dictionary-alist + (list dict)))))) + ;; Set params according to the selected spellchecker (defvar ispell-last-program-name nil @@ -1119,24 +1327,82 @@ aspell is used along with Emacs).") (setq ispell-library-directory (ispell-check-version)) t) (error nil)) - ispell-really-aspell ispell-encoding8-command ispell-emacs-alpha-regexp) - (unless ispell-aspell-dictionary-alist - (ispell-find-aspell-dictionaries))) - - ;; Substitute ispell-dictionary-alist with the list of dictionaries - ;; corresponding to the given spellchecker. If a recent aspell, use - ;; the list of really installed dictionaries and add to it elements - ;; of the original list that are not present there. Allow distro info. + ;; auto-detection will only be used if spellchecker is not + ;; ispell, supports a way to set communication to UTF-8 and + ;; Emacs flavor supports [:alpha:] + (if ispell-really-aspell + (or ispell-aspell-dictionary-alist + (ispell-find-aspell-dictionaries)) + (if ispell-really-hunspell + (or ispell-hunspell-dictionary-alist + (ispell-find-hunspell-dictionaries))))) + + ;; Substitute ispell-dictionary-alist with the list of + ;; dictionaries corresponding to the given spellchecker. + ;; If a recent aspell or hunspell, use the list of really + ;; installed dictionaries and add to it elements of the original + ;; list that are not present there. Allow distro info. (let ((found-dicts-alist - (if (and ispell-really-aspell - ispell-encoding8-command) - ispell-aspell-dictionary-alist + (if (and ispell-encoding8-command + ispell-emacs-alpha-regexp) + (if ispell-really-aspell + ispell-aspell-dictionary-alist + (if ispell-really-hunspell + ispell-hunspell-dictionary-alist)) nil)) + (ispell-dictionary-base-alist ispell-dictionary-base-alist) ispell-base-dicts-override-alist ; Override only base-dicts-alist all-dicts-alist) + ;; While ispell and aspell (through aliases) use the traditional + ;; dict naming originally expected by ispell.el, hunspell + ;; uses locale based names with no alias. We need to map + ;; standard names to locale based names to make default dict + ;; definitions available for hunspell. + (if ispell-really-hunspell + (let (tmp-dicts-alist) + (dolist (adict ispell-dictionary-base-alist) + (let* ((dict-name (nth 0 adict)) + (dict-equiv + (cadr (assoc dict-name + ispell-hunspell-dictionary-equivs-alist))) + (ispell-args (nth 5 adict)) + (ispell-args-has-d (member "-d" ispell-args)) + skip-dict) + ;; Remove "-d" option from `ispell-args' if present + (if ispell-args-has-d + (let ((ispell-args-after-d + (cdr (cdr ispell-args-has-d))) + (ispell-args-before-d + (butlast ispell-args (length ispell-args-has-d)))) + (setq ispell-args + (nconc ispell-args-before-d + ispell-args-after-d)))) + ;; Unless default dict, re-add "-d" option with the mapped value + (if dict-name + (if dict-equiv + (nconc ispell-args (list "-d" dict-equiv)) + (message + "ispell-set-spellchecker-params: Missing hunspell equiv for \"%s\". Skipping." + dict-name) + (setq skip-dict t))) + + (unless skip-dict + (add-to-list 'tmp-dicts-alist + (list + dict-name ; dict name + (nth 1 adict) ; casechars + (nth 2 adict) ; not-casechars + (nth 3 adict) ; otherchars + (nth 4 adict) ; many-otherchars-p + ispell-args ; ispell-args + (nth 6 adict) ; extended-character-mode + (nth 7 adict) ; dict encoding + )))) + (setq ispell-dictionary-base-alist tmp-dicts-alist)))) + (run-hooks 'ispell-initialize-spellchecker-hook) ;; Add dicts to ``ispell-dictionary-alist'' unless already present. @@ -1154,19 +1420,21 @@ aspell is used along with Emacs).") (if ispell-emacs-alpha-regexp (let (tmp-dicts-alist) (dolist (adict ispell-dictionary-alist) - (add-to-list 'tmp-dicts-alist - (list - (nth 0 adict) ; dict name - "[[:alpha:]]" ; casechars - "[^[:alpha:]]" ; not-casechars - (nth 3 adict) ; otherchars - (nth 4 adict) ; many-otherchars-p - (nth 5 adict) ; ispell-args - (nth 6 adict) ; extended-character-mode - (if ispell-encoding8-command - 'utf-8 - (nth 7 adict))))) - (setq ispell-dictionary-alist tmp-dicts-alist))))) + (if (cadr adict) ;; Do not touch hunspell uninitialized entries + (add-to-list 'tmp-dicts-alist + (list + (nth 0 adict) ; dict name + "[[:alpha:]]" ; casechars + "[^[:alpha:]]" ; not-casechars + (nth 3 adict) ; otherchars + (nth 4 adict) ; many-otherchars-p + (nth 5 adict) ; ispell-args + (nth 6 adict) ; extended-character-mode + (if ispell-encoding8-command + 'utf-8 + (nth 7 adict)))) + (add-to-list 'tmp-dicts-alist adict))) + (setq ispell-dictionary-alist tmp-dicts-alist))))) (defun ispell-valid-dictionary-list () "Return a list of valid dictionaries. @@ -2519,7 +2787,10 @@ The variable `ispell-highlight-face' selects the face to use for highlighting." (regexp-quote (buffer-substring-no-properties start end)) "\\b")) (isearch-regexp t) - (isearch-case-fold-search nil)) + (isearch-case-fold-search nil) + (isearch-forward t) + (isearch-other-end start) + (isearch-error nil)) (isearch-lazy-highlight-new-loop (if (boundp 'reg-start) reg-start) (if (boundp 'reg-end) reg-end))) @@ -2651,6 +2922,12 @@ When asynchronous processes are not supported, `run' is always returned." Keeps argument list for future Ispell invocations for no async support." ;; `ispell-current-dictionary' and `ispell-current-personal-dictionary' ;; are properly set in `ispell-internal-change-dictionary'. + + ;; Parse hunspell affix file if using hunspell and entry is uninitialized. + (if ispell-really-hunspell + (or (cadr (assoc ispell-current-dictionary ispell-dictionary-alist)) + (ispell-hunspell-fill-dictionary-entry ispell-current-dictionary))) + (let* ((default-directory (if (and (file-directory-p default-directory) (file-readable-p default-directory)) @@ -2938,29 +3215,25 @@ amount for last line processed." (query-fcc t) in-comment key) (ispell-print-if-debug - (concat - (format - "ispell-region: (ispell-skip-region-list):\n%s\n" - (ispell-skip-region-list)) - (format - "ispell-region: (ispell-begin-skip-region-regexp):\n%s\n" - (ispell-begin-skip-region-regexp)) - "ispell-region: Search for first region to skip after (ispell-begin-skip-region-regexp)\n")) + "ispell-region: (ispell-skip-region-list):\n%s +ispell-region: (ispell-begin-skip-region-regexp):\n%s +ispell-region: Search for first region to skip after (ispell-begin-skip-region-regexp)\n" + (ispell-skip-region-list) + (ispell-begin-skip-region-regexp)) (if (re-search-forward (ispell-begin-skip-region-regexp) reg-end t) (progn (setq key (match-string-no-properties 0)) (set-marker skip-region-start (- (point) (length key))) (goto-char reg-start) (ispell-print-if-debug - (format "ispell-region: First skip: %s at (pos,line,column): (%s,%s,%s).\n" - key - (save-excursion (goto-char skip-region-start) (point)) - (line-number-at-pos skip-region-start) - (save-excursion (goto-char skip-region-start) (current-column)))))) + "ispell-region: First skip: %s at (pos,line,column): (%s,%s,%s).\n" + key + (save-excursion (goto-char skip-region-start) (point)) + (line-number-at-pos skip-region-start) + (save-excursion (goto-char skip-region-start) (current-column))))) (ispell-print-if-debug - (format - "ispell-region: Continue spell-checking with %s and %s dictionary...\n" - program-basename dictionary)) + "ispell-region: Continue spell-checking with %s and %s dictionary...\n" + program-basename dictionary) (set-marker rstart reg-start) (set-marker ispell-region-end reg-end) (while (and (not ispell-quit) @@ -2995,11 +3268,11 @@ amount for last line processed." (- (point) (length key))) (goto-char rstart) (ispell-print-if-debug - (format "ispell-region: Next skip: %s at (pos,line,column): (%s,%s,%s).\n" - key - (save-excursion (goto-char skip-region-start) (point)) - (line-number-at-pos skip-region-start) - (save-excursion (goto-char skip-region-start) (current-column))))) + "ispell-region: Next skip: %s at (pos,line,column): (%s,%s,%s).\n" + key + (save-excursion (goto-char skip-region-start) (point)) + (line-number-at-pos skip-region-start) + (save-excursion (goto-char skip-region-start) (current-column)))) (set-marker skip-region-start nil)))) (setq reg-end (max (point) (if (marker-position skip-region-start) @@ -3018,9 +3291,8 @@ amount for last line processed." (string (ispell-get-line ispell-start ispell-end add-comment))) (ispell-print-if-debug - (format - "ispell-region: string pos (%s->%s), eol: %s, [in-comment]: [%s], [add-comment]: [%s], [string]: [%s]\n" - ispell-start ispell-end (point-at-eol) in-comment add-comment string)) + "ispell-region: string pos (%s->%s), eol: %s, [in-comment]: [%s], [add-comment]: [%s], [string]: [%s]\n" + ispell-start ispell-end (point-at-eol) in-comment add-comment string) (if add-comment ; account for comment chars added (setq ispell-start (- ispell-start (length add-comment)) add-comment nil)) @@ -3307,118 +3579,118 @@ Returns the sum SHIFT due to changes in word replacements." (let* ((ispell-pipe-word (car poss)) (actual-point (marker-position word-start)) (actual-line (line-number-at-pos actual-point)) - (actual-column (save-excursion (goto-char actual-point) (current-column)))) + (actual-column (save-excursion (goto-char actual-point) + (current-column)))) (ispell-print-if-debug - (concat - "ispell-process-line: Ispell misalignment error:\n" - (format " [Word from ispell pipe]: [%s], actual (point,line,column): (%s,%s,%s)\n" - ispell-pipe-word actual-point actual-line actual-column))) - (error (concat "Ispell misalignment: word " - "`%s' point %d; probably incompatible versions") - ispell-pipe-word actual-point))) - ;; ispell-cmd-loop can go recursive & change buffer - (if ispell-keep-choices-win - (setq replace (ispell-command-loop - (car (cdr (cdr poss))) - (car (cdr (cdr (cdr poss)))) - (car poss) (marker-position word-start) - (+ word-len (marker-position word-start)))) - (save-window-excursion - (setq replace (ispell-command-loop - (car (cdr (cdr poss))) - (car (cdr (cdr (cdr poss)))) - (car poss) (marker-position word-start) - (+ word-len (marker-position word-start)))))) - - (goto-char word-start) - ;; Recheck when query replace edit changes misspelled word. - ;; Error in tex mode when a potential math mode change exists. - (if (and replace (listp replace) (= 2 (length replace))) - (if (and (eq ispell-parser 'tex) - (string-match "[\\\\][]()[]\\|\\\\begin\\|\\$" - (regexp-quote string))) - (error - "Don't start query replace on a line with math characters" - ) - (set-marker line-end (point)) - (setq ispell-filter nil - recheck-region t))) - - ;; insert correction if needed - (cond - ((or (null replace) - (equal 0 replace)) ; ACCEPT/INSERT - (if (equal 0 replace) ; BUFFER-LOCAL DICT ADD - (ispell-add-per-file-word-list (car poss))) - ;; do not recheck accepted word on this line - (setq accept-list (cons (car poss) accept-list))) - (t ; replacement word selected or entered - (delete-region (point) (+ word-len (point))) - (if (not (listp replace)) - (progn - (insert replace) ; insert dictionary word - (ispell-send-replacement (car poss) replace) - (setq accept-list (cons replace accept-list))) - (let ((replace-word (car replace))) - ;; Recheck hand entered replacement word - (insert replace-word) - (ispell-send-replacement (car poss) replace-word) - (if (car (cdr replace)) - (save-window-excursion - (delete-other-windows) ; to correctly show help. - ;; Assume case-replace & - ;; case-fold-search correct? - (query-replace (car poss) (car replace) t))) - (goto-char word-start) - ;; do not recheck if already accepted - (if (member replace-word accept-list) - (setq accept-list (cons replace-word accept-list) - replace replace-word) - (let ((region-end (copy-marker ispell-region-end))) - (setq recheck-region ispell-filter - ispell-filter nil ; save filter - shift 0 ; already accounted - shift (ispell-region - word-start - (+ word-start (length replace-word)) - t shift)) - (if (null shift) ; quitting check. - (setq shift 0)) - (set-marker ispell-region-end region-end) - (set-marker region-end nil) - (setq ispell-filter recheck-region - recheck-region nil - replace replace-word))))) - - (setq shift (+ shift (- (length replace) word-len))) - - ;; Move line-start across word... - ;; new shift function does this now... - ;;(set-marker line-start (+ line-start - ;; (- (length replace) - ;; (length (car poss))))) - )) - (if (not ispell-quit) + "ispell-process-line: Ispell misalignment error: + [Word from ispell pipe]: [%s], actual (point,line,column): (%s,%s,%s)\n" + ispell-pipe-word actual-point actual-line actual-column) + (error (concat "Ispell misalignment: word " + "`%s' point %d; probably incompatible versions") + ispell-pipe-word actual-point))) + ;; ispell-cmd-loop can go recursive & change buffer + (if ispell-keep-choices-win + (setq replace (ispell-command-loop + (car (cdr (cdr poss))) + (car (cdr (cdr (cdr poss)))) + (car poss) (marker-position word-start) + (+ word-len (marker-position word-start)))) + (save-window-excursion + (setq replace (ispell-command-loop + (car (cdr (cdr poss))) + (car (cdr (cdr (cdr poss)))) + (car poss) (marker-position word-start) + (+ word-len (marker-position word-start)))))) + + (goto-char word-start) + ;; Recheck when query replace edit changes misspelled word. + ;; Error in tex mode when a potential math mode change exists. + (if (and replace (listp replace) (= 2 (length replace))) + (if (and (eq ispell-parser 'tex) + (string-match "[\\\\][]()[]\\|\\\\begin\\|\\$" + (regexp-quote string))) + (error + "Don't start query replace on a line with math characters" + ) + (set-marker line-end (point)) + (setq ispell-filter nil + recheck-region t))) + + ;; Insert correction if needed. + (cond + ((or (null replace) + (equal 0 replace)) ; ACCEPT/INSERT + (if (equal 0 replace) ; BUFFER-LOCAL DICT ADD + (ispell-add-per-file-word-list (car poss))) + ;; Do not recheck accepted word on this line. + (setq accept-list (cons (car poss) accept-list))) + (t ; Replacement word selected or entered. + (delete-region (point) (+ word-len (point))) + (if (not (listp replace)) + (progn + (insert replace) ; Insert dictionary word. + (ispell-send-replacement (car poss) replace) + (setq accept-list (cons replace accept-list))) + (let ((replace-word (car replace))) + ;; Recheck hand entered replacement word. + (insert replace-word) + (ispell-send-replacement (car poss) replace-word) + (if (car (cdr replace)) + (save-window-excursion + (delete-other-windows) ; to correctly show help. + ;; Assume case-replace & + ;; case-fold-search correct? + (query-replace (car poss) (car replace) t))) + (goto-char word-start) + ;; Do not recheck if already accepted. + (if (member replace-word accept-list) + (setq accept-list (cons replace-word accept-list) + replace replace-word) + (let ((region-end (copy-marker ispell-region-end))) + (setq recheck-region ispell-filter + ispell-filter nil ; Save filter. + shift 0 ; Already accounted. + shift (ispell-region + word-start + (+ word-start (length replace-word)) + t shift)) + (if (null shift) ; Quitting check. + (setq shift 0)) + (set-marker ispell-region-end region-end) + (set-marker region-end nil) + (setq ispell-filter recheck-region + recheck-region nil + replace replace-word))))) + + (setq shift (+ shift (- (length replace) word-len))) + + ;; Move line-start across word... + ;; new shift function does this now... + ;;(set-marker line-start (+ line-start + ;; (- (length replace) + ;; (length (car poss))))) + )) + (if (not ispell-quit) ;; FIXME: remove redundancy with identical code above. - (let (message-log-max) - (message + (let (message-log-max) + (message "Continuing spelling check using %s with %s dictionary..." (file-name-nondirectory ispell-program-name) (or ispell-current-dictionary "default")))) - (sit-for 0) - (setq ispell-start (marker-position line-start) - ispell-end (marker-position line-end)) - ;; Adjust markers when end of region lost from highlighting. - (if (and (not recheck-region) + (sit-for 0) + (setq ispell-start (marker-position line-start) + ispell-end (marker-position line-end)) + ;; Adjust markers when end of region lost from highlighting. + (if (and (not recheck-region) (< ispell-end (+ word-start word-len))) - (setq ispell-end (+ word-start word-len))) - (if (= word-start ispell-region-end) - (set-marker ispell-region-end (+ word-start word-len))) - ;; going out of scope - unneeded - (set-marker line-start nil) - (set-marker word-start nil) - (set-marker line-end nil))) - ;; finished with misspelling! + (setq ispell-end (+ word-start word-len))) + (if (= word-start ispell-region-end) + (set-marker ispell-region-end (+ word-start word-len))) + ;; Going out of scope - unneeded. + (set-marker line-start nil) + (set-marker word-start nil) + (set-marker line-end nil))) + ;; Finished with misspelling! (setq ispell-filter (cdr ispell-filter))) shift)) diff --git a/lisp/textmodes/paragraphs.el b/lisp/textmodes/paragraphs.el index 4e17af1acb4..e773b53a73f 100644 --- a/lisp/textmodes/paragraphs.el +++ b/lisp/textmodes/paragraphs.el @@ -379,8 +379,8 @@ the number of paragraphs marked equals ARG. If ARG is negative, point is put at end of this paragraph, mark is put at beginning of this or a previous paragraph. -Interactively, if this command is repeated -or (in Transient Mark mode) if the mark is active, +Interactively (or if ALLOW-EXTEND is non-nil), if this command is +repeated or (in Transient Mark mode) if the mark is active, it marks the next ARG paragraphs after the ones already marked." (interactive "p\np") (unless arg (setq arg 1)) diff --git a/lisp/textmodes/po.el b/lisp/textmodes/po.el index 331f220f95b..610227af794 100644 --- a/lisp/textmodes/po.el +++ b/lisp/textmodes/po.el @@ -1,8 +1,8 @@ -;;; po.el --- basic support of PO translation files -*- coding: latin-1; -*- +;;; po.el --- basic support of PO translation files -*- coding: utf-8; -*- ;; Copyright (C) 1995-1998, 2000-2013 Free Software Foundation, Inc. -;; Authors: François Pinard <pinard@iro.umontreal.ca>, +;; Authors: François Pinard <pinard@iro.umontreal.ca>, ;; Greg McGary <gkm@magilla.cichlid.com>, ;; Bruno Haible <bruno@clisp.org>. ;; Keywords: i18n, files diff --git a/lisp/textmodes/reftex-cite.el b/lisp/textmodes/reftex-cite.el index 3b294e62b01..079101b56ee 100644 --- a/lisp/textmodes/reftex-cite.el +++ b/lisp/textmodes/reftex-cite.el @@ -1043,6 +1043,7 @@ While entering the regexp, completion on knows citation keys is possible. ((= l ?k) (reftex-get-bib-field "key" entry)) ((= l ?m) (reftex-get-bib-field "month" entry)) ((= l ?n) (reftex-get-bib-field "number" entry)) + ((= l ?N) (reftex-get-bib-field "note" entry)) ((= l ?o) (reftex-get-bib-field "organization" entry)) ((= l ?p) (reftex-get-bib-field "pages" entry)) ((= l ?P) (car (split-string @@ -1050,6 +1051,7 @@ While entering the regexp, completion on knows citation keys is possible. "[- .]+"))) ((= l ?s) (reftex-get-bib-field "school" entry)) ((= l ?u) (reftex-get-bib-field "publisher" entry)) + ((= l ?U) (reftex-get-bib-field "url" entry)) ((= l ?r) (reftex-get-bib-field "address" entry)) ((= l ?t) (reftex-get-bib-field "title" entry)) ((= l ?T) (reftex-abbreviate-title diff --git a/lisp/textmodes/reftex-vars.el b/lisp/textmodes/reftex-vars.el index db08ca3a514..2a5c9c55866 100644 --- a/lisp/textmodes/reftex-vars.el +++ b/lisp/textmodes/reftex-vars.el @@ -1125,12 +1125,12 @@ In the format, the following percent escapes will be expanded. %e Works like %a, but on list of editor names. (%2e and %E work a well) It is also possible to access all other BibTeX database fields: -%b booktitle %c chapter %d edition %h howpublished -%i institution %j journal %k key %m month -%n number %o organization %p pages %P first page -%r address %s school %u publisher %t title -%v volume %y year -%B booktitle, abbreviated %T title, abbreviated +%b booktitle %c chapter %d edition %h howpublished +%i institution %j journal %k key %m month +%n number %N note %o organization %p pages +%P first page %r address %s school %u publisher +%U url %t title %v volume %y year +%B booktitle, abbreviated %T title, abbreviated Usually, only %l is needed. The other stuff is mainly for the echo area display, and for (setq reftex-comment-citations t). diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el index a41409fc897..d5bb0170cd9 100644 --- a/lisp/textmodes/reftex.el +++ b/lisp/textmodes/reftex.el @@ -2464,7 +2464,7 @@ information about your RefTeX version and configuration." (require 'reporter) (let ((reporter-prompt-for-summary-p "Bug report subject: ")) (reporter-submit-bug-report - "bug-auctex@gnu.org" + "bug-auctex@gnu.org, bug-gnu-emacs@gnu.org" reftex-version (list 'window-system 'reftex-plug-into-AUCTeX) diff --git a/lisp/textmodes/remember.el b/lisp/textmodes/remember.el index 6ff4c720b71..eeb04ef250f 100644 --- a/lisp/textmodes/remember.el +++ b/lisp/textmodes/remember.el @@ -432,8 +432,7 @@ If you want to remember a region, supply a universal prefix to ;;;###autoload (defun remember-clipboard () "Remember the contents of the current clipboard. -Most useful for remembering things from Netscape or other X Windows -application." +Most useful for remembering things from other applications." (interactive) (remember (current-kill 0))) diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index b7288772034..33dfa277330 100644 --- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el @@ -46,9 +46,26 @@ :type 'integer :group 'sgml) +(defcustom sgml-xml-mode nil + "When non-nil, tag insertion functions will be XML-compliant. +It is set to be buffer-local when the file has +a DOCTYPE or an XML declaration." + :type 'boolean + :version "22.1" + :group 'sgml) + (defcustom sgml-transformation-function 'identity "Default value for `skeleton-transformation-function' in SGML mode." :type 'function + :initialize 'custom-initialize-default + :set (lambda (sym val) + (set-default sym val) + (mapc (lambda (buff) + (with-current-buffer buff + (and (derived-mode-p 'sgml-mode) + (not sgml-xml-mode) + (setq skeleton-transformation-function val)))) + (buffer-list))) :group 'sgml) (put 'sgml-transformation-function 'variable-interactive @@ -295,8 +312,8 @@ Any terminating `>' or `/' is not matched.") (defconst sgml-syntax-propertize-function (syntax-propertize-rules - ;; Use the `b' style of comments to avoid interference with the -- ... -- - ;; comments recognized when `sgml-specials' includes ?-. + ;; Use the `b' style of comments to avoid interference with the -- ... -- + ;; comments recognized when `sgml-specials' includes ?-. ;; FIXME: beware of <!--> blabla <!--> !! ("\\(<\\)!--" (1 "< b")) ("--[ \t\n]*\\(>\\)" (1 "> b")) @@ -305,7 +322,7 @@ Any terminating `>' or `/' is not matched.") ;; going to change, so as not to need to flush the data we just computed. ("\"" (0 (if (prog1 (zerop (car (syntax-ppss (match-beginning 0)))) (goto-char (match-end 0))) - ".")))) + (string-to-syntax "."))))) "Syntactic keywords for `sgml-mode'.") ;; internal @@ -364,14 +381,6 @@ an optional alist of possible values." (string :tag "Description"))) :group 'sgml) -(defcustom sgml-xml-mode nil - "When non-nil, tag insertion functions will be XML-compliant. -It is set to be buffer-local when the file has -a DOCTYPE or an XML declaration." - :type 'boolean - :version "22.1" - :group 'sgml) - (defvar sgml-empty-tags nil "List of tags whose !ELEMENT definition says EMPTY.") @@ -635,10 +644,8 @@ This only works for Latin-1 input." (define-skeleton sgml-tag "Prompt for a tag and insert it, optionally with attributes. Completion and configuration are done according to `sgml-tag-alist'. -If you like tags and attributes in uppercase do \\[set-variable] -`skeleton-transformation-function' RET `upcase' RET, or put this -in your `.emacs': - (setq sgml-transformation-function 'upcase)" +If you like tags and attributes in uppercase, customize +`sgml-transformation-function' to 'upcase." (funcall (or skeleton-transformation-function 'identity) (setq sgml-tag-last (completing-read diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 480ab8a581a..7b16262233d 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -271,9 +271,7 @@ otherwise the value of `tex-start-options', the \(shell-quoted\) value of `tex-start-commands', and the file name are added at the end with blanks as separators. -In TeX, LaTeX, and SliTeX Mode this variable becomes buffer local. -In these modes, use \\[set-variable] if you want to change it for the -current buffer.") +In TeX, LaTeX, and SliTeX Mode this variable becomes buffer local.") (defvar tex-trailer nil "String appended after the end of a region sent to TeX by \\[tex-region].") diff --git a/lisp/textmodes/tildify.el b/lisp/textmodes/tildify.el index 3ba19bb9f40..f25fa87d0ec 100644 --- a/lisp/textmodes/tildify.el +++ b/lisp/textmodes/tildify.el @@ -40,7 +40,7 @@ ;; The default variable settings are suited for Czech, so do not try to ;; understand them if you are not familiar with Czech grammar and spelling. ;; -;; The algorithm was inspired by Petr Ol¹ák's program `vlna'. Abilities of +;; The algorithm was inspired by Petr Olšák's program `vlna'. Abilities of ;; `tildify.el' are a little limited; if you have improvement suggestions, let ;; me know. @@ -349,7 +349,7 @@ further questions)." ;; Local variables: -;; coding: iso-latin-2 +;; coding: utf-8 ;; End: ;;; tildify.el ends here diff --git a/lisp/textmodes/two-column.el b/lisp/textmodes/two-column.el index c67aa338791..23e90552096 100644 --- a/lisp/textmodes/two-column.el +++ b/lisp/textmodes/two-column.el @@ -259,9 +259,9 @@ if that value is non-nil. These buffers can be edited separately, for example with `fill-paragraph'. If you want to disable parallel scrolling temporarily, use \\[2C-toggle-autoscroll] . -If you include long lines, i.e which will span both columns (eg. -source code), they should be in what will be the first column, with -the associated buffer having empty lines next to them. +If you include long lines that span both columns (e.g., source +code), they should be in what will be the first column, with the +associated buffer having empty lines next to them. Potential uses are writing bilingual texts, or editing the comments of a source code. See the file lisp/two-column.el for detailed examples. |
