Mercurial > emacs
comparison lisp/allout.el @ 70673:798fa39b6207
2006-05-16 Ken Manheimer <ken.manheimer@gmail.com>
* allout.el (allout-show-bodies, allout-old-style-prefixes)
(allout-stylish-prefixes, allout-numbered-bullet)
(allout-file-xref-bullet, allout-use-hanging-indents): Use simple
predicates to qualify `safe-local-variable' property, when
available, else use equivalent lambda.
(allout-current-topic-collapsed-p): Do the right thing regarding
trailing blank lines.
author | Reiner Steib <Reiner.Steib@gmx.de> |
---|---|
date | Tue, 16 May 2006 10:01:32 +0000 |
parents | b69cce4ff5a0 |
children | 22433275348d b6689e223e2f a5812696f7bf |
comparison
equal
deleted
inserted
replaced
70672:06de67179ba1 | 70673:798fa39b6207 |
---|---|
197 :type 'boolean | 197 :type 'boolean |
198 :group 'allout) | 198 :group 'allout) |
199 (make-variable-buffer-local 'allout-show-bodies) | 199 (make-variable-buffer-local 'allout-show-bodies) |
200 ;;;###autoload | 200 ;;;###autoload |
201 (put 'allout-show-bodies 'safe-local-variable | 201 (put 'allout-show-bodies 'safe-local-variable |
202 '(lambda (x) (member x '(t nil)))) | 202 (if (fboundp 'booleanp) 'booleanp '(lambda (x) (member x '(t nil))))) |
203 | 203 |
204 ;;;_ = allout-header-prefix | 204 ;;;_ = allout-header-prefix |
205 (defcustom allout-header-prefix "." | 205 (defcustom allout-header-prefix "." |
206 "*Leading string which helps distinguish topic headers. | 206 "*Leading string which helps distinguish topic headers. |
207 | 207 |
343 :type 'boolean | 343 :type 'boolean |
344 :group 'allout) | 344 :group 'allout) |
345 (make-variable-buffer-local 'allout-old-style-prefixes) | 345 (make-variable-buffer-local 'allout-old-style-prefixes) |
346 ;;;###autoload | 346 ;;;###autoload |
347 (put 'allout-old-style-prefixes 'safe-local-variable | 347 (put 'allout-old-style-prefixes 'safe-local-variable |
348 '(lambda (x) (member x '(t nil)))) | 348 (if (fboundp 'booleanp) 'booleanp '(lambda (x) (member x '(t nil))))) |
349 ;;;_ = allout-stylish-prefixes - alternating bullets | 349 ;;;_ = allout-stylish-prefixes - alternating bullets |
350 (defcustom allout-stylish-prefixes t | 350 (defcustom allout-stylish-prefixes t |
351 "*Do fancy stuff with topic prefix bullets according to level, etc. | 351 "*Do fancy stuff with topic prefix bullets according to level, etc. |
352 | 352 |
353 Non-nil enables topic creation, modification, and repositioning | 353 Non-nil enables topic creation, modification, and repositioning |
392 :type 'boolean | 392 :type 'boolean |
393 :group 'allout) | 393 :group 'allout) |
394 (make-variable-buffer-local 'allout-stylish-prefixes) | 394 (make-variable-buffer-local 'allout-stylish-prefixes) |
395 ;;;###autoload | 395 ;;;###autoload |
396 (put 'allout-stylish-prefixes 'safe-local-variable | 396 (put 'allout-stylish-prefixes 'safe-local-variable |
397 '(lambda (x) (member x '(t nil)))) | 397 (if (fboundp 'booleanp) 'booleanp '(lambda (x) (member x '(t nil))))) |
398 | 398 |
399 ;;;_ = allout-numbered-bullet | 399 ;;;_ = allout-numbered-bullet |
400 (defcustom allout-numbered-bullet "#" | 400 (defcustom allout-numbered-bullet "#" |
401 "*String designating bullet of topics that have auto-numbering; nil for none. | 401 "*String designating bullet of topics that have auto-numbering; nil for none. |
402 | 402 |
406 disables numbering maintenance." | 406 disables numbering maintenance." |
407 :type '(choice (const nil) string) | 407 :type '(choice (const nil) string) |
408 :group 'allout) | 408 :group 'allout) |
409 (make-variable-buffer-local 'allout-numbered-bullet) | 409 (make-variable-buffer-local 'allout-numbered-bullet) |
410 ;;;###autoload | 410 ;;;###autoload |
411 (put 'allout-numbered-bullet 'safe-local-variable 'string-or-null-p) | 411 (put 'allout-numbered-bullet 'safe-local-variable |
412 (if (fboundp 'string-or-null-p) | |
413 'string-or-null-p | |
414 '(lambda (x) (or (stringp x) (null x))))) | |
412 ;;;_ = allout-file-xref-bullet | 415 ;;;_ = allout-file-xref-bullet |
413 (defcustom allout-file-xref-bullet "@" | 416 (defcustom allout-file-xref-bullet "@" |
414 "*Bullet signifying file cross-references, for `allout-resolve-xref'. | 417 "*Bullet signifying file cross-references, for `allout-resolve-xref'. |
415 | 418 |
416 Set this var to the bullet you want to use for file cross-references." | 419 Set this var to the bullet you want to use for file cross-references." |
417 :type '(choice (const nil) string) | 420 :type '(choice (const nil) string) |
418 :group 'allout) | 421 :group 'allout) |
419 ;;;###autoload | 422 ;;;###autoload |
420 (put 'allout-file-xref-bullet 'safe-local-variable 'string-or-null-p) | 423 (put 'allout-file-xref-bullet 'safe-local-variable |
424 (if (fboundp 'string-or-null-p) | |
425 'string-or-null-p | |
426 '(lambda (x) (or (stringp x) (null x))))) | |
421 ;;;_ = allout-presentation-padding | 427 ;;;_ = allout-presentation-padding |
422 (defcustom allout-presentation-padding 2 | 428 (defcustom allout-presentation-padding 2 |
423 "*Presentation-format white-space padding factor, for greater indent." | 429 "*Presentation-format white-space padding factor, for greater indent." |
424 :type 'integer | 430 :type 'integer |
425 :group 'allout) | 431 :group 'allout) |
618 :type 'boolean | 624 :type 'boolean |
619 :group 'allout) | 625 :group 'allout) |
620 (make-variable-buffer-local 'allout-use-hanging-indents) | 626 (make-variable-buffer-local 'allout-use-hanging-indents) |
621 ;;;###autoload | 627 ;;;###autoload |
622 (put 'allout-use-hanging-indents 'safe-local-variable | 628 (put 'allout-use-hanging-indents 'safe-local-variable |
623 '(lambda (x) (member x '(t nil)))) | 629 (if (fboundp 'booleanp) 'booleanp '(lambda (x) (member x '(t nil))))) |
624 | 630 |
625 ;;;_ = allout-reindent-bodies | 631 ;;;_ = allout-reindent-bodies |
626 (defcustom allout-reindent-bodies (if allout-use-hanging-indents | 632 (defcustom allout-reindent-bodies (if allout-use-hanging-indents |
627 'text) | 633 'text) |
628 "*Non-nil enables auto-adjust of topic body hanging indent with depth shifts. | 634 "*Non-nil enables auto-adjust of topic body hanging indent with depth shifts. |
1065 ;;;_ x allout-view-change-hook | 1071 ;;;_ x allout-view-change-hook |
1066 (defvar allout-view-change-hook nil | 1072 (defvar allout-view-change-hook nil |
1067 "*\(Deprecated\) Hook that's run after allout outline exposure changes. | 1073 "*\(Deprecated\) Hook that's run after allout outline exposure changes. |
1068 | 1074 |
1069 Switch to using `allout-exposure-change-hook' instead. Both | 1075 Switch to using `allout-exposure-change-hook' instead. Both |
1070 variables are currently used if populated, but this one will be | 1076 variables are currently respected, but this one will be ignored |
1071 ignored in a subsequent allout version.") | 1077 in a subsequent allout version.") |
1072 ;;;_ = allout-exposure-change-hook | 1078 ;;;_ = allout-exposure-change-hook |
1073 (defvar allout-exposure-change-hook nil | 1079 (defvar allout-exposure-change-hook nil |
1074 "*Hook that's run after allout outline exposure changes. | 1080 "*Hook that's run after allout outline exposure changes. |
1075 | 1081 |
1076 This variable will replace `allout-view-change-hook' in a subsequent allout | 1082 This variable will replace `allout-view-change-hook' in a subsequent allout |
1077 version, though both are currently checked and used, if populated.") | 1083 version, though both are currently respected.") |
1078 | 1084 |
1079 ;;;_ = allout-outside-normal-auto-fill-function | 1085 ;;;_ = allout-outside-normal-auto-fill-function |
1080 (defvar allout-outside-normal-auto-fill-function nil | 1086 (defvar allout-outside-normal-auto-fill-function nil |
1081 "Value of normal-auto-fill-function outside of allout mode. | 1087 "Value of normal-auto-fill-function outside of allout mode. |
1082 | 1088 |
1759 | 1765 |
1760 (when (and (not inhibit-read-only) (not after)) | 1766 (when (and (not inhibit-read-only) (not after)) |
1761 (let ((start (point)) | 1767 (let ((start (point)) |
1762 (ol-start (overlay-start ol)) | 1768 (ol-start (overlay-start ol)) |
1763 (ol-end (overlay-end ol)) | 1769 (ol-end (overlay-end ol)) |
1764 (msg "Change within concealed text disallowed.") | |
1765 opened | |
1766 first) | 1770 first) |
1767 (goto-char beg) | 1771 (goto-char beg) |
1768 (while (< (point) end) | 1772 (while (< (point) end) |
1769 (when (allout-hidden-p) | 1773 (when (allout-hidden-p) |
1770 (allout-show-to-offshoot) | 1774 (allout-show-to-offshoot) |
1771 (if (allout-hidden-p) | 1775 (if (allout-hidden-p) |
1772 (save-excursion (forward-char 1) | 1776 (save-excursion (forward-char 1) |
1773 (allout-show-to-offshoot))) | 1777 (allout-show-to-offshoot))) |
1774 (when (not first) | 1778 (when (not first) |
1775 (setq opened t) | |
1776 (setq first (point)))) | 1779 (setq first (point)))) |
1777 (goto-char (if (featurep 'xemacs) | 1780 (goto-char (if (featurep 'xemacs) |
1778 (next-property-change (1+ (point)) nil end) | 1781 (next-property-change (1+ (point)) nil end) |
1779 (next-char-property-change (1+ (point)) end)))) | 1782 (next-char-property-change (1+ (point)) end)))) |
1780 (when first | 1783 (when first |
4006 (allout-expose-topic '(* :)))))) | 4009 (allout-expose-topic '(* :)))))) |
4007 ;;;_ > allout-current-topic-collapsed-p (&optional include-single-liners) | 4010 ;;;_ > allout-current-topic-collapsed-p (&optional include-single-liners) |
4008 (defun allout-current-topic-collapsed-p (&optional include-single-liners) | 4011 (defun allout-current-topic-collapsed-p (&optional include-single-liners) |
4009 "True if the currently visible containing topic is already collapsed. | 4012 "True if the currently visible containing topic is already collapsed. |
4010 | 4013 |
4011 If optional INCLUDE-SINGLE-LINERS is true, then include single-line | 4014 Single line topics intrinsically can be considered as being both |
4012 topics \(which intrinsically can be considered both collapsed and | 4015 collapsed and uncollapsed. If optional INCLUDE-SINGLE-LINERS is |
4013 not\), as collapsed. Otherwise they are considered uncollapsed." | 4016 true, then single-line topics are considered to be collapsed. By |
4017 default, they are treated as being uncollapsed." | |
4014 (save-excursion | 4018 (save-excursion |
4015 (and | 4019 (and |
4016 (= (progn (allout-back-to-current-heading) | 4020 (= (progn (allout-back-to-current-heading) |
4017 (move-end-of-line 1) | 4021 (move-end-of-line 1) |
4018 (point)) | 4022 (point)) |
4019 (allout-end-of-current-subtree)) | 4023 (allout-end-of-current-subtree (not (looking-at "\n\n")))) |
4020 (or include-single-liners | 4024 (or include-single-liners |
4021 (progn (backward-char 1) (allout-hidden-p)))))) | 4025 (progn (backward-char 1) (allout-hidden-p)))))) |
4022 ;;;_ > allout-hide-current-subtree (&optional just-close) | 4026 ;;;_ > allout-hide-current-subtree (&optional just-close) |
4023 (defun allout-hide-current-subtree (&optional just-close) | 4027 (defun allout-hide-current-subtree (&optional just-close) |
4024 "Close the current topic, or containing topic if this one is already closed. | 4028 "Close the current topic, or containing topic if this one is already closed. |
4025 | 4029 |
4026 If this topic is closed and it's a top level topic, close this topic | 4030 If this topic is closed and it's a top level topic, close this topic |