Function: allout-ascend

allout-ascend is a byte-compiled function defined in allout.el.gz.

Signature

(allout-ascend &optional DONT-MOVE-IF-UNSUCCESSFUL)

Documentation

Ascend one level, returning resulting depth if successful, nil if not.

Point is left at the beginning of the level whether or not successful, unless optional DONT-MOVE-IF-UNSUCCESSFUL is set, in which case point is returned to its original starting location.

Source Code

;; Defined in /usr/src/emacs/lisp/allout.el.gz
;;;_   > allout-ascend (&optional dont-move-if-unsuccessful)
(defun allout-ascend (&optional dont-move-if-unsuccessful)
  "Ascend one level, returning resulting depth if successful, nil if not.

Point is left at the beginning of the level whether or not
successful, unless optional DONT-MOVE-IF-UNSUCCESSFUL is set, in
which case point is returned to its original starting location."
  (if dont-move-if-unsuccessful
      (setq dont-move-if-unsuccessful (point)))
  (prog1
      (if (allout-beginning-of-level)
          (let ((bolevel (point))
                (bolevel-depth allout-recent-depth))
            (allout-previous-heading)
            (cond ((< allout-recent-depth bolevel-depth)
                   allout-recent-depth)
                  ((= allout-recent-depth bolevel-depth)
                   (if dont-move-if-unsuccessful
                       (goto-char dont-move-if-unsuccessful))
                   (allout-depth)
                   nil)
                  (t
                   ;; some topic after very first is lower depth than first:
                   (goto-char bolevel)
                   (allout-depth)
                   nil))))
    (if (allout-called-interactively-p) (allout-end-of-prefix))))