Mercurial > emacs
comparison lisp/allout.el @ 90203:187d6a1f84f7
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-71
Merge from emacs--cvs-trunk--0
Patches applied:
* emacs--cvs-trunk--0 (patch 485-492)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 92-94)
- Merge from emacs--cvs-trunk--0
- Update from CVS
author | Miles Bader <miles@gnu.org> |
---|---|
date | Fri, 22 Jul 2005 08:27:27 +0000 |
parents | fbb2bea03df9 f73da52719b6 |
children | 2d92f5c9d6ae |
comparison
equal
deleted
inserted
replaced
90202:7597b4a23c3b | 90203:187d6a1f84f7 |
---|---|
868 (make-variable-buffer-local 'allout-pre-was-isearching) | 868 (make-variable-buffer-local 'allout-pre-was-isearching) |
869 ;;;_ = allout-isearch-prior-pos nil | 869 ;;;_ = allout-isearch-prior-pos nil |
870 (defvar allout-isearch-prior-pos nil | 870 (defvar allout-isearch-prior-pos nil |
871 "Cue for isearch-dynamic-exposure tracking, used by `allout-isearch-expose'.") | 871 "Cue for isearch-dynamic-exposure tracking, used by `allout-isearch-expose'.") |
872 (make-variable-buffer-local 'allout-isearch-prior-pos) | 872 (make-variable-buffer-local 'allout-isearch-prior-pos) |
873 ;;;_ = allout-isearch-did-quit | |
874 (defvar allout-isearch-did-quit nil | |
875 "Distinguishes isearch conclusion and cancellation. | |
876 | |
877 Maintained by `allout-isearch-abort' \(which is wrapped around the real | |
878 isearch-abort), and monitored by `allout-isearch-expose' for action.") | |
879 (make-variable-buffer-local 'allout-isearch-did-quit) | |
880 ;;;_ = allout-override-protect nil | 873 ;;;_ = allout-override-protect nil |
881 (defvar allout-override-protect nil | 874 (defvar allout-override-protect nil |
882 "Used in `allout-mode' for regulate of concealed-text protection mechanism. | 875 "Used in `allout-mode' for regulate of concealed-text protection mechanism. |
883 | 876 |
884 Allout outline mode regulates alteration of concealed text to protect | 877 Allout outline mode regulates alteration of concealed text to protect |
1152 | 1145 |
1153 Topic text constituents: | 1146 Topic text constituents: |
1154 | 1147 |
1155 HEADER: The first line of a topic, include the topic PREFIX and header | 1148 HEADER: The first line of a topic, include the topic PREFIX and header |
1156 text. | 1149 text. |
1157 PREFIX: The leading text of a topic which which distinguishes it from | 1150 PREFIX: The leading text of a topic which distinguishes it from |
1158 normal text. It has a strict form, which consists of a | 1151 normal text. It has a strict form, which consists of a |
1159 prefix-lead string, padding, and a bullet. The bullet may be | 1152 prefix-lead string, padding, and a bullet. The bullet may be |
1160 followed by a number, indicating the ordinal number of the | 1153 followed by a number, indicating the ordinal number of the |
1161 topic among its siblings, a space, and then the header text. | 1154 topic among its siblings, a space, and then the header text. |
1162 | 1155 |
1341 (allout-setup-menubar) | 1334 (allout-setup-menubar) |
1342 | 1335 |
1343 (if allout-layout | 1336 (if allout-layout |
1344 (setq do-layout t)) | 1337 (setq do-layout t)) |
1345 | 1338 |
1346 (if (and allout-isearch-dynamic-expose | 1339 (if allout-isearch-dynamic-expose |
1347 (not (fboundp 'allout-real-isearch-abort))) | |
1348 (allout-enwrap-isearch)) | 1340 (allout-enwrap-isearch)) |
1349 | 1341 |
1350 (run-hooks 'allout-mode-hook) | 1342 (run-hooks 'allout-mode-hook) |
1351 (setq allout-mode t)) | 1343 (setq allout-mode t)) |
1352 | 1344 |
2224 (if rehide-completely | 2216 (if rehide-completely |
2225 (save-excursion | 2217 (save-excursion |
2226 (if rehide-place (goto-char rehide-place)) | 2218 (if rehide-place (goto-char rehide-place)) |
2227 (allout-hide-current-entry-completely)) | 2219 (allout-hide-current-entry-completely)) |
2228 (allout-hide-current-entry)) | 2220 (allout-hide-current-entry)) |
2229 (error (concat | 2221 (error "Change within concealed region prevented")))))) |
2230 "Change within concealed region prevented."))))))) | |
2231 ) ; if | 2222 ) ; if |
2232 ) ; defun | 2223 ) ; defun |
2233 ;;;_ = allout-post-goto-bullet | 2224 ;;;_ = allout-post-goto-bullet |
2234 (defvar allout-post-goto-bullet nil | 2225 (defvar allout-post-goto-bullet nil |
2235 "Outline internal var, for `allout-pre-command-business' hot-spot operation. | 2226 "Outline internal var, for `allout-pre-command-business' hot-spot operation. |
2323 (if (and (eq this-command 'self-insert-command) | 2314 (if (and (eq this-command 'self-insert-command) |
2324 (eq (point)(allout-current-bullet-pos))) | 2315 (eq (point)(allout-current-bullet-pos))) |
2325 (let* ((this-key-num (cond | 2316 (let* ((this-key-num (cond |
2326 ((numberp last-command-char) | 2317 ((numberp last-command-char) |
2327 last-command-char) | 2318 last-command-char) |
2328 ;; XXX Only XEmacs has characterp. | 2319 ((fboundp 'char-to-int) |
2329 ((and (fboundp 'characterp) | |
2330 (characterp last-command-char)) | |
2331 (char-to-int last-command-char)) | 2320 (char-to-int last-command-char)) |
2332 (t 0))) | 2321 (t 0))) |
2333 mapped-binding) | 2322 mapped-binding) |
2334 (if (zerop this-key-num) | 2323 (if (zerop this-key-num) |
2335 nil | 2324 nil |
2361 (defun allout-isearch-rectification () | 2350 (defun allout-isearch-rectification () |
2362 "Rectify outline exposure before, during, or after isearch. | 2351 "Rectify outline exposure before, during, or after isearch. |
2363 | 2352 |
2364 Called as part of `allout-post-command-business'." | 2353 Called as part of `allout-post-command-business'." |
2365 | 2354 |
2366 (let ((isearching (and (boundp 'isearch-mode) isearch-mode))) | 2355 (let ((isearching isearch-mode)) |
2367 (cond ((and isearching (not allout-pre-was-isearching)) | 2356 (cond ((and isearching (not allout-pre-was-isearching)) |
2368 (allout-isearch-expose 'start)) | 2357 (allout-isearch-expose 'start)) |
2369 ((and isearching allout-pre-was-isearching) | 2358 ((and isearching allout-pre-was-isearching) |
2370 (allout-isearch-expose 'continue)) | 2359 (allout-isearch-expose 'continue)) |
2371 ((and (not isearching) allout-pre-was-isearching) | 2360 ((and (not isearching) allout-pre-was-isearching) |
2372 (allout-isearch-expose 'final)) | 2361 (allout-isearch-expose 'final)) |
2373 ;; Not and wasn't isearching: | 2362 ;; Not and wasn't isearching: |
2374 (t (setq allout-isearch-prior-pos nil) | 2363 (t (setq allout-isearch-prior-pos nil))))) |
2375 (setq allout-isearch-did-quit nil))))) | |
2376 ;;;_ = allout-isearch-was-font-lock | 2364 ;;;_ = allout-isearch-was-font-lock |
2377 (defvar allout-isearch-was-font-lock | 2365 (defvar allout-isearch-was-font-lock |
2378 (and (boundp 'font-lock-mode) font-lock-mode)) | 2366 (and (boundp 'font-lock-mode) font-lock-mode)) |
2379 | 2367 |
2380 ;;;_ > allout-flag-region (from to flag) | 2368 ;;;_ > allout-flag-region (from to flag) |
2412 ?\r))) | 2400 ?\r))) |
2413 (if (allout-visible-p) | 2401 (if (allout-visible-p) |
2414 (setq allout-isearch-prior-pos nil) | 2402 (setq allout-isearch-prior-pos nil) |
2415 (if (not (eq mode 'final)) | 2403 (if (not (eq mode 'final)) |
2416 (setq allout-isearch-prior-pos (cons (point) (allout-show-entry))) | 2404 (setq allout-isearch-prior-pos (cons (point) (allout-show-entry))) |
2417 (if allout-isearch-did-quit | 2405 (if isearch-mode-end-hook-quit |
2418 nil | 2406 nil |
2419 (setq allout-isearch-prior-pos nil) | 2407 (setq allout-isearch-prior-pos nil) |
2420 (allout-show-children)))) | 2408 (allout-show-children))))) |
2421 (setq allout-isearch-did-quit nil)) | |
2422 ;;;_ > allout-enwrap-isearch () | 2409 ;;;_ > allout-enwrap-isearch () |
2423 (defun allout-enwrap-isearch () | 2410 (defun allout-enwrap-isearch () |
2424 "Impose `isearch-abort' wrapper for dynamic exposure in isearch. | 2411 "Impose `isearch-abort' wrapper for dynamic exposure in isearch. |
2425 | 2412 |
2426 The function checks to ensure that the rebinding is done only once." | 2413 The function checks to ensure that the rebinding is done only once." |
2427 | 2414 (add-hook 'isearch-mode-end-hook 'allout-isearch-rectification)) |
2428 (add-hook 'isearch-mode-end-hook 'allout-isearch-rectification) | |
2429 (if (fboundp 'allout-real-isearch-abort) | |
2430 ;; | |
2431 nil | |
2432 ; Ensure load of isearch-mode: | |
2433 (if (or (and (fboundp 'isearch-mode) | |
2434 (fboundp 'isearch-abort)) | |
2435 (condition-case error | |
2436 (load-library "isearch-mode") | |
2437 ('file-error (message | |
2438 "Skipping isearch-mode provisions - %s '%s'" | |
2439 (car (cdr error)) | |
2440 (car (cdr (cdr error)))) | |
2441 (sit-for 1) | |
2442 ;; Inhibit subsequent tries and return nil: | |
2443 (setq allout-isearch-dynamic-expose nil)))) | |
2444 ;; Isearch-mode loaded, encapsulate specific entry points for | |
2445 ;; outline dynamic-exposure business: | |
2446 (progn | |
2447 ;; stash crucial isearch-mode funcs under known, private | |
2448 ;; names, then register wrapper functions under the old | |
2449 ;; names, in their stead: | |
2450 (fset 'allout-real-isearch-abort (symbol-function 'isearch-abort)) | |
2451 (fset 'isearch-abort 'allout-isearch-abort))))) | |
2452 ;;;_ > allout-isearch-abort () | |
2453 (defun allout-isearch-abort () | |
2454 "Wrapper for `allout-real-isearch-abort' \(which see), to register | |
2455 actual quits." | |
2456 (interactive) | |
2457 (setq allout-isearch-did-quit nil) | |
2458 (condition-case what | |
2459 (allout-real-isearch-abort) | |
2460 ('quit (setq allout-isearch-did-quit t) | |
2461 (signal 'quit nil)))) | |
2462 | 2415 |
2463 ;;; Prevent unnecessary font-lock while isearching! | 2416 ;;; Prevent unnecessary font-lock while isearching! |
2464 (defvar isearch-was-font-locking nil) | 2417 (defvar isearch-was-font-locking nil) |
2465 (defun isearch-inhibit-font-lock () | 2418 (defun isearch-inhibit-font-lock () |
2466 "Inhibit `font-lock-mode' while isearching - for use on `isearch-mode-hook'." | 2419 "Inhibit `font-lock-mode' while isearching - for use on `isearch-mode-hook'." |
3470 | 3423 |
3471 \(Works according to setting of `allout-file-xref-bullet')." | 3424 \(Works according to setting of `allout-file-xref-bullet')." |
3472 (interactive) | 3425 (interactive) |
3473 (if (not allout-file-xref-bullet) | 3426 (if (not allout-file-xref-bullet) |
3474 (error | 3427 (error |
3475 "outline cross references disabled - no `allout-file-xref-bullet'") | 3428 "Outline cross references disabled - no `allout-file-xref-bullet'") |
3476 (if (not (string= (allout-current-bullet) allout-file-xref-bullet)) | 3429 (if (not (string= (allout-current-bullet) allout-file-xref-bullet)) |
3477 (error "current heading lacks cross-reference bullet `%s'" | 3430 (error "Current heading lacks cross-reference bullet `%s'" |
3478 allout-file-xref-bullet) | 3431 allout-file-xref-bullet) |
3479 (let (file-name) | 3432 (let (file-name) |
3480 (save-excursion | 3433 (save-excursion |
3481 (let* ((text-start allout-recent-prefix-end) | 3434 (let* ((text-start allout-recent-prefix-end) |
3482 (heading-end (progn (end-of-line) (point)))) | 3435 (heading-end (progn (end-of-line) (point)))) |