Skip to content

Commit d2e40a2

Browse files
committed
add ignore-fill magic comment
1 parent c5765ab commit d2e40a2

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

elisp-lint.el

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,12 @@ Use a file variable or \".dir-locals.el\" to override the default value."
380380
"$")
381381
"This regexp must match a URL in comments or strings.")
382382

383+
(defvar elisp-lint--ignore-fill-re
384+
";+[[:blank:]]*<elisp-lint-ignore-fill>[[:blank:]]*$")
385+
386+
(defvar elisp-lint--resume-fill-re
387+
";+[[:blank:]]*<elisp-lint-resume-fill>[[:blank:]]*$")
388+
383389
(defun elisp-lint--fill-column ()
384390
"Confirm buffer has no lines exceeding `fill-column' in length.
385391
Use a file variable or \".dir-locals.el\" to override the default
@@ -405,14 +411,16 @@ have unlimited length:
405411
(let ((text (buffer-substring-no-properties
406412
(line-beginning-position)
407413
(line-end-position))))
408-
(when
409-
(and (not (string-match elisp-lint--package-summary-regexp text))
410-
(not (string-match elisp-lint--package-requires-regexp text))
411-
(not (string-match elisp-lint--url-in-document-regexp text))
412-
(> (length text) fill-column))
413-
(push (list line-number 0 'fill-column
414-
(format "line length %s exceeded" fill-column))
415-
too-long-lines)))
414+
(if (string-match-p elisp-lint--ignore-fill-re text)
415+
(re-search-forward elisp-lint--resume-fill-re nil :move)
416+
(when
417+
(and (not (string-match elisp-lint--package-summary-regexp text))
418+
(not (string-match elisp-lint--package-requires-regexp text))
419+
(not (string-match elisp-lint--url-in-document-regexp text))
420+
(> (length text) fill-column))
421+
(push (list line-number 0 'fill-column
422+
(format "line length %s exceeded" fill-column))
423+
too-long-lines))))
416424
(setq line-number (1+ line-number))
417425
(forward-line 1))
418426
too-long-lines)))

0 commit comments

Comments
 (0)