Mercurial > emacs
comparison lisp/allout.el @ 54952:5e2b4f7225cb
(allout-mode-exposure-menu, allout-mode-editing-menu):
(allout-mode-navigation-menu, allout-mode-misc-menu): New defvars.
(allout-prior-bindings, allout-added-bindings): Defvars deleted.
(allout-init): Use find-file-hook, not find-file-hooks.
(allout-mode): Eliminate Emacs 18 support.
Use write-contents-functions, not local-write-file-hooks.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 17 Apr 2004 19:53:58 +0000 |
parents | e8824c4f5f7e |
children | 50b099e608af 625059157bad |
comparison
equal
deleted
inserted
replaced
54951:88d561445a39 | 54952:5e2b4f7225cb |
---|---|
81 variable `allout-layout' is non-nil, and whether or not the layout | 81 variable `allout-layout' is non-nil, and whether or not the layout |
82 dictated by `allout-layout' should be imposed on mode activation. | 82 dictated by `allout-layout' should be imposed on mode activation. |
83 | 83 |
84 With value t, auto-mode-activation and auto-layout are enabled. | 84 With value t, auto-mode-activation and auto-layout are enabled. |
85 \(This also depends on `allout-find-file-hook' being installed in | 85 \(This also depends on `allout-find-file-hook' being installed in |
86 `find-file-hooks', which is also done by `allout-init'.) | 86 `find-file-hook', which is also done by `allout-init'.) |
87 | 87 |
88 With value `ask', auto-mode-activation is enabled, and endorsement for | 88 With value `ask', auto-mode-activation is enabled, and endorsement for |
89 performing auto-layout is asked of the user each time. | 89 performing auto-layout is asked of the user each time. |
90 | 90 |
91 With value `activate', only auto-mode-activation is enabled, | 91 With value `activate', only auto-mode-activation is enabled, |
505 | 505 |
506 ;;;_ #1 Internal Outline Formatting and Configuration | 506 ;;;_ #1 Internal Outline Formatting and Configuration |
507 ;;;_ : Version | 507 ;;;_ : Version |
508 ;;;_ = allout-version | 508 ;;;_ = allout-version |
509 (defvar allout-version | 509 (defvar allout-version |
510 (let ((rcs-rev "$Revision: 1.47 $")) | 510 (let ((rcs-rev "$Revision: 1.48 $")) |
511 (condition-case err | 511 (condition-case err |
512 (save-match-data | 512 (save-match-data |
513 (string-match "Revision: \\([0-9]+\\.[0-9]+\\)" rcs-rev) | 513 (string-match "Revision: \\([0-9]+\\.[0-9]+\\)" rcs-rev) |
514 (substring rcs-rev (match-beginning 1) (match-end 1))) | 514 (substring rcs-rev (match-beginning 1) (match-end 1))) |
515 ('error rcs-rev))) | 515 ('error rcs-rev))) |
724 (append pref key-suff) | 724 (append pref key-suff) |
725 key-suff)) | 725 key-suff)) |
726 (car (cdr cell))))))) | 726 (car (cdr cell))))))) |
727 keymap-list) | 727 keymap-list) |
728 map)) | 728 map)) |
729 ;;;_ = allout-prior-bindings - being deprecated. | 729 |
730 (defvar allout-prior-bindings nil | |
731 "Variable for use in V18, with `allout-added-bindings', for | |
732 resurrecting, on mode deactivation, bindings that existed before | |
733 activation. Being deprecated.") | |
734 ;;;_ = allout-added-bindings - being deprecated | |
735 (defvar allout-added-bindings nil | |
736 "Variable for use in V18, with `allout-prior-bindings', for | |
737 resurrecting, on mode deactivation, bindings that existed before | |
738 activation. Being deprecated.") | |
739 ;;;_ : Menu bar | 730 ;;;_ : Menu bar |
731 (defvar allout-mode-exposure-menu) | |
732 (defvar allout-mode-editing-menu) | |
733 (defvar allout-mode-navigation-menu) | |
734 (defvar allout-mode-misc-menu) | |
740 (defun produce-allout-mode-menubar-entries () | 735 (defun produce-allout-mode-menubar-entries () |
741 (require 'easymenu) | 736 (require 'easymenu) |
742 (easy-menu-define allout-mode-exposure-menu | 737 (easy-menu-define allout-mode-exposure-menu |
743 allout-mode-map | 738 allout-mode-map |
744 "Allout outline exposure menu." | 739 "Allout outline exposure menu." |
907 "Horrible hack used to prevent invalid multiple triggering of outline | 902 "Horrible hack used to prevent invalid multiple triggering of outline |
908 mode from prop-line file-var activation. Used by `allout-mode' function | 903 mode from prop-line file-var activation. Used by `allout-mode' function |
909 to track repeats.") | 904 to track repeats.") |
910 ;;;_ > allout-write-file-hook () | 905 ;;;_ > allout-write-file-hook () |
911 (defun allout-write-file-hook () | 906 (defun allout-write-file-hook () |
912 "In `allout-mode', run as a `local-write-file-hooks' activity. | 907 "In `allout-mode', run as a `write-contents-functions' activity. |
913 | 908 |
914 Currently just sets `allout-during-write-cue', so outline change-protection | 909 Currently just sets `allout-during-write-cue', so outline change-protection |
915 knows to keep inactive during file write." | 910 knows to keep inactive during file write." |
916 (setq allout-during-write-cue t) | 911 (setq allout-during-write-cue t) |
917 nil) | 912 nil) |
948 of allout outline mode, contingent to the buffer-specific setting of | 943 of allout outline mode, contingent to the buffer-specific setting of |
949 the `allout-layout' variable. (See `allout-layout' and | 944 the `allout-layout' variable. (See `allout-layout' and |
950 `allout-expose-topic' docstrings for more details on auto layout). | 945 `allout-expose-topic' docstrings for more details on auto layout). |
951 | 946 |
952 `allout-init' works by setting up (or removing) | 947 `allout-init' works by setting up (or removing) |
953 `allout-find-file-hook' in `find-file-hooks', and giving | 948 `allout-find-file-hook' in `find-file-hook', and giving |
954 `allout-auto-activation' a suitable setting. | 949 `allout-auto-activation' a suitable setting. |
955 | 950 |
956 To prime your emacs session for full auto-outline operation, include | 951 To prime your emacs session for full auto-outline operation, include |
957 the following two lines in your emacs init file: | 952 the following two lines in your emacs init file: |
958 | 953 |
977 ;; convenience aliases, for consistent ref to respective vars: | 972 ;; convenience aliases, for consistent ref to respective vars: |
978 ((hook 'allout-find-file-hook) | 973 ((hook 'allout-find-file-hook) |
979 (curr-mode 'allout-auto-activation)) | 974 (curr-mode 'allout-auto-activation)) |
980 | 975 |
981 (cond ((not mode) | 976 (cond ((not mode) |
982 (setq find-file-hooks (delq hook find-file-hooks)) | 977 (setq find-file-hook (delq hook find-file-hook)) |
983 (if (interactive-p) | 978 (if (interactive-p) |
984 (message "Allout outline mode auto-activation inhibited."))) | 979 (message "Allout outline mode auto-activation inhibited."))) |
985 ((eq mode 'report) | 980 ((eq mode 'report) |
986 (if (memq hook find-file-hooks) | 981 (if (memq hook find-file-hook) |
987 ;; Just punt and use the reports from each of the modes: | 982 ;; Just punt and use the reports from each of the modes: |
988 (allout-init (symbol-value curr-mode)) | 983 (allout-init (symbol-value curr-mode)) |
989 (allout-init nil) | 984 (allout-init nil) |
990 (message "Allout outline mode auto-activation inhibited."))) | 985 (message "Allout outline mode auto-activation inhibited."))) |
991 (t (add-hook 'find-file-hooks hook) | 986 (t (add-hook 'find-file-hook hook) |
992 (set curr-mode ; `set', not `setq'! | 987 (set curr-mode ; `set', not `setq'! |
993 (cond ((eq mode 'activate) | 988 (cond ((eq mode 'activate) |
994 (message | 989 (message |
995 "Outline mode auto-activation enabled.") | 990 "Outline mode auto-activation enabled.") |
996 'activate) | 991 'activate) |
1250 ; Activation not explicitly | 1245 ; Activation not explicitly |
1251 ; requested, and either in | 1246 ; requested, and either in |
1252 ; active state or *de*activation | 1247 ; active state or *de*activation |
1253 ; specifically requested: | 1248 ; specifically requested: |
1254 (setq allout-explicitly-deactivated t) | 1249 (setq allout-explicitly-deactivated t) |
1255 (if (string-match "^18\." emacs-version) | |
1256 ; Revoke those keys that remain | |
1257 ; as we set them: | |
1258 (let ((curr-loc (current-local-map))) | |
1259 (mapcar (function | |
1260 (lambda (cell) | |
1261 (if (eq (lookup-key curr-loc (car cell)) | |
1262 (car (cdr cell))) | |
1263 (define-key curr-loc (car cell) | |
1264 (assq (car cell) allout-prior-bindings))))) | |
1265 allout-added-bindings) | |
1266 (allout-resumptions 'allout-added-bindings) | |
1267 (allout-resumptions 'allout-prior-bindings))) | |
1268 | 1250 |
1269 (if allout-old-style-prefixes | 1251 (if allout-old-style-prefixes |
1270 (progn | 1252 (progn |
1271 (allout-resumptions 'allout-primary-bullet) | 1253 (allout-resumptions 'allout-primary-bullet) |
1272 (allout-resumptions 'allout-old-style-prefixes))) | 1254 (allout-resumptions 'allout-old-style-prefixes))) |
1273 (allout-resumptions 'selective-display) | 1255 (allout-resumptions 'selective-display) |
1274 (if (and (boundp 'before-change-functions) before-change-functions) | 1256 (if (and (boundp 'before-change-functions) before-change-functions) |
1275 (allout-resumptions 'before-change-functions)) | 1257 (allout-resumptions 'before-change-functions)) |
1276 (setq local-write-file-hooks | 1258 (setq write-contents-functions |
1277 (delq 'allout-write-file-hook | 1259 (delq 'allout-write-file-hook |
1278 local-write-file-hooks)) | 1260 write-contents-functions)) |
1279 (allout-resumptions 'paragraph-start) | 1261 (allout-resumptions 'paragraph-start) |
1280 (allout-resumptions 'paragraph-separate) | 1262 (allout-resumptions 'paragraph-separate) |
1281 (allout-resumptions (if (string-match "^18" emacs-version) | 1263 (allout-resumptions (if (string-match "^18" emacs-version) |
1282 'auto-fill-hook | 1264 'auto-fill-hook |
1283 'auto-fill-function)) | 1265 'auto-fill-function)) |
1313 minor-mode-map-alist)) | 1295 minor-mode-map-alist)) |
1314 (setq minor-mode-map-alist | 1296 (setq minor-mode-map-alist |
1315 (cons '(allout-mode . allout-mode-map) | 1297 (cons '(allout-mode . allout-mode-map) |
1316 minor-mode-map-alist)))) | 1298 minor-mode-map-alist)))) |
1317 | 1299 |
1318 ; V18 minor-mode key bindings: | |
1319 ; Stash record of added bindings | |
1320 ; for later revocation: | |
1321 (allout-resumptions 'allout-added-bindings | |
1322 (list allout-keybindings-list)) | |
1323 (allout-resumptions 'allout-prior-bindings | |
1324 (list (current-local-map))) | |
1325 ; and add them: | 1300 ; and add them: |
1326 (use-local-map (produce-allout-mode-map allout-keybindings-list | 1301 (use-local-map (produce-allout-mode-map allout-keybindings-list |
1327 (current-local-map))) | 1302 (current-local-map))) |
1328 ) | 1303 ) |
1329 | 1304 |
1338 (add-hook 'pre-command-hook 'allout-pre-command-business) | 1313 (add-hook 'pre-command-hook 'allout-pre-command-business) |
1339 (add-hook 'post-command-hook 'allout-post-command-business) | 1314 (add-hook 'post-command-hook 'allout-post-command-business) |
1340 ; Temporarily set by any outline | 1315 ; Temporarily set by any outline |
1341 ; functions that can be trusted to | 1316 ; functions that can be trusted to |
1342 ; deal properly with concealed text. | 1317 ; deal properly with concealed text. |
1343 (add-hook 'local-write-file-hooks 'allout-write-file-hook) | 1318 (add-hook 'write-contents-functions 'allout-write-file-hook) |
1344 ; Custom auto-fill func, to support | 1319 ; Custom auto-fill func, to support |
1345 ; respect for topic headline, | 1320 ; respect for topic headline, |
1346 ; hanging-indents, etc: | 1321 ; hanging-indents, etc: |
1347 (let* ((fill-func-var (if (string-match "^18" emacs-version) | 1322 (let* ((fill-func-var (if (string-match "^18" emacs-version) |
1348 'auto-fill-hook | 1323 'auto-fill-hook |