aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog29
-rw-r--r--lisp/textmodes/texinfo.el145
2 files changed, 112 insertions, 62 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ef216574bfc..94c39233232 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,32 @@
12000-04-17 Stefan Monnier <monnier@cs.yale.edu>
2
3 * textmodes/texinfo.el (texinfo-mode-syntax-table): Add \n as comment-end.
4 (texinfo-font-lock-syntactic-keywords): New var.
5 (texinfo-font-lock-keywords): Remove comment regexp.
6 (texinfo-insert-block): New function.
7 (texinfo-mode-map): Add C-c C-o -> texinfo-insert-block.
8 (texinfo-mode): Use define-derived-mode.
9 Tweak comment-start-skip and font-lock-defaults.
10 Use regexp-opt for outline-regexp.
11 (texinfo-environments): New var.
12 (texinfo-environment-regexp): Use regexp-opt and texinfo-environments.
13
14 * textmodes/ispell.el (ispell-menu-map-needed): Check that ispell-process
15 is bound since this might be eval'd before ispell is loaded.
16 (ispell-message): Use a tiny bit less magic and a bit more hard data
17 to figure out what kind of sc-cite-regexp to use.
18
19 * emacs-lisp/regexp-opt.el (regexp-opt-depth): Fix the regexp.
20
21 * calendar/diary-lib.el (fancy-diary-display, mark-diary-entries)
22 (insert-cyclic-diary-entry): Unquote the lambda.
23
24 * gud.el (gud-jdb-build-source-files-list): Fix typo.
25
26 * files.el (backup-enable-predicate): Unquote the lambda.
27
28 * cus-edit.el (custom-face, face): Unquote the lambda.
29
12000-04-15 Vinicius Jose Latorre <vinicius@cpqd.com.br> 302000-04-15 Vinicius Jose Latorre <vinicius@cpqd.com.br>
2 31
3 * ps-print.el: Check for line-beginning-position definition. 32 * ps-print.el: Check for line-beginning-position definition.
diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el
index e4c53619c75..bf1a523ec0e 100644
--- a/lisp/textmodes/texinfo.el
+++ b/lisp/textmodes/texinfo.el
@@ -258,6 +258,7 @@ chapter."
258 (modify-syntax-entry ?\] ")[" texinfo-mode-syntax-table) 258 (modify-syntax-entry ?\] ")[" texinfo-mode-syntax-table)
259 (modify-syntax-entry ?{ "(}" texinfo-mode-syntax-table) 259 (modify-syntax-entry ?{ "(}" texinfo-mode-syntax-table)
260 (modify-syntax-entry ?} "){" texinfo-mode-syntax-table) 260 (modify-syntax-entry ?} "){" texinfo-mode-syntax-table)
261 (modify-syntax-entry ?\n ">" texinfo-mode-syntax-table)
261 (modify-syntax-entry ?\' "w" texinfo-mode-syntax-table)) 262 (modify-syntax-entry ?\' "w" texinfo-mode-syntax-table))
262 263
263;; Written by Wolfgang Bangerth <zcg51122@rpool1.rus.uni-stuttgart.de> 264;; Written by Wolfgang Bangerth <zcg51122@rpool1.rus.uni-stuttgart.de>
@@ -269,10 +270,13 @@ chapter."
269 270
270 "Imenu generic expression for TexInfo mode. See `imenu-generic-expression'.") 271 "Imenu generic expression for TexInfo mode. See `imenu-generic-expression'.")
271 272
273(defvar texinfo-font-lock-syntactic-keywords
274 '(("\\(@\\)c\\(omment\\)?\\>" (1 '(11))))
275 "Syntactic keywords to catch comment delimiters in `texinfo-mode'.")
276
272(defvar texinfo-font-lock-keywords 277(defvar texinfo-font-lock-keywords
273 '(;; All but the first 2 had an OVERRIDE of t. 278 '(;; All but the first had an OVERRIDE of t.
274 ;; It didn't seem to be any better, and it's slower--simon. 279 ;; It didn't seem to be any better, and it's slower--simon.
275 ("^\\(@c\\|@comment\\)\\>.*" . font-lock-comment-face) ;comments
276 ;; Robert J. Chassell <bob@gnu.org> says remove this line. 280 ;; Robert J. Chassell <bob@gnu.org> says remove this line.
277 ;;("\\$\\([^$]*\\)\\$" 1 font-lock-string-face t) 281 ;;("\\$\\([^$]*\\)\\$" 1 font-lock-string-face t)
278 ("@\\([a-zA-Z]+\\|[^ \t\n]\\)" 1 font-lock-keyword-face) ;commands 282 ("@\\([a-zA-Z]+\\|[^ \t\n]\\)" 1 font-lock-keyword-face) ;commands
@@ -350,6 +354,10 @@ chapter."
350 ;; bindings for `texnfo-tex.el' 354 ;; bindings for `texnfo-tex.el'
351 (texinfo-define-common-keys texinfo-mode-map) 355 (texinfo-define-common-keys texinfo-mode-map)
352 356
357 ;; Bindings from `tex-mode.el'
358 ;; This should still use " when inside @example and @code
359 ;;(define-key texinfo-mode-map "\"" 'tex-insert-quote)
360
353 ;; bindings for `makeinfo.el' 361 ;; bindings for `makeinfo.el'
354 (define-key texinfo-mode-map "\C-c\C-m\C-k" 'kill-compilation) 362 (define-key texinfo-mode-map "\C-c\C-m\C-k" 'kill-compilation)
355 (define-key texinfo-mode-map "\C-c\C-m\C-l" 363 (define-key texinfo-mode-map "\C-c\C-m\C-l"
@@ -377,7 +385,7 @@ chapter."
377 (define-key texinfo-mode-map "\C-c{" 'texinfo-insert-braces) 385 (define-key texinfo-mode-map "\C-c{" 'texinfo-insert-braces)
378 386
379 ;; bindings for inserting strings 387 ;; bindings for inserting strings
380 388 (define-key texinfo-mode-map "\C-c\C-o" 'texinfo-insert-block)
381 (define-key texinfo-mode-map "\C-c\C-c\C-d" 'texinfo-start-menu-description) 389 (define-key texinfo-mode-map "\C-c\C-c\C-d" 'texinfo-start-menu-description)
382 390
383 (define-key texinfo-mode-map "\C-c\C-cv" 'texinfo-insert-@var) 391 (define-key texinfo-mode-map "\C-c\C-cv" 'texinfo-insert-@var)
@@ -396,13 +404,15 @@ chapter."
396 404
397;;; Texinfo mode 405;;; Texinfo mode
398 406
407;; Also defined in texnfo-upd.el but copied here to avoid having
408;; to require texnfo-upd.el.
399(defvar texinfo-chapter-level-regexp 409(defvar texinfo-chapter-level-regexp
400 "chapter\\|unnumbered \\|appendix \\|majorheading\\|chapheading" 410 "chapter\\|unnumbered \\|appendix \\|majorheading\\|chapheading"
401 "Regular expression matching Texinfo chapter-level headings. 411 "Regular expression matching Texinfo chapter-level headings.
402This does not match `@node' and does not match the `@top' command.") 412This does not match `@node' and does not match the `@top' command.")
403 413
404;;;###autoload 414;;;###autoload
405(defun texinfo-mode () 415(define-derived-mode texinfo-mode text-mode "Texinfo"
406 "Major mode for editing Texinfo files. 416 "Major mode for editing Texinfo files.
407 417
408 It has these extra commands: 418 It has these extra commands:
@@ -466,14 +476,8 @@ Top node, is accompanied by some kind of section line, such as an
466If the file has a `top' node, it must be called `top' or `Top' and 476If the file has a `top' node, it must be called `top' or `Top' and
467be the first node in the file. 477be the first node in the file.
468 478
469Entering Texinfo mode calls the value of text-mode-hook, and then the 479Entering Texinfo mode calls the value of `text-mode-hook', and then the
470value of texinfo-mode-hook." 480value of `texinfo-mode-hook'."
471 (interactive)
472 (text-mode)
473 (setq mode-name "Texinfo")
474 (setq major-mode 'texinfo-mode)
475 (use-local-map texinfo-mode-map)
476 (set-syntax-table texinfo-mode-syntax-table)
477 (make-local-variable 'page-delimiter) 481 (make-local-variable 'page-delimiter)
478 (setq page-delimiter 482 (setq page-delimiter
479 (concat 483 (concat
@@ -496,19 +500,21 @@ value of texinfo-mode-hook."
496 (make-local-variable 'comment-start) 500 (make-local-variable 'comment-start)
497 (setq comment-start "@c ") 501 (setq comment-start "@c ")
498 (make-local-variable 'comment-start-skip) 502 (make-local-variable 'comment-start-skip)
499 (setq comment-start-skip "@c +") 503 (setq comment-start-skip "@c +\\|@comment +")
500 (make-local-variable 'words-include-escapes) 504 (make-local-variable 'words-include-escapes)
501 (setq words-include-escapes t) 505 (setq words-include-escapes t)
502 (make-local-variable 'imenu-generic-expression) 506 (make-local-variable 'imenu-generic-expression)
503 (setq imenu-generic-expression texinfo-imenu-generic-expression) 507 (setq imenu-generic-expression texinfo-imenu-generic-expression)
504 (setq imenu-case-fold-search nil) 508 (setq imenu-case-fold-search nil)
505 (make-local-variable 'font-lock-defaults) 509 (make-local-variable 'font-lock-defaults)
506 (setq font-lock-defaults '(texinfo-font-lock-keywords t)) 510 (setq font-lock-defaults
511 '(texinfo-font-lock-keywords nil nil nil nil
512 (font-lock-syntactic-keywords
513 . texinfo-font-lock-syntactic-keywords)))
514 (set (make-local-variable 'parse-sexp-lookup-properties) t)
507 (make-local-variable 'outline-regexp) 515 (make-local-variable 'outline-regexp)
508 (setq outline-regexp 516 (setq outline-regexp
509 (concat "@\\(" 517 (concat "@" (regexp-opt (mapcar 'car texinfo-section-list) t) "\\>"))
510 (mapconcat 'car texinfo-section-list "\\>\\|")
511 "\\>\\)"))
512 (make-local-variable 'outline-level) 518 (make-local-variable 'outline-level)
513 (setq outline-level 'texinfo-outline-level) 519 (setq outline-level 'texinfo-outline-level)
514 (make-local-variable 'tex-start-of-header) 520 (make-local-variable 'tex-start-of-header)
@@ -518,59 +524,74 @@ value of texinfo-mode-hook."
518 (make-local-variable 'tex-first-line-header-regexp) 524 (make-local-variable 'tex-first-line-header-regexp)
519 (setq tex-first-line-header-regexp "^\\\\input") 525 (setq tex-first-line-header-regexp "^\\\\input")
520 (make-local-variable 'tex-trailer) 526 (make-local-variable 'tex-trailer)
521 (setq tex-trailer "@bye\n") 527 (setq tex-trailer "@bye\n"))
522 (run-hooks 'text-mode-hook 'texinfo-mode-hook))
523 528
524 529
525;;; Insert string commands 530;;; Insert string commands
526 531
527;; Keep as concatinated lists for ease of maintenance 532(defconst texinfo-environments
533 '("cartouche"
534 "defcv"
535 "deffn"
536 "defivar"
537 "defmac"
538 "defmethod"
539 "defop"
540 "defopt"
541 "defspec"
542 "deftp"
543 "deftypefn"
544 "deftypefun"
545 "deftypevar"
546 "deftypevr"
547 "defun"
548 "defvar"
549 "defvr"
550 "description"
551 "display"
552 "enumerate"
553 "example"
554 "flushleft"
555 "flushright"
556 "format"
557 "ftable"
558 "group"
559 "ifclear"
560 "ifset"
561 "ifhtml"
562 "ifinfo"
563 "ifnothtml"
564 "ifnotinfo"
565 "ifnottex"
566 "iftex"
567 "ignore"
568 "itemize"
569 "lisp"
570 "macro"
571 "multitable"
572 "quotation"
573 "smalldisplay"
574 "smallexample"
575 "smallformat"
576 "smalllisp"
577 "table"
578 "tex"
579 "titlepage"
580 "vtable")
581 "List of TeXinfo environments.")
582
583;; Keep as concatenated lists for ease of maintenance
528(defconst texinfo-environment-regexp 584(defconst texinfo-environment-regexp
529 (concat 585 (concat "^@" (regexp-opt (cons "end" texinfo-environments) t) "\\>")
530 "^@\\("
531 (mapconcat 'identity
532 '("cartouche"
533 "display"
534 "end"
535 "enumerate"
536 "example"
537 "deffn"
538 "defun"
539 "defmac"
540 "defspec"
541 "defva?r"
542 "defopt"
543 "deftypefu?n"
544 "deftypeva?r"
545 "defcv"
546 "defivar"
547 "defop"
548 "defmethod"
549 "deftp"
550 "f?table"
551 "flushleft"
552 "flushright"
553 "format"
554 "group"
555 "ifhtml"
556 "ifinfo"
557 "iftex"
558 "ignore"
559 "itemize"
560 "lisp"
561 "macro"
562 "multitable"
563 "quotation"
564 "smalldisplay"
565 "smallexample"
566 "smallformat"
567 "smalllisp"
568 "tex")
569 "\\|")
570 "\\)")
571 "Regexp for environment-like TexInfo list commands. 586 "Regexp for environment-like TexInfo list commands.
572 Subexpression 1 is what goes into the corresponding `@end' statement.") 587 Subexpression 1 is what goes into the corresponding `@end' statement.")
573 588
589(define-skeleton texinfo-insert-block
590 "Create a matching pair @<cmd> .. @end <cmd> at point.
591Puts point on a blank line between them."
592 (completing-read "Block name: " (mapcar 'list texinfo-environments))
593 "@" str \n _ \n "@end " str \n)
594
574;; The following texinfo-insert-@end command not only inserts a SPC 595;; The following texinfo-insert-@end command not only inserts a SPC
575;; after the @end, but tries to find out what belongs there. It is 596;; after the @end, but tries to find out what belongs there. It is
576;; not very smart: it does not understand nested lists. 597;; not very smart: it does not understand nested lists.