Mercurial > emacs
changeset 34299:af304d85166f
Require tex-mode when compiling.
(texinfo-update-node): Doc fix.
(texinfo-imenu-generic-expression): Add @anchor.
(texinfo-font-lock-keywords): Add @uref.
(texinfo-inside-macro-p): Don't use ignore-errors.
(texinfo-insert-quote): Match more contexts.
author | Dave Love <fx@gnu.org> |
---|---|
date | Wed, 06 Dec 2000 19:34:15 +0000 |
parents | 023226d79a05 |
children | c7610b751e49 |
files | lisp/textmodes/texinfo.el |
diffstat | 1 files changed, 33 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/textmodes/texinfo.el Wed Dec 06 18:48:59 2000 +0000 +++ b/lisp/textmodes/texinfo.el Wed Dec 06 19:34:15 2000 +0000 @@ -1,6 +1,7 @@ ;;; texinfo.el --- major mode for editing Texinfo files -;; Copyright (C) 1985-2000 Free Software Foundation, Inc. +;; Copyright (C) 1985, '88, '89, '90, '91, +;; '92, '93, '96, '97, 2000 Free Software Foundation, Inc. ;; Author: Robert J. Chassell ;; Date: [See date below for texinfo-version] @@ -33,6 +34,8 @@ (defmacro defcustom (var value doc &rest ignore) `(defvar ,var ,value ,doc))) +(eval-when-compile (require 'tex-mode)) + (defgroup texinfo nil "Texinfo Mode" :group 'docs) @@ -90,15 +93,15 @@ The functions for creating or updating nodes and menus, and their keybindings, are: - texinfo-update-node (&optional region-p) \\[texinfo-update-node] - texinfo-every-node-update () \\[texinfo-every-node-update] - texinfo-sequential-node-update (&optional region-p) + `texinfo-update-node' (&optional region-p) \\[texinfo-update-node] + `texinfo-every-node-update' () \\[texinfo-every-node-update] + `texinfo-sequential-node-update' (&optional region-p) - texinfo-make-menu (&optional region-p) \\[texinfo-make-menu] - texinfo-all-menus-update () \\[texinfo-all-menus-update] - texinfo-master-menu () + `texinfo-make-menu' (&optional region-p) \\[texinfo-make-menu] + `texinfo-all-menus-update' () \\[texinfo-all-menus-update] + `texinfo-master-menu' () - texinfo-indent-menu-description (column &optional region-p) + `texinfo-indent-menu-description' (column &optional region-p) The `texinfo-column-for-description' variable specifies the column to which menu descriptions are indented. Its default value is 32." @@ -298,7 +301,7 @@ ;; To override this example, set either `imenu-generic-expression' ;; or `imenu-create-index-function'. (defvar texinfo-imenu-generic-expression - '((nil "^@node[ \t]+\\([^,\n]*\\)" 1) + '((nil "^@\\(node\\|anchor\\)[ \t]+\\([^,\n]*\\)" 2) ("Chapters" "^@chapter[ \t]+\\(.*\\)$" 1)) "Imenu generic expression for TexInfo mode. See `imenu-generic-expression'.") @@ -321,13 +324,13 @@ ("@\\([a-zA-Z]+\\|[^ \t\n]\\)" 1 font-lock-keyword-face) ;commands ("^\\*\\(.*\\)[\t ]*$" 1 font-lock-function-name-face t) ;menu items ("@\\(emph\\|strong\\|b\\|i\\|sc\\){\\([^}]+\\)" 2 font-lock-comment-face) - ("@\\(file\\|kbd\\|key\\|url\\|email\\){\\([^}]+\\)" 2 font-lock-string-face) + ("@\\(file\\|kbd\\|key\\|url\\|uref\\|email\\){\\([^}]+\\)" 2 font-lock-string-face) ("@\\(samp\\|code\\|var\\|math\\|env\\|command\\|option\\){\\([^}]+\\)" 2 font-lock-variable-name-face) ("@\\(cite\\|[ux]?ref\\|pxref\\){\\([^}]+\\)" 2 font-lock-constant-face) ("@\\(end\\|itemx?\\) +\\(.+\\)" 2 font-lock-function-name-face keep) (,(concat "^@" (regexp-opt (mapcar 'car texinfo-section-list) t) - ".*\n") 0 texinfo-heading-face t)) + ".*\n") 0 texinfo-heading-face t)) "Additional expressions to highlight in TeXinfo mode.") (defun texinfo-outline-level () @@ -650,17 +653,19 @@ (defun texinfo-inside-macro-p (macro &optional bound) "Non-nil if inside a macro matching the regexp MACRO." - (ignore-errors - (save-excursion - (save-restriction - (narrow-to-region bound (point)) - (while (progn - (up-list -1) - (not (ignore-errors - (save-excursion - (backward-sexp 1) - (looking-at macro)))))) - t)))) + (condition-case nil + (save-excursion + (save-restriction + (narrow-to-region bound (point)) + (while (progn + (up-list -1) + (not (condition-case nil + (save-excursion + (backward-sexp 1) + (looking-at macro)) + (error nil))))) + t)) + (error nil))) (defun texinfo-inside-env-p (env &optional bound) "Non-nil if inside an environment matching the regexp @ENV." @@ -678,7 +683,11 @@ (point-min)))) (if (or arg (texinfo-inside-env-p "example\\>" top) - (texinfo-inside-macro-p "@code\\>" top)) + (texinfo-inside-env-p "lisp\\>" top) + (texinfo-inside-macro-p "@code\\>" top) + (texinfo-inside-macro-p "@samp\\>" top) + (texinfo-inside-macro-p "@kbd\\>" top) + (texinfo-inside-macro-p "@kbd\\>" top)) (self-insert-command (prefix-numeric-value arg)) (insert (cond ((= (preceding-char) ?\\) ?\") @@ -840,7 +849,7 @@ (texinfo-insert-@-with-arg "var" arg)) (defun texinfo-insert-@uref (&optional arg) - "Insert a `@url{}' command in a Texinfo buffer. + "Insert a `@uref{}' command in a Texinfo buffer. A numeric argument says how many words the braces should surround. The default is not to surround any existing words with the braces." (interactive "P")