Function: allout-infer-header-lead-and-primary-bullet

allout-infer-header-lead-and-primary-bullet is a byte-compiled function defined in allout.el.gz.

Signature

(allout-infer-header-lead-and-primary-bullet)

Documentation

Determine appropriate allout-header-prefix and allout-primary-bullet.

Works according to settings of:

       comment-start
       allout-header-prefix (default)
       allout-use-mode-specific-leader
and allout-mode-leaders.

Apply this via (re)activation of allout-mode(var)/allout-mode(fun), rather than invoking it directly.

Aliases

allout-infer-header-lead

Source Code

;; Defined in /usr/src/emacs/lisp/allout.el.gz
;;;_   > allout-infer-header-lead-and-primary-bullet ()
(defun allout-infer-header-lead-and-primary-bullet ()
  "Determine appropriate `allout-header-prefix' and `allout-primary-bullet'.

Works according to settings of:

       `comment-start'
       `allout-header-prefix' (default)
       `allout-use-mode-specific-leader'
and    `allout-mode-leaders'.

Apply this via (re)activation of `allout-mode', rather than
invoking it directly."
  (let* ((use-leader (and (boundp 'allout-use-mode-specific-leader)
			  (if (or (stringp allout-use-mode-specific-leader)
				  (memq allout-use-mode-specific-leader
					'(allout-mode-leaders
					  comment-start
					  t)))
			      allout-use-mode-specific-leader
			    ;; Oops -- garbled value, equate with effect of t:
			    t)))
	 (leader
	  (cond
	   ((not use-leader) nil)
	   ;; Use the explicitly designated leader:
	   ((stringp use-leader) use-leader)
	   (t (or (and (memq use-leader '(t allout-mode-leaders))
		       ;; Get it from outline mode leaders?
		       (cdr (assq major-mode allout-mode-leaders)))
		  ;; ... didn't get from allout-mode-leaders...
		  (and (memq use-leader '(t comment-start))
		       comment-start
		       ;; Use comment-start, maybe tripled, and with
		       ;; underscore:
		       (concat
			(if (string= " "
				     (substring comment-start
						(1- (length comment-start))))
			    ;; Use comment-start, sans trailing space:
			    (substring comment-start 0 -1)
			  (concat comment-start comment-start comment-start))
			;; ... and append underscore, whichever:
			"_")))))))
    (if (not leader)
	nil
      (setq allout-header-prefix leader)
      (if (not allout-old-style-prefixes)
          ;; setting allout-primary-bullet makes the top level topics use --
          ;; actually, be -- the special prefix:
          (setq allout-primary-bullet leader))
      allout-header-prefix)))