summaryrefslogtreecommitdiff
path: root/lisp/textmodes
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2005-10-07 07:15:40 +0000
committerMiles Bader <miles@gnu.org>2005-10-07 07:15:40 +0000
commit00e18f33adde1d2f196fdf9cadf11235cc4fcc8f (patch)
tree8c553c9a361da158ba47f3d0ed0429da180d957f /lisp/textmodes
parentba4c328314c2b01e6dcc3807a0666a644c3f3954 (diff)
parent9e1cb4bc96d36af6e8b893d467970a25afead03b (diff)
downloademacs-00e18f33adde1d2f196fdf9cadf11235cc4fcc8f.tar.gz
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-88
Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 569-579) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 129-132) - Update from CVS - Merge from emacs--cvs-trunk--0
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/artist.el6
-rw-r--r--lisp/textmodes/bibtex.el70
-rw-r--r--lisp/textmodes/flyspell.el1
-rw-r--r--lisp/textmodes/ispell.el4
-rw-r--r--lisp/textmodes/tex-mode.el41
5 files changed, 71 insertions, 51 deletions
diff --git a/lisp/textmodes/artist.el b/lisp/textmodes/artist.el
index c9fcd01d018..b13b080cf79 100644
--- a/lisp/textmodes/artist.el
+++ b/lisp/textmodes/artist.el
@@ -3379,7 +3379,7 @@ The POINT-LIST is expected to cover the first quadrant."
;; that look like: \ / instead we get: ( )
;; \ / \ /
;; --------- ---------
- (let ((last-coord (last point-list)))
+ (let ((last-coord (car (last point-list))))
(if (= (artist-coord-get-new-char last-coord) ?/)
(artist-coord-set-new-char last-coord artist-ellipse-right-char)))
@@ -3848,8 +3848,8 @@ Optional argument STATE can be used to set state (default is nil)."
(x2 (artist-endpoint-get-x ep2))
(y2 (artist-endpoint-get-y ep2))
(dir1 (artist-find-direction x2 y2 x1 y1))
- (epn (last point-list))
- (epn-1 (last point-list 2))
+ (epn (car (last point-list)))
+ (epn-1 (car (last point-list 2)))
(xn (artist-endpoint-get-x epn))
(yn (artist-endpoint-get-y epn))
(xn-1 (artist-endpoint-get-x epn-1))
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index b85299c27e5..2177f72fd0d 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -1120,7 +1120,7 @@ The CDRs of the elements are t for header keys and nil for crossref keys.")
"Regexp matching the name of a valid BibTeX entry.")
(defvar bibtex-valid-entry-whitespace-re
- (concat "[ \t\n]*\\(" bibtex-valid-entry-re "\\)")
+ (concat "[ \t]*\\(" bibtex-valid-entry-re "\\)")
"Regexp matching the name of a valid BibTeX entry preceded by whitespace.")
(defvar bibtex-any-valid-entry-re
@@ -2566,34 +2566,33 @@ Use `bibtex-summary-function' to generate summary."
"Return summary of current BibTeX entry.
Used as default value of `bibtex-summary-function'."
;; It would be neat to customize this function. How?
- (save-excursion
- (if (looking-at bibtex-entry-maybe-empty-head)
- (let* ((bibtex-autokey-name-case-convert 'identity)
- (bibtex-autokey-name-length 'infty)
- (bibtex-autokey-names 1)
- (bibtex-autokey-names-stretch 0)
- (bibtex-autokey-name-separator " ")
- (bibtex-autokey-additional-names " etal")
- (names (bibtex-autokey-get-names))
- (bibtex-autokey-year-length 4)
- (year (bibtex-autokey-get-year))
- (bibtex-autokey-titlewords 5)
- (bibtex-autokey-titlewords-stretch 2)
- (bibtex-autokey-titleword-case-convert 'identity)
- (bibtex-autokey-titleword-length 5)
- (bibtex-autokey-titleword-separator " ")
- (title (bibtex-autokey-get-title))
- (journal (bibtex-autokey-get-field
- "journal" bibtex-autokey-transcriptions))
- (volume (bibtex-autokey-get-field "volume"))
- (pages (bibtex-autokey-get-field "pages" '(("-.*\\'" . "")))))
- (mapconcat (lambda (arg)
- (if (not (string= "" (cdr arg)))
- (concat (car arg) (cdr arg))))
- `((" " . ,names) (" " . ,year) (": " . ,title)
- (", " . ,journal) (" " . ,volume) (":" . ,pages))
- ""))
- (error "Entry not found"))))
+ (if (looking-at bibtex-entry-maybe-empty-head)
+ (let* ((bibtex-autokey-name-case-convert 'identity)
+ (bibtex-autokey-name-length 'infty)
+ (bibtex-autokey-names 1)
+ (bibtex-autokey-names-stretch 0)
+ (bibtex-autokey-name-separator " ")
+ (bibtex-autokey-additional-names " etal")
+ (names (bibtex-autokey-get-names))
+ (bibtex-autokey-year-length 4)
+ (year (bibtex-autokey-get-year))
+ (bibtex-autokey-titlewords 5)
+ (bibtex-autokey-titlewords-stretch 2)
+ (bibtex-autokey-titleword-case-convert 'identity)
+ (bibtex-autokey-titleword-length 5)
+ (bibtex-autokey-titleword-separator " ")
+ (title (bibtex-autokey-get-title))
+ (journal (bibtex-autokey-get-field
+ "journal" bibtex-autokey-transcriptions))
+ (volume (bibtex-autokey-get-field "volume"))
+ (pages (bibtex-autokey-get-field "pages" '(("-.*\\'" . "")))))
+ (mapconcat (lambda (arg)
+ (if (not (string= "" (cdr arg)))
+ (concat (car arg) (cdr arg))))
+ `((" " . ,names) (" " . ,year) (": " . ,title)
+ (", " . ,journal) (" " . ,volume) (":" . ,pages))
+ ""))
+ (error "Entry not found")))
(defun bibtex-pop (arg direction)
"Fill current field from the ARGth same field's text in DIRECTION.
@@ -3950,9 +3949,9 @@ If optional arg MOVE is non-nil move point to end of field."
(insert " ")
(indent-to-column bibtex-text-indentation)))
(re-search-forward "[ \t\n]*=[ \t\n]*" end-field))
- (while (re-search-forward "[ \t\n]+" end-field 'move)
- (replace-match " "))
- (do-auto-fill)
+ ;; Paragraphs within fields are not preserved. Bother?
+ (fill-region-as-paragraph (line-beginning-position) end-field
+ default-justification nil (point))
(if move (goto-char end-field))))
(defun bibtex-fill-field (&optional justify)
@@ -3992,13 +3991,14 @@ If `bibtex-align-at-equal-sign' is non-nil, align equal signs, too."
(defun bibtex-realign ()
"Realign BibTeX entries such that they are separated by one blank line."
(goto-char (point-min))
- (let ((case-fold-search t))
+ (let ((case-fold-search t)
+ (valid-entry (concat "[ \t\n]*\\(" bibtex-valid-entry-re "\\)")))
;; No blank lines prior to the first valid entry if there no
;; non-white characters in front of it.
- (when (looking-at bibtex-valid-entry-whitespace-re)
+ (when (looking-at valid-entry)
(replace-match "\\1"))
;; Valid entries are separated by one blank line.
- (while (re-search-forward bibtex-valid-entry-whitespace-re nil t)
+ (while (re-search-forward valid-entry nil t)
(replace-match "\n\n\\1"))
;; One blank line past the last valid entry if it is followed by
;; non-white characters, no blank line otherwise.
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index 151a32c60a9..bd91e2b9b3d 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -536,6 +536,7 @@ in your .emacs file.
;*---------------------------------------------------------------------*/
(defun flyspell-mode-on ()
"Turn Flyspell mode on. Do not use this; use `flyspell-mode' instead."
+ (ispell-maybe-find-aspell-dictionaries)
(setq ispell-highlight-face 'flyspell-incorrect)
;; local dictionaries setup
(or ispell-local-dictionary ispell-dictionary
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 8da812dd45a..aeb2e5f87da 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -892,7 +892,6 @@ and added as a submenu of the \"Edit\" menu.")
(defun ispell-find-aspell-dictionaries ()
"Find Aspell's dictionaries, and record in `ispell-dictionary-alist'."
- (interactive)
(unless ispell-really-aspell
(error "This function only works with aspell"))
(let ((dictionaries
@@ -1528,6 +1527,7 @@ quit spell session exited."
(interactive (list ispell-following-word ispell-quietly current-prefix-arg))
(if continue
(ispell-continue)
+ (ispell-maybe-find-aspell-dictionaries)
(ispell-accept-buffer-local-defs) ; use the correct dictionary
(let ((cursor-location (point)) ; retain cursor location
(word (ispell-get-word following))
@@ -2586,6 +2586,7 @@ a new one will be started when needed."
Return nil if spell session is quit,
otherwise returns shift offset amount for last line processed."
(interactive "r") ; Don't flag errors on read-only bufs.
+ (ispell-maybe-find-aspell-dictionaries)
(if (not recheckp)
(ispell-accept-buffer-local-defs)) ; set up dictionary, local words, etc.
(let ((skip-region-start (make-marker))
@@ -3547,7 +3548,6 @@ You can bind this to the key C-c i in GNUS or mail by adding to
(defun ispell-accept-buffer-local-defs ()
"Load all buffer-local information, restarting Ispell when necessary."
- (ispell-maybe-find-aspell-dictionaries)
(ispell-buffer-local-dict) ; May kill ispell-process.
(ispell-buffer-local-words) ; Will initialize ispell-process.
(ispell-buffer-local-parsing))
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index 23885499828..24267b7b8f2 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -631,7 +631,10 @@ An alternative value is \" . \", if you use a font with a narrow period."
(,(concat "^\\(\\\\\\)end *{" verbs "}\\(.?\\)") (1 "|") (3 "<"))
;; ("^\\(\\\\\\)begin *{comment}" 1 "< b")
;; ("^\\\\end *{comment}.*\\(\n\\)" 1 "> b")
- ("\\\\verb\\**\\([^a-z@*]\\)" 1 "\""))))
+ ("\\\\verb\\**\\([^a-z@*]\\)"
+ ;; Do it last, because it uses syntax-ppss which needs the
+ ;; syntax-table properties of previous entries.
+ 1 (tex-font-lock-verb (match-end 1))))))
(defun tex-font-lock-unfontify-region (beg end)
(font-lock-default-unfontify-region beg end)
@@ -670,22 +673,38 @@ An alternative value is \" . \", if you use a font with a narrow period."
(put 'tex-verbatim-face 'face-alias 'tex-verbatim)
(defvar tex-verbatim-face 'tex-verbatim)
+(defun tex-font-lock-verb (end)
+ "Place syntax-table properties on the \verb construct.
+END is the position of the first delimiter after \verb."
+ (unless (nth 8 (syntax-ppss end))
+ ;; Do nothing if the \verb construct is itself inside a comment or
+ ;; verbatim env.
+ (save-excursion
+ ;; Let's find the end and mark it.
+ ;; We used to do it inside tex-font-lock-syntactic-face-function, but
+ ;; this leads to funny effects when jumping to the end of the buffer,
+ ;; because font-lock applies font-lock-syntactic-keywords to the whole
+ ;; preceding text but font-lock-syntactic-face-function only to the
+ ;; actually displayed text.
+ (goto-char end)
+ (let ((char (char-before)))
+ (skip-chars-forward (string ?^ char)) ;; Use `end' ?
+ (when (eq (char-syntax (preceding-char)) ?/)
+ (put-text-property (1- (point)) (point) 'syntax-table '(1)))
+ (unless (eobp)
+ (put-text-property (point) (1+ (point)) 'syntax-table '(7))
+ ;; Cause the rest of the buffer to be re-fontified.
+ ;; (remove-text-properties (1+ (point)) (point-max) '(fontified))
+ )))
+ "\""))
+
;; Use string syntax but math face for $...$.
(defun tex-font-lock-syntactic-face-function (state)
(let ((char (nth 3 state)))
(cond
((not char) font-lock-comment-face)
((eq char ?$) tex-math-face)
- (t
- (when (characterp char)
- ;; This is a \verb?...? construct. Let's find the end and mark it.
- (save-excursion
- (skip-chars-forward (string ?^ char)) ;; Use `end' ?
- (when (eq (char-syntax (preceding-char)) ?/)
- (put-text-property (1- (point)) (point) 'syntax-table '(1)))
- (unless (eobp)
- (put-text-property (point) (1+ (point)) 'syntax-table '(7)))))
- tex-verbatim-face))))
+ (t tex-verbatim-face))))
(defun tex-define-common-keys (keymap)