Skip to content

Commit

Permalink
remove elx-commentary-start and elx-commentary-end
Browse files Browse the repository at this point in the history
Use the respective lm-* functions instead.  lm-commentary-end will be
updated always return a position before the first non-comment after
the start.
  • Loading branch information
tarsius committed Dec 17, 2012
1 parent 7e3816e commit af4482b
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions elx.el
Original file line number Diff line number Diff line change
Expand Up @@ -102,20 +102,6 @@ the cadr."
(add-to-list 'keywords keyword))))
(sort keywords 'string<))))

(defsubst elx-commentary-start (&optional afterp)
"Return the buffer location of the `Commentary' start marker.
If optional AFTERP is non-nil return the locations after the
commentary header itself."
(lm-section-start lm-commentary-header t))

(defsubst elx-commentary-end ()
"Return the buffer location of the `Commentary' section end.
This even works when no other section follows the commentary section
like when the actual code is not prefixed with the \"Code\" section tag."
(goto-char (elx-commentary-start t))
(min (lm-section-end lm-commentary-header)
(1- (or (re-search-forward "^[\s\t]*[^;\n]" nil t) (point-max)))))

(defun elx-commentary (&optional file)
"Return the commentary in file FILE, or current buffer if FILE is nil.
Expand All @@ -127,10 +113,11 @@ the leading semicolons and exactly one space are removed, likewise
leading \"\(\" is replaced with just \"(\". Lines consisting only of
whitespace are converted to empty lines."
(lm-with-file file
(let ((start (elx-commentary-start t)))
(let ((start (lm-section-start lm-commentary-header t)))
(when start
(goto-char start)
(let ((commentary (buffer-substring-no-properties
start (elx-commentary-end))))
start (lm-commentary-end))))
(mapc (lambda (elt)
(setq commentary (replace-regexp-in-string
(car elt) (cdr elt) commentary)))
Expand Down

0 comments on commit af4482b

Please sign in to comment.