Mercurial > emacs
comparison lisp/textmodes/page-ext.el @ 49701:77c73732b535
(pages-directory-mode-map): New.
(pages-directory-map): Redefine as an varalias.
(pages-directory-mode): Use new map var and run mode hook.
(pages-directory-address-mode): Use define-derived-mode.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Tue, 11 Feb 2003 00:44:08 +0000 |
parents | 5ade352e8d1c |
children | 695cf19ef79e d7ddb3e565de |
comparison
equal
deleted
inserted
replaced
49700:176bfa5ffebf | 49701:77c73732b535 |
---|---|
473 (defvar pages-pos-list nil | 473 (defvar pages-pos-list nil |
474 "List containing the positions of the pages in the pages-buffer.") | 474 "List containing the positions of the pages in the pages-buffer.") |
475 | 475 |
476 (defvar pages-target-buffer) | 476 (defvar pages-target-buffer) |
477 | 477 |
478 (defvar pages-directory-map nil | 478 (defvar pages-directory-mode-map |
479 (let ((map (make-sparse-keymap))) | |
480 (define-key map "\C-c\C-c" 'pages-directory-goto) | |
481 (define-key map "\C-c\C-p\C-a" 'add-new-page) | |
482 (define-key map [mouse-2] 'pages-directory-goto-with-mouse) | |
483 map) | |
479 "Keymap for the pages-directory-buffer.") | 484 "Keymap for the pages-directory-buffer.") |
480 | 485 (defvaralias 'pages-directory-map 'pages-directory-mode-map) |
481 (if pages-directory-map | |
482 () | |
483 (setq pages-directory-map (make-sparse-keymap)) | |
484 (define-key pages-directory-map "\C-c\C-c" | |
485 'pages-directory-goto) | |
486 (define-key pages-directory-map "\C-c\C-p\C-a" 'add-new-page) | |
487 (define-key pages-directory-map [mouse-2] 'pages-directory-goto-with-mouse)) | |
488 | 486 |
489 (defvar original-page-delimiter "^\f" | 487 (defvar original-page-delimiter "^\f" |
490 "Default page delimiter.") | 488 "Default page delimiter.") |
491 | 489 |
492 (defun set-page-delimiter (regexp reset-p) | 490 (defun set-page-delimiter (regexp reset-p) |
701 | 699 |
702 Move point to one of the lines in this buffer, then use \\[pages-directory-goto] to go | 700 Move point to one of the lines in this buffer, then use \\[pages-directory-goto] to go |
703 to the same line in the pages buffer." | 701 to the same line in the pages buffer." |
704 | 702 |
705 (kill-all-local-variables) | 703 (kill-all-local-variables) |
706 (use-local-map pages-directory-map) | 704 (use-local-map pages-directory-mode-map) |
707 (setq major-mode 'pages-directory-mode) | 705 (setq major-mode 'pages-directory-mode) |
708 (setq mode-name "Pages-Directory") | 706 (setq mode-name "Pages-Directory") |
709 (make-local-variable 'pages-buffer) | 707 (make-local-variable 'pages-buffer) |
710 (make-local-variable 'pages-pos-list) | 708 (make-local-variable 'pages-pos-list) |
711 (make-local-variable 'pages-directory-buffer-narrowing-p)) | 709 (make-local-variable 'pages-directory-buffer-narrowing-p) |
710 (run-mode-hooks 'pages-directory-mode-hook)) | |
712 | 711 |
713 (defun pages-directory-goto () | 712 (defun pages-directory-goto () |
714 "Go to the corresponding line in the pages buffer." | 713 "Go to the corresponding line in the pages buffer." |
715 | 714 |
716 ;;; This function is mostly a copy of `occur-mode-goto-occurrence' | 715 ;;; This function is mostly a copy of `occur-mode-goto-occurrence' |
789 "=== Address List Directory: use `C-c C-c' to go to page under cursor. ===") | 788 "=== Address List Directory: use `C-c C-c' to go to page under cursor. ===") |
790 (set-buffer-modified-p nil) | 789 (set-buffer-modified-p nil) |
791 )) | 790 )) |
792 (error "No addresses file found!"))) | 791 (error "No addresses file found!"))) |
793 | 792 |
794 (defun pages-directory-address-mode () | 793 (define-derived-mode pages-directory-address-mode pages-directory-mode |
794 "Addresses Directory" | |
795 "Mode for handling the Addresses Directory buffer. | 795 "Mode for handling the Addresses Directory buffer. |
796 | 796 |
797 Move point to one of the lines in this buffer, | 797 Move point to one of the lines in this buffer, |
798 then use \\[pages-directory-goto] to go | 798 then use \\[pages-directory-goto] to go |
799 to the same line in the pages buffer." | 799 to the same line in the pages buffer." |
800 | 800 :syntax-table nil) |
801 (use-local-map pages-directory-map) | 801 |
802 (setq major-mode 'pages-directory-address-mode) | |
803 (setq mode-name "Addresses Directory") | |
804 (make-local-variable 'pages-buffer) | |
805 (make-local-variable 'pages-pos-list) | |
806 (make-local-variable 'pages-directory-buffer-narrowing-p)) | |
807 | |
808 | |
809 ;;; Place `provide' at end of file. | |
810 (provide 'page-ext) | 802 (provide 'page-ext) |
811 | |
812 ;;; page-ext.el ends here | 803 ;;; page-ext.el ends here |