aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/whitespace.el24
1 files changed, 14 insertions, 10 deletions
diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index 0137ddcf04f..47434bf3d2e 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -2067,16 +2067,7 @@ resultant list will be returned."
2067 ,@(when (or (memq 'lines whitespace-active-style) 2067 ,@(when (or (memq 'lines whitespace-active-style)
2068 (memq 'lines-tail whitespace-active-style)) 2068 (memq 'lines-tail whitespace-active-style))
2069 ;; Show "long" lines. 2069 ;; Show "long" lines.
2070 `((,(let ((line-column (or whitespace-line-column fill-column))) 2070 `((,#'whitespace-lines-regexp
2071 (format
2072 "^\\([^\t\n]\\{%s\\}\\|[^\t\n]\\{0,%s\\}\t\\)\\{%d\\}%s\\(.+\\)$"
2073 tab-width
2074 (1- tab-width)
2075 (/ line-column tab-width)
2076 (let ((rem (% line-column tab-width)))
2077 (if (zerop rem)
2078 ""
2079 (format ".\\{%d\\}" rem)))))
2080 ,(if (memq 'lines whitespace-active-style) 2071 ,(if (memq 'lines whitespace-active-style)
2081 0 ; whole line 2072 0 ; whole line
2082 2) ; line tail 2073 2) ; line tail
@@ -2177,6 +2168,19 @@ resultant list will be returned."
2177 (setq status nil))) ;; end of buffer 2168 (setq status nil))) ;; end of buffer
2178 status)) 2169 status))
2179 2170
2171(defun whitespace-lines-regexp (limit)
2172 (re-search-forward
2173 (let ((line-column (or whitespace-line-column fill-column)))
2174 (format
2175 "^\\([^\t\n]\\{%s\\}\\|[^\t\n]\\{0,%s\\}\t\\)\\{%d\\}%s\\(.+\\)$"
2176 tab-width
2177 (1- tab-width)
2178 (/ line-column tab-width)
2179 (let ((rem (% line-column tab-width)))
2180 (if (zerop rem)
2181 ""
2182 (format ".\\{%d\\}" rem)))))
2183 limit t))
2180 2184
2181(defun whitespace-empty-at-bob-regexp (limit) 2185(defun whitespace-empty-at-bob-regexp (limit)
2182 "Match spaces at beginning of buffer which do not contain the point at \ 2186 "Match spaces at beginning of buffer which do not contain the point at \