X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/7b1019e2781472c793d0bf74e2b9ee17894270b8..38d50547c2a8195bed0aaeafbbc4c0f277d4e416:/lisp/textmodes/texinfo.el diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el index 5f6724fea0..be23a439bf 100644 --- a/lisp/textmodes/texinfo.el +++ b/lisp/textmodes/texinfo.el @@ -1,7 +1,8 @@ -;;; texinfo.el --- major mode for editing Texinfo files -*- coding: iso-2022-7bit -*- +;;; texinfo.el --- major mode for editing Texinfo files -*- coding: utf-8 -*- ;; Copyright (C) 1985, 1988, 1989, 1990, 1991, 1992, 1993, 1996, 1997, -;; 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +;; 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +;; Free Software Foundation, Inc. ;; Author: Robert J. Chassell ;; Date: [See date below for texinfo-version] @@ -41,13 +42,13 @@ :group 'docs) ;;;###autoload -(defcustom texinfo-open-quote "``" +(defcustom texinfo-open-quote (purecopy "``") "String inserted by typing \\[texinfo-insert-quote] to open a quotation." :type 'string :group 'texinfo) ;;;###autoload -(defcustom texinfo-close-quote "''" +(defcustom texinfo-close-quote (purecopy "''") "String inserted by typing \\[texinfo-insert-quote] to close a quotation." :type 'string :group 'texinfo) @@ -309,10 +310,11 @@ chapter." ("Chapters" "^@chapter[ \t]+\\(.*\\)$" 1)) "Imenu generic expression for Texinfo mode. See `imenu-generic-expression'.") -(defvar texinfo-font-lock-syntactic-keywords - '(("\\(@\\)c\\(omment\\)?\\>" (1 "<")) - ("^\\(@\\)ignore\\>" (1 "< b")) - ("^@end ignore\\(\n\\)" (1 "> b"))) +(defconst texinfo-syntax-propertize-function + (syntax-propertize-rules + ("\\(@\\)c\\(omment\\)?\\>" (1 "<")) + ("^\\(@\\)ignore\\>" (1 "< b")) + ("^@end ignore\\(\n\\)" (1 "> b"))) "Syntactic keywords to catch comment delimiters in `texinfo-mode'.") (defconst texinfo-environments @@ -338,8 +340,7 @@ Subexpression 1 is what goes into the corresponding `@end' statement.") '((t (:inherit font-lock-function-name-face))) "Face used for section headings in `texinfo-mode'." :group 'texinfo) -;; backward-compatibility alias -(put 'texinfo-heading-face 'face-alias 'texinfo-heading) +(define-obsolete-face-alias 'texinfo-heading-face 'texinfo-heading "22.1") (defvar texinfo-heading-face 'texinfo-heading) (defvar texinfo-font-lock-keywords @@ -584,7 +585,7 @@ value of `texinfo-mode-hook'." (setq paragraph-start (concat "\b\\|@[a-zA-Z]*[ \n]\\|" paragraph-start)) (make-local-variable 'sentence-end-base) (setq sentence-end-base - "\\(@\\(end\\)?dots{}\\|[.?!]\\)[]\"'$B!I$,1r}(B)}]*") + "\\(@\\(end\\)?dots{}\\|[.?!]\\)[]\"'”)}]*") (make-local-variable 'adaptive-fill-mode) (setq adaptive-fill-mode nil) (make-local-variable 'fill-column) @@ -600,9 +601,9 @@ value of `texinfo-mode-hook'." (setq imenu-case-fold-search nil) (make-local-variable 'font-lock-defaults) (setq font-lock-defaults - '(texinfo-font-lock-keywords nil nil nil backward-paragraph - (font-lock-syntactic-keywords - . texinfo-font-lock-syntactic-keywords))) + '(texinfo-font-lock-keywords nil nil nil backward-paragraph)) + (set (make-local-variable 'syntax-propertize-function) + texinfo-syntax-propertize-function) (set (make-local-variable 'parse-sexp-lookup-properties) t) ;; Outline settings. @@ -682,7 +683,8 @@ With prefix argument or inside @code or @example, inserts a plain \"." (if (or arg (= (preceding-char) ?\\) (save-excursion - (backward-char (length texinfo-open-quote)) + ;; Might be near the start of a (narrowed) buffer. + (ignore-errors (backward-char (length texinfo-open-quote))) (when (or (looking-at texinfo-open-quote) (looking-at texinfo-close-quote)) (delete-char (length texinfo-open-quote)) @@ -694,7 +696,8 @@ With prefix argument or inside @code or @example, inserts a plain \"." (setq in-env t))))) (self-insert-command (prefix-numeric-value arg)) (insert - (if (memq (char-syntax (preceding-char)) '(?\( ?> ?\s)) + (if (or (bobp) + (memq (char-syntax (preceding-char)) '(?\( ?> ?\s))) texinfo-open-quote texinfo-close-quote)))))