Function: allout-set-regexp
allout-set-regexp is an interactive and byte-compiled function defined
in allout.el.gz.
Signature
(allout-set-regexp)
Documentation
Generate proper topic-header regexp form for outline functions.
Works with respect to allout-plain-bullets-string and
allout-distinctive-bullets-string.
Also refresh various data structures that hinge on the regexp.
Key Bindings
Aliases
set-allout-regexp (obsolete since 26.1)
Source Code
;; Defined in /usr/src/emacs/lisp/allout.el.gz
;;;_ > allout-set-regexp ()
(defun allout-set-regexp ()
"Generate proper topic-header regexp form for outline functions.
Works with respect to `allout-plain-bullets-string' and
`allout-distinctive-bullets-string'.
Also refresh various data structures that hinge on the regexp."
(interactive)
;; Derive allout-bullets-string from user configured components:
(setq allout-bullets-string "")
(let ((strings (list 'allout-plain-bullets-string
'allout-distinctive-bullets-string
'allout-primary-bullet))
cur-string
cur-len
cur-char
index)
(while strings
(setq index 0)
(setq cur-len (length (setq cur-string (symbol-value (car strings)))))
(while (< index cur-len)
(setq cur-char (aref cur-string index))
(setq allout-bullets-string
(concat allout-bullets-string
(cond
; Single dash would denote a
; sequence, repeated denotes
; a dash:
((eq cur-char ?-) "--")
; literal close-square-bracket
; doesn't work right in the
; expr, exclude it:
((eq cur-char ?\]) "")
(t (regexp-quote (char-to-string cur-char))))))
(setq index (1+ index)))
(setq strings (cdr strings)))
)
;; Derive next for repeated use in allout-pending-bullet:
(setq allout-plain-bullets-string-len (length allout-plain-bullets-string))
(setq allout-header-subtraction (1- (length allout-header-prefix)))
(let (new-part old-part formfeed-part)
(setq new-part (concat "\\("
(regexp-quote allout-header-prefix)
"[ \t]*"
;; already regexp-quoted in a custom way:
"[" allout-bullets-string "]"
"\\)")
old-part (concat "\\("
(regexp-quote allout-primary-bullet)
"\\|"
(regexp-quote allout-header-prefix)
"\\)"
"+"
" ?[^" allout-primary-bullet "]")
formfeed-part "\\(\^L\\)"
allout-regexp (concat new-part
"\\|"
old-part
"\\|"
formfeed-part)
allout-line-boundary-regexp (concat "\n" new-part
"\\|"
"\n" old-part
"\\|"
"\n" formfeed-part)
allout-bob-regexp (concat "\\`" new-part
"\\|"
"\\`" old-part
"\\|"
"\\`" formfeed-part
))
(setq allout-depth-specific-regexp
(concat "\\(^\\|\\`\\)"
"\\("
;; new-style spacers-then-bullet string:
"\\("
(allout-format-quote (regexp-quote allout-header-prefix))
" \\{%s\\}"
"[" (allout-format-quote allout-bullets-string) "]"
"\\)"
;; old-style all-bullets string, if primary not multi-char:
(if (< 0 allout-header-subtraction)
""
(concat "\\|\\("
(allout-format-quote
(regexp-quote allout-primary-bullet))
(allout-format-quote
(regexp-quote allout-primary-bullet))
(allout-format-quote
(regexp-quote allout-primary-bullet))
"\\{%s\\}"
;; disqualify greater depths:
"[^"
(allout-format-quote allout-primary-bullet)
"]\\)"
))
"\\)"
))
(setq allout-depth-one-regexp
(concat "\\(^\\|\\`\\)"
"\\("
"\\("
(regexp-quote allout-header-prefix)
;; disqualify any bullet char following any amount of
;; intervening whitespace:
" *"
(concat "[^ " allout-bullets-string "]")
"\\)"
(if (< 0 allout-header-subtraction)
;; Need not support anything like the old
;; bullet style if the prefix is multi-char.
""
(concat "\\|"
(regexp-quote allout-primary-bullet)
;; disqualify deeper primary-bullet sequences:
"[^" allout-primary-bullet "]"))
"\\)"
))))