X-Git-Url: https://iankelling.org/git/?p=dot-emacs;a=blobdiff_plain;f=init.el;fp=init.el;h=4855c41e3683d550e0a02ef607eb35299e546e98;hp=6a3fb78fbe63f4a2df6350d96137925d13572aa7;hb=74067d92342d66f294e40d254bc4d13418f1b62e;hpb=26ec1fad5f1d9480594b46289d6edba42c3392da diff --git a/init.el b/init.el index 6a3fb78..4855c41 100644 --- a/init.el +++ b/init.el @@ -1472,6 +1472,23 @@ indent yanked text (with prefix arg don't indent)." ;; # eval: (outline-minor-mode) ;; # outline-regexp: "\\( *\\)# [*]\\{1,8\\} " +(defun outline-level () + "Return the depth to which a statement is nested in the outline. +Point must be at the beginning of a header line. +This is actually either the level specified in `outline-heading-alist' +or else the number of characters matched by `outline-regexp'." + (or (cdr (assoc (match-string 0) outline-heading-alist)) + (let ((whitespace-end (match-end 1)) + (match-begin (match-beginning 0))) + (if (= whitespace-end match-begin) + (- (match-end 0) match-begin) + (- (match-end 0) whitespace-end) + )))) +;; originally: +;;(or (cdr (assoc (match-string 0) outline-heading-alist)) +;; (- (match-end 0) (match-beginning 0)))) + + ;; avoid stupid git crap like "warning, terminal not fully functional" (setenv "PAGER" "cat")