summaryrefslogtreecommitdiff
path: root/lisp/textmodes
diff options
context:
space:
mode:
authorKaroly Lorentey <lorentey@elte.hu>2006-05-24 09:13:31 +0000
committerKaroly Lorentey <lorentey@elte.hu>2006-05-24 09:13:31 +0000
commit40a1b46245c1a8786324f5a06d6cb8d4bd9d5b74 (patch)
treef45020695e190f511f4faf4dd3ed144059f298c0 /lisp/textmodes
parentdbe9f5ba9648890dc34f4836a49fde766b21ce74 (diff)
parent4ea5193b9cc5c577127ca6c89ecfaad819398d3b (diff)
downloademacs-40a1b46245c1a8786324f5a06d6cb8d4bd9d5b74.tar.gz
Merged from emacs@sv.gnu.org
Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-289 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-290 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-291 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-292 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-293 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-567
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/artist.el17
-rw-r--r--lisp/textmodes/bibtex.el15
-rw-r--r--lisp/textmodes/flyspell.el31
-rw-r--r--lisp/textmodes/ispell.el15
-rw-r--r--lisp/textmodes/sgml-mode.el44
5 files changed, 70 insertions, 52 deletions
diff --git a/lisp/textmodes/artist.el b/lisp/textmodes/artist.el
index 9305bdbf9bc..d5dcdd0d9ef 100644
--- a/lisp/textmodes/artist.el
+++ b/lisp/textmodes/artist.el
@@ -365,10 +365,11 @@ Example:
"*If in X Windows, use this pointer shape while drawing with the mouse.")
-(defcustom artist-text-renderer 'artist-figlet
+(defcustom artist-text-renderer-function 'artist-figlet
"Function for doing text rendering."
:group 'artist-text
:type 'symbol)
+(defvaralias 'artist-text-renderer 'artist-text-renderer-function)
(defcustom artist-figlet-program "figlet"
@@ -2910,23 +2911,25 @@ Let blanks in TEXT overwrite any text already in the buffer."
(defun artist-text-see-thru (x y)
"Prompt for text to render, render it at X,Y.
-This is done by calling the function specified by `artist-text-renderer',
-which must return a list of strings, to be inserted in the buffer.
+This is done by calling the function specified by
+`artist-text-renderer-function', which must return a list of strings,
+to be inserted in the buffer.
Text already in the buffer ``shines thru'' blanks in the rendered text."
(let* ((input-text (read-string "Type text to render: "))
- (rendered-text (artist-funcall artist-text-renderer input-text)))
+ (rendered-text (artist-funcall artist-text-renderer-function input-text)))
(artist-text-insert-see-thru x y rendered-text)))
(defun artist-text-overwrite (x y)
"Prompt for text to render, render it at X,Y.
-This is done by calling the function specified by `artist-text-renderer',
-which must return a list of strings, to be inserted in the buffer.
+This is done by calling the function specified by
+`artist-text-renderer-function', which must return a list of strings,
+to be inserted in the buffer.
Blanks in the rendered text overwrites any text in the buffer."
(let* ((input-text (read-string "Type text to render: "))
- (rendered-text (artist-funcall artist-text-renderer input-text)))
+ (rendered-text (artist-funcall artist-text-renderer-function input-text)))
(artist-text-insert-overwrite x y rendered-text)))
;;
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index e4f0a3db545..74ec8beffa2 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -87,7 +87,7 @@ If this is a function, call it to generate the initial field text."
:type '(choice (const :tag "None" nil)
(string :tag "Initial text")
(function :tag "Initialize Function" :value fun)
- (other :tag "Default" t)))
+ (const :tag "Default" t)))
(put 'bibtex-include-OPTkey 'risky-local-variable t)
(defcustom bibtex-user-optional-fields
@@ -153,7 +153,7 @@ narrowed to just the entry."
(defcustom bibtex-maintain-sorted-entries nil
"If non-nil, BibTeX mode maintains all entries in sorted order.
Allowed non-nil values are:
-plain All entries are sorted alphabetically.
+plain or t All entries are sorted alphabetically.
crossref All entries are sorted alphabetically unless an entry has a
crossref field. These crossrefed entries are placed in
alphabetical order immediately preceding the main entry.
@@ -165,7 +165,10 @@ See also `bibtex-sort-ignore-string-entries'."
:type '(choice (const nil)
(const plain)
(const crossref)
- (const entry-class)))
+ (const entry-class)
+ (const t)))
+(put 'bibtex-maintain-sorted-entries 'safe-local-variable
+ '(lambda (a) (memq a '(nil t plain crossref entry-class))))
(defcustom bibtex-sort-entry-class
'(("String")
@@ -1800,7 +1803,8 @@ Formats current entry according to variable `bibtex-entry-format'."
;; identify entry type
(goto-char (point-min))
- (re-search-forward bibtex-entry-type)
+ (or (re-search-forward bibtex-entry-type nil t)
+ (error "Not inside a BibTeX entry"))
(let ((beg-type (1+ (match-beginning 0)))
(end-type (match-end 0)))
(setq entry-list (assoc-string (buffer-substring-no-properties
@@ -3876,7 +3880,8 @@ At end of the cleaning process, the functions in
(interactive "P")
(let ((case-fold-search t)
(start (bibtex-beginning-of-entry))
- (_ (looking-at bibtex-any-entry-maybe-empty-head))
+ (_ (or (looking-at bibtex-any-entry-maybe-empty-head)
+ (error "Not inside a BibTeX entry")))
(entry-type (bibtex-type-in-head))
(key (bibtex-key-in-head)))
;; formatting
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index 54b67a258a6..c20ecef31e0 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -271,21 +271,23 @@ If `flyspell-large-region' is nil, all regions are treated as small."
;;* using flyspell with mail-mode add the following expression */
;;* in your .emacs file: */
;;* (add-hook 'mail-mode */
-;;* '(lambda () (setq flyspell-generic-check-word-p */
-;;* 'mail-mode-flyspell-verify))) */
+;;* '(lambda () (setq flyspell-generic-check-word-predicate */
+;;* 'mail-mode-flyspell-verify))) */
;;*---------------------------------------------------------------------*/
-(defvar flyspell-generic-check-word-p nil
+(defvar flyspell-generic-check-word-predicate nil
"Function providing per-mode customization over which words are flyspelled.
Returns t to continue checking, nil otherwise.
Flyspell mode sets this variable to whatever is the `flyspell-mode-predicate'
property of the major mode name.")
-(make-variable-buffer-local 'flyspell-generic-check-word-p)
+(make-variable-buffer-local 'flyspell-generic-check-word-predicate)
+(defvaralias 'flyspell-generic-check-word-p
+ 'flyspell-generic-check-word-predicate)
;;*--- mail mode -------------------------------------------------------*/
(put 'mail-mode 'flyspell-mode-predicate 'mail-mode-flyspell-verify)
(put 'message-mode 'flyspell-mode-predicate 'mail-mode-flyspell-verify)
(defun mail-mode-flyspell-verify ()
- "This function is used for `flyspell-generic-check-word-p' in Mail mode."
+ "Function used for `flyspell-generic-check-word-predicate' in Mail mode."
(let ((header-end (save-excursion
(goto-char (point-min))
(re-search-forward
@@ -313,7 +315,7 @@ property of the major mode name.")
;;*--- texinfo mode ----------------------------------------------------*/
(put 'texinfo-mode 'flyspell-mode-predicate 'texinfo-mode-flyspell-verify)
(defun texinfo-mode-flyspell-verify ()
- "This function is used for `flyspell-generic-check-word-p' in Texinfo mode."
+ "Function used for `flyspell-generic-check-word-predicate' in Texinfo mode."
(save-excursion
(forward-word -1)
(not (looking-at "@"))))
@@ -321,7 +323,7 @@ property of the major mode name.")
;;*--- tex mode --------------------------------------------------------*/
(put 'tex-mode 'flyspell-mode-predicate 'tex-mode-flyspell-verify)
(defun tex-mode-flyspell-verify ()
- "This function is used for `flyspell-generic-check-word-p' in LaTeX mode."
+ "Function used for `flyspell-generic-check-word-predicate' in LaTeX mode."
(and
(not (save-excursion
(re-search-backward "^[ \t]*%%%[ \t]+Local" nil t)))
@@ -338,7 +340,7 @@ property of the major mode name.")
(put 'html-mode 'flyspell-mode-predicate 'sgml-mode-flyspell-verify)
(defun sgml-mode-flyspell-verify ()
- "This function is used for `flyspell-generic-check-word-p' in SGML mode."
+ "Function used for `flyspell-generic-check-word-predicate' in SGML mode."
(not (save-excursion
(let ((this (point-marker))
(s (progn (beginning-of-line) (point-marker)))
@@ -368,7 +370,7 @@ property of the major mode name.")
"Faces corresponding to text in programming-mode buffers.")
(defun flyspell-generic-progmode-verify ()
- "Used for `flyspell-generic-check-word-p' in programming modes."
+ "Used for `flyspell-generic-check-word-predicate' in programming modes."
(let ((f (get-text-property (point) 'face)))
(memq f flyspell-prog-text-faces)))
@@ -376,7 +378,8 @@ property of the major mode name.")
(defun flyspell-prog-mode ()
"Turn on `flyspell-mode' for comments and strings."
(interactive)
- (setq flyspell-generic-check-word-p 'flyspell-generic-progmode-verify)
+ (setq flyspell-generic-check-word-predicate
+ 'flyspell-generic-progmode-verify)
(flyspell-mode 1)
(run-hooks 'flyspell-prog-mode-hook))
@@ -563,10 +566,10 @@ in your .emacs file.
(add-hook 'pre-command-hook (function flyspell-pre-command-hook) t t)
;; we bound flyspell action to after-change hook
(add-hook 'after-change-functions 'flyspell-after-change-function nil t)
- ;; set flyspell-generic-check-word-p based on the major mode
+ ;; set flyspell-generic-check-word-predicate based on the major mode
(let ((mode-predicate (get major-mode 'flyspell-mode-predicate)))
(if mode-predicate
- (setq flyspell-generic-check-word-p mode-predicate)))
+ (setq flyspell-generic-check-word-predicate mode-predicate)))
;; the welcome message
(if (and flyspell-issue-message-flag
flyspell-issue-welcome-flag
@@ -979,8 +982,8 @@ Mostly we check word delimiters."
(flyspell-word (flyspell-get-word following))
start end poss word)
(if (or (eq flyspell-word nil)
- (and (fboundp flyspell-generic-check-word-p)
- (not (funcall flyspell-generic-check-word-p))))
+ (and (fboundp flyspell-generic-check-word-predicate)
+ (not (funcall flyspell-generic-check-word-predicate))))
t
(progn
;; destructure return flyspell-word info list.
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index fed06a572bb..7bfedb1bd97 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -416,11 +416,12 @@ The following values are supported:
:type 'boolean
:group 'ispell)
-(defcustom ispell-format-word (function upcase)
+(defcustom ispell-format-word-function (function upcase)
"*Formatting function for displaying word being spell checked.
The function must take one string argument and return a string."
:type 'function
:group 'ispell)
+(defvaralias 'ispell-format-word 'ispell-format-word-function)
(defcustom ispell-use-framepop-p nil
"When non-nil ispell uses framepop to display choices in a dedicated frame.
@@ -1595,7 +1596,7 @@ quit spell session exited."
;; But that is silly; if the user asks for it, we should do it. - rms.
(or quietly
(message "Checking spelling of %s..."
- (funcall ispell-format-word word)))
+ (funcall ispell-format-word-function word)))
(ispell-send-string "%\n") ; put in verbose mode
(ispell-send-string (concat "^" word "\n"))
;; wait until ispell has processed word
@@ -1611,7 +1612,7 @@ quit spell session exited."
(cond ((eq poss t)
(or quietly
(message "%s is correct"
- (funcall ispell-format-word word)))
+ (funcall ispell-format-word-function word)))
(and (fboundp 'extent-at)
(extent-at start)
(and (fboundp 'delete-extent)
@@ -1619,8 +1620,8 @@ quit spell session exited."
((stringp poss)
(or quietly
(message "%s is correct because of root %s"
- (funcall ispell-format-word word)
- (funcall ispell-format-word poss)))
+ (funcall ispell-format-word-function word)
+ (funcall ispell-format-word-function poss)))
(and (fboundp 'extent-at)
(extent-at start)
(and (fboundp 'delete-extent)
@@ -1633,7 +1634,8 @@ quit spell session exited."
(set-extent-property ext 'face ispell-highlight-face)
(set-extent-property ext 'priority 2000)))
(beep)
- (message "%s is incorrect"(funcall ispell-format-word word))))
+ (message "%s is incorrect"
+ (funcall ispell-format-word-function word))))
(t ; prompt for correct word.
(save-window-excursion
(setq replace (ispell-command-loop
@@ -3359,6 +3361,7 @@ Don't read buffer-local settings or word lists."
"*End of text which will be checked in `ispell-message'.
If it is a string, limit at first occurrence of that regular expression.
Otherwise, it must be a function which is called to get the limit.")
+(put 'ispell-message-text-end 'risky-local-variable t)
(defun ispell-mime-multipartp (&optional limit)
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index ff6df4a5a56..6136d22e432 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -49,13 +49,14 @@
:type 'integer
:group 'sgml)
-(defcustom sgml-transformation 'identity
- "*Default value for `skeleton-transformation' (which see) in SGML mode."
+(defcustom sgml-transformation-function 'identity
+ "*Default value for `skeleton-transformation-function' in SGML mode."
:type 'function
:group 'sgml)
-(put 'sgml-transformation 'variable-interactive
+(put 'sgml-transformation-function 'variable-interactive
"aTransformation function: ")
+(defvaralias 'sgml-transformation 'sgml-transformation-function)
(defcustom sgml-mode-hook nil
"Hook run by command `sgml-mode'.
@@ -335,6 +336,7 @@ an optional alist of possible values."
:type '(repeat (cons (string :tag "Tag Name")
(repeat :tag "Tag Rule" sexp)))
:group 'sgml)
+(put 'sgml-tag-alist 'risky-local-variable t)
(defcustom sgml-tag-help
'(("!" . "Empty declaration for comment")
@@ -391,7 +393,7 @@ a DOCTYPE or an XML declaration."
(defun sgml-mode-facemenu-add-face-function (face end)
(if (setq face (cdr (assq face sgml-face-tag-alist)))
(progn
- (setq face (funcall skeleton-transformation face))
+ (setq face (funcall skeleton-transformation-function face))
(setq facemenu-end-add-face (concat "</" face ">"))
(concat "<" face ">"))
(error "Face not configured for %s mode" mode-name)))
@@ -415,8 +417,8 @@ An argument of N to a tag-inserting command means to wrap it around
the next N words. In Transient Mark mode, when the mark is active,
N defaults to -1, which means to wrap it around the current region.
-If you like upcased tags, put (setq sgml-transformation 'upcase) in
-your `.emacs' file.
+If you like upcased tags, put (setq sgml-transformation-function 'upcase)
+in your `.emacs' file.
Use \\[sgml-validate] to validate your document with an SGML parser.
@@ -460,7 +462,8 @@ Do \\[describe-key] on the following bindings to discover what they do.
(sgml-xml-guess)
(if sgml-xml-mode
(setq mode-name "XML")
- (set (make-local-variable 'skeleton-transformation) sgml-transformation))
+ (set (make-local-variable 'skeleton-transformation-function)
+ sgml-transformation-function))
;; This will allow existing comments within declarations to be
;; recognized.
(set (make-local-variable 'comment-start-skip) "\\(?:<!\\)?--[ \t]*")
@@ -604,9 +607,9 @@ This only works for Latin-1 input."
(if sgml-name-8bit-mode "ON" "OFF")))
;; When an element of a skeleton is a string "str", it is passed
-;; through skeleton-transformation and inserted. If "str" is to be
-;; inserted literally, one should obtain it as the return value of a
-;; function, e.g. (identity "str").
+;; through `skeleton-transformation-function' and inserted.
+;; If "str" is to be inserted literally, one should obtain it as
+;; the return value of a function, e.g. (identity "str").
(defvar sgml-tag-last nil)
(defvar sgml-tag-history nil)
@@ -614,9 +617,10 @@ This only works for Latin-1 input."
"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 RET upcase RET, or put this in your `.emacs':
- (setq sgml-transformation 'upcase)"
- (funcall (or skeleton-transformation 'identity)
+`skeleton-transformation-function' RET `upcase' RET, or put this
+in your `.emacs':
+ (setq sgml-transformation-function 'upcase)"
+ (funcall (or skeleton-transformation-function 'identity)
(setq sgml-tag-last
(completing-read
(if (> (length sgml-tag-last) 0)
@@ -639,7 +643,7 @@ skeleton-transformation RET upcase RET, or put this in your `.emacs':
;; For xhtml's `tr' tag, we should maybe use \n instead.
(if (eq v2 t) (setq v2 nil))
;; We use `identity' to prevent skeleton from passing
- ;; `str' through skeleton-transformation a second time.
+ ;; `str' through `skeleton-transformation-function' a second time.
'(("") v2 _ v2 "</" (identity ',str) ?>))
((eq (car v2) t)
(cons '("") (cdr v2)))
@@ -670,12 +674,12 @@ If QUIET, do not print a message when there are no attributes for TAG."
(if (stringp (car alist))
(progn
(insert (if (eq (preceding-char) ?\s) "" ?\s)
- (funcall skeleton-transformation (car alist)))
+ (funcall skeleton-transformation-function (car alist)))
(sgml-value alist))
(setq i (length alist))
(while (> i 0)
(insert ?\s)
- (insert (funcall skeleton-transformation
+ (insert (funcall skeleton-transformation-function
(setq attribute
(skeleton-read '(completing-read
"Attribute: "
@@ -1981,12 +1985,12 @@ Can be used as a value for `html-mode-hook'."
"\" name=\"" (or v1 (setq v1 (skeleton-read "Name: ")))
"\" value=\"" str ?\"
(when (y-or-n-p "Set \"checked\" attribute? ")
- (funcall skeleton-transformation
+ (funcall skeleton-transformation-function
(if sgml-xml-mode " checked=\"checked\"" " checked")))
(if sgml-xml-mode " />" ">")
(skeleton-read "Text: " (capitalize str))
(or v2 (setq v2 (if (y-or-n-p "Newline after text? ")
- (funcall skeleton-transformation
+ (funcall skeleton-transformation-function
(if sgml-xml-mode "<br />" "<br>"))
"")))
\n))
@@ -2001,12 +2005,12 @@ Can be used as a value for `html-mode-hook'."
"\" name=\"" (or (car v2) (setcar v2 (skeleton-read "Name: ")))
"\" value=\"" str ?\"
(when (and (not v1) (setq v1 (y-or-n-p "Set \"checked\" attribute? ")))
- (funcall skeleton-transformation
+ (funcall skeleton-transformation-function
(if sgml-xml-mode " checked=\"checked\"" " checked")))
(if sgml-xml-mode " />" ">")
(skeleton-read "Text: " (capitalize str))
(or (cdr v2) (setcdr v2 (if (y-or-n-p "Newline after text? ")
- (funcall skeleton-transformation
+ (funcall skeleton-transformation-function
(if sgml-xml-mode "<br />" "<br>"))
"")))
\n))