+ (line-beginning-position (if after 2))))))
+(defalias 'lm-section-mark 'lm-section-start)
+
+(defun lm-section-end (header)
+ "Return the buffer location of the end of a given section.
+The HEADER is the section string marking the beginning of the
+section. If the given section does not exist, return nil.
+
+The end of the section is defined as the beginning of the next
+section of the same level or lower. The function
+`lisp-outline-level' is used to compute the level of a section.
+If no such section exists, return the end of the buffer."
+ (let ((start (lm-section-start header)))
+ (when start
+ (save-excursion
+ (goto-char start)
+ (let ((level (lisp-outline-level))
+ (case-fold-search t)
+ next-section-found)
+ (beginning-of-line 2)
+ (while (and (setq next-section-found
+ (re-search-forward
+ (lm-get-header-re lm-any-header 'section)
+ nil t))
+ (> (save-excursion
+ (beginning-of-line)
+ (lisp-outline-level))
+ level)))
+ (if next-section-found
+ (line-beginning-position)
+ (point-max)))))))
+
+(defsubst lm-code-start ()