Mercurial > emacs
comparison lisp/allout.el @ 105372:bd2966850aac
Use `called-interactively-p' instead of `interactive-p'.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Fri, 02 Oct 2009 03:48:36 +0000 |
parents | f8ba8d6fd250 |
children | 009383a57ce8 |
comparison
equal
deleted
inserted
replaced
105371:0769a73f1d18 | 105372:bd2966850aac |
---|---|
1588 | 1588 |
1589 \(require 'allout) | 1589 \(require 'allout) |
1590 \(allout-init t)" | 1590 \(allout-init t)" |
1591 | 1591 |
1592 (interactive) | 1592 (interactive) |
1593 (if (interactive-p) | 1593 (if (called-interactively-p 'interactive) |
1594 (progn | 1594 (progn |
1595 (setq mode | 1595 (setq mode |
1596 (completing-read | 1596 (completing-read |
1597 (concat "Select outline auto setup mode " | 1597 (concat "Select outline auto setup mode " |
1598 "(empty for report, ? for options) ") | 1598 "(empty for report, ? for options) ") |
1612 (curr-mode 'allout-auto-activation)) | 1612 (curr-mode 'allout-auto-activation)) |
1613 | 1613 |
1614 (cond ((not mode) | 1614 (cond ((not mode) |
1615 (set find-file-hook-var-name | 1615 (set find-file-hook-var-name |
1616 (delq hook (symbol-value find-file-hook-var-name))) | 1616 (delq hook (symbol-value find-file-hook-var-name))) |
1617 (if (interactive-p) | 1617 (if (called-interactively-p 'interactive) |
1618 (message "Allout outline mode auto-activation inhibited."))) | 1618 (message "Allout outline mode auto-activation inhibited."))) |
1619 ((eq mode 'report) | 1619 ((eq mode 'report) |
1620 (if (not (memq hook (symbol-value find-file-hook-var-name))) | 1620 (if (not (memq hook (symbol-value find-file-hook-var-name))) |
1621 (allout-init nil) | 1621 (allout-init nil) |
1622 ;; Just punt and use the reports from each of the modes: | 1622 ;; Just punt and use the reports from each of the modes: |
2899 | 2899 |
2900 (allout-beginning-of-current-line) | 2900 (allout-beginning-of-current-line) |
2901 (let ((bol-point (point))) | 2901 (let ((bol-point (point))) |
2902 (if (allout-goto-prefix-doublechecked) | 2902 (if (allout-goto-prefix-doublechecked) |
2903 (if (<= (point) bol-point) | 2903 (if (<= (point) bol-point) |
2904 (if (interactive-p) | 2904 (if (called-interactively-p 'interactive) |
2905 (allout-end-of-prefix) | 2905 (allout-end-of-prefix) |
2906 (point)) | 2906 (point)) |
2907 (goto-char (point-min)) | 2907 (goto-char (point-min)) |
2908 nil)))) | 2908 nil)))) |
2909 ;;;_ > allout-back-to-heading () | 2909 ;;;_ > allout-back-to-heading () |
2966 (move-beginning-of-line 1) | 2966 (move-beginning-of-line 1) |
2967 (if (< 0 (allout-current-depth)) | 2967 (if (< 0 (allout-current-depth)) |
2968 (goto-char allout-recent-prefix-end) | 2968 (goto-char allout-recent-prefix-end) |
2969 (goto-char (point-min))) | 2969 (goto-char (point-min))) |
2970 (allout-end-of-prefix) | 2970 (allout-end-of-prefix) |
2971 (if (and (interactive-p) | 2971 (if (and (called-interactively-p 'interactive) |
2972 (= (point) start-point)) | 2972 (= (point) start-point)) |
2973 (goto-char (allout-current-bullet-pos))))) | 2973 (goto-char (allout-current-bullet-pos))))) |
2974 ;;;_ > allout-end-of-entry (&optional inclusive) | 2974 ;;;_ > allout-end-of-entry (&optional inclusive) |
2975 (defun allout-end-of-entry (&optional inclusive) | 2975 (defun allout-end-of-entry (&optional inclusive) |
2976 "Position the point at the end of the current topics' entry. | 2976 "Position the point at the end of the current topics' entry. |
3016 (if (and (> depth 0)(<= depth (allout-depth))) | 3016 (if (and (> depth 0)(<= depth (allout-depth))) |
3017 (let (last-ascended) | 3017 (let (last-ascended) |
3018 (while (and (< depth allout-recent-depth) | 3018 (while (and (< depth allout-recent-depth) |
3019 (setq last-ascended (allout-ascend)))) | 3019 (setq last-ascended (allout-ascend)))) |
3020 (goto-char allout-recent-prefix-beginning) | 3020 (goto-char allout-recent-prefix-beginning) |
3021 (if (interactive-p) (allout-end-of-prefix)) | 3021 (if (called-interactively-p 'interactive) (allout-end-of-prefix)) |
3022 (and last-ascended allout-recent-depth)))) | 3022 (and last-ascended allout-recent-depth)))) |
3023 ;;;_ > allout-ascend () | 3023 ;;;_ > allout-ascend () |
3024 (defun allout-ascend (&optional dont-move-if-unsuccessful) | 3024 (defun allout-ascend (&optional dont-move-if-unsuccessful) |
3025 "Ascend one level, returning resulting depth if successful, nil if not. | 3025 "Ascend one level, returning resulting depth if successful, nil if not. |
3026 | 3026 |
3044 (t | 3044 (t |
3045 ;; some topic after very first is lower depth than first: | 3045 ;; some topic after very first is lower depth than first: |
3046 (goto-char bolevel) | 3046 (goto-char bolevel) |
3047 (allout-depth) | 3047 (allout-depth) |
3048 nil)))) | 3048 nil)))) |
3049 (if (interactive-p) (allout-end-of-prefix)))) | 3049 (if (called-interactively-p 'interactive) (allout-end-of-prefix)))) |
3050 ;;;_ > allout-descend-to-depth (depth) | 3050 ;;;_ > allout-descend-to-depth (depth) |
3051 (defun allout-descend-to-depth (depth) | 3051 (defun allout-descend-to-depth (depth) |
3052 "Descend to depth DEPTH within current topic. | 3052 "Descend to depth DEPTH within current topic. |
3053 | 3053 |
3054 Returning depth if successful, nil if not." | 3054 Returning depth if successful, nil if not." |
3072 (let ((start-point (point))) | 3072 (let ((start-point (point))) |
3073 (allout-back-to-current-heading) | 3073 (allout-back-to-current-heading) |
3074 (if (not (allout-ascend)) | 3074 (if (not (allout-ascend)) |
3075 (progn (goto-char start-point) | 3075 (progn (goto-char start-point) |
3076 (error "Can't ascend past outermost level")) | 3076 (error "Can't ascend past outermost level")) |
3077 (if (interactive-p) (allout-end-of-prefix)) | 3077 (if (called-interactively-p 'interactive) (allout-end-of-prefix)) |
3078 allout-recent-prefix-beginning))) | 3078 allout-recent-prefix-beginning))) |
3079 | 3079 |
3080 ;;;_ - Linear | 3080 ;;;_ - Linear |
3081 ;;;_ > allout-next-sibling (&optional depth backward) | 3081 ;;;_ > allout-next-sibling (&optional depth backward) |
3082 (defun allout-next-sibling (&optional depth backward) | 3082 (defun allout-next-sibling (&optional depth backward) |
3217 "Go to the last sibling at this level, visible or not." | 3217 "Go to the last sibling at this level, visible or not." |
3218 | 3218 |
3219 (let ((depth (allout-depth))) | 3219 (let ((depth (allout-depth))) |
3220 (while (allout-previous-sibling depth nil)) | 3220 (while (allout-previous-sibling depth nil)) |
3221 (prog1 allout-recent-depth | 3221 (prog1 allout-recent-depth |
3222 (if (interactive-p) (allout-end-of-prefix))))) | 3222 (if (called-interactively-p 'interactive) (allout-end-of-prefix))))) |
3223 ;;;_ > allout-next-visible-heading (arg) | 3223 ;;;_ > allout-next-visible-heading (arg) |
3224 (defun allout-next-visible-heading (arg) | 3224 (defun allout-next-visible-heading (arg) |
3225 "Move to the next ARG'th visible heading line, backward if arg is negative. | 3225 "Move to the next ARG'th visible heading line, backward if arg is negative. |
3226 | 3226 |
3227 Move to buffer limit in indicated direction if headings are exhausted." | 3227 Move to buffer limit in indicated direction if headings are exhausted." |
3270 With argument, repeats or can move forward if negative. | 3270 With argument, repeats or can move forward if negative. |
3271 A heading line is one that starts with a `*' (or that `allout-regexp' | 3271 A heading line is one that starts with a `*' (or that `allout-regexp' |
3272 matches)." | 3272 matches)." |
3273 (interactive "p") | 3273 (interactive "p") |
3274 (prog1 (allout-next-visible-heading (- arg)) | 3274 (prog1 (allout-next-visible-heading (- arg)) |
3275 (if (interactive-p) (allout-end-of-prefix)))) | 3275 (if (called-interactively-p 'interactive) (allout-end-of-prefix)))) |
3276 ;;;_ > allout-forward-current-level (arg) | 3276 ;;;_ > allout-forward-current-level (arg) |
3277 (defun allout-forward-current-level (arg) | 3277 (defun allout-forward-current-level (arg) |
3278 "Position point at the next heading of the same level. | 3278 "Position point at the next heading of the same level. |
3279 | 3279 |
3280 Takes optional repeat-count, goes backward if count is negative. | 3280 Takes optional repeat-count, goes backward if count is negative. |
3291 (while (and (not (zerop arg)) | 3291 (while (and (not (zerop arg)) |
3292 (if backward | 3292 (if backward |
3293 (allout-previous-sibling) | 3293 (allout-previous-sibling) |
3294 (allout-next-sibling))) | 3294 (allout-next-sibling))) |
3295 (setq arg (1- arg))) | 3295 (setq arg (1- arg))) |
3296 (if (not (interactive-p)) | 3296 (if (not (called-interactively-p 'interactive)) |
3297 nil | 3297 nil |
3298 (allout-end-of-prefix) | 3298 (allout-end-of-prefix) |
3299 (if (not (zerop arg)) | 3299 (if (not (zerop arg)) |
3300 (error "Hit %s level %d topic, traversed %d of %d requested" | 3300 (error "Hit %s level %d topic, traversed %d of %d requested" |
3301 (if backward "first" "last") | 3301 (if backward "first" "last") |
3304 (abs start-arg)))))) | 3304 (abs start-arg)))))) |
3305 ;;;_ > allout-backward-current-level (arg) | 3305 ;;;_ > allout-backward-current-level (arg) |
3306 (defun allout-backward-current-level (arg) | 3306 (defun allout-backward-current-level (arg) |
3307 "Inverse of `allout-forward-current-level'." | 3307 "Inverse of `allout-forward-current-level'." |
3308 (interactive "p") | 3308 (interactive "p") |
3309 (if (interactive-p) | 3309 (if (called-interactively-p 'interactive) |
3310 (let ((current-prefix-arg (* -1 arg))) | 3310 (let ((current-prefix-arg (* -1 arg))) |
3311 (call-interactively 'allout-forward-current-level)) | 3311 (call-interactively 'allout-forward-current-level)) |
3312 (allout-forward-current-level (* -1 arg)))) | 3312 (allout-forward-current-level (* -1 arg)))) |
3313 | 3313 |
3314 ;;;_ #5 Alteration | 3314 ;;;_ #5 Alteration |
4843 (t level))) | 4843 (t level))) |
4844 (chart (allout-chart-subtree chart-level)) | 4844 (chart (allout-chart-subtree chart-level)) |
4845 (to-reveal (or (allout-chart-to-reveal chart chart-level) | 4845 (to-reveal (or (allout-chart-to-reveal chart chart-level) |
4846 ;; interactive, show discontinuous children: | 4846 ;; interactive, show discontinuous children: |
4847 (and chart | 4847 (and chart |
4848 (interactive-p) | 4848 (called-interactively-p 'interactive) |
4849 (save-excursion | 4849 (save-excursion |
4850 (allout-back-to-current-heading) | 4850 (allout-back-to-current-heading) |
4851 (setq depth (allout-current-depth)) | 4851 (setq depth (allout-current-depth)) |
4852 (and (allout-next-heading) | 4852 (and (allout-next-heading) |
4853 (> allout-recent-depth | 4853 (> allout-recent-depth |