summaryrefslogtreecommitdiff
path: root/lisp/progmodes/make-mode.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2013-01-30 15:46:10 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2013-01-30 15:46:10 -0500
commitc56d2269c288cc6baa1926dd9f781f34656cc1cf (patch)
treead37f00945815a48b28b7f4a8a4f794676cd7956 /lisp/progmodes/make-mode.el
parent382936d1460c215c93fd2d8b9ae15b118fd1e90c (diff)
downloademacs-c56d2269c288cc6baa1926dd9f781f34656cc1cf.tar.gz
* lisp/progmodes/make-mode.el (makefile-backslash-region): Don't compute
column if we're just deleting the backslashes. (makefile-fill-paragraph): Use eolp.
Diffstat (limited to 'lisp/progmodes/make-mode.el')
-rw-r--r--lisp/progmodes/make-mode.el41
1 files changed, 19 insertions, 22 deletions
diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el
index 8ab4c6f95b6..be718135f99 100644
--- a/lisp/progmodes/make-mode.el
+++ b/lisp/progmodes/make-mode.el
@@ -1213,26 +1213,23 @@ definition and conveniently use this command."
(save-excursion
(goto-char from)
(let ((column makefile-backslash-column)
- (endmark (make-marker)))
- (move-marker endmark to)
+ (endmark (copy-marker to)))
;; Compute the smallest column number past the ends of all the lines.
- (if makefile-backslash-align
- (progn
- (if (not delete-flag)
- (while (< (point) to)
- (end-of-line)
- (if (= (preceding-char) ?\\)
- (progn (forward-char -1)
- (skip-chars-backward " \t")))
- (setq column (max column (1+ (current-column))))
- (forward-line 1)))
- ;; Adjust upward to a tab column, if that doesn't push
- ;; past the margin.
- (if (> (% column tab-width) 0)
- (let ((adjusted (* (/ (+ column tab-width -1) tab-width)
- tab-width)))
- (if (< adjusted (window-width))
- (setq column adjusted))))))
+ (when (and makefile-backslash-align (not delete-flag))
+ (while (< (point) to)
+ (end-of-line)
+ (if (= (preceding-char) ?\\)
+ (progn (forward-char -1)
+ (skip-chars-backward " \t")))
+ (setq column (max column (1+ (current-column))))
+ (forward-line 1))
+ ;; Adjust upward to a tab column, if that doesn't push
+ ;; past the margin.
+ (if (> (% column tab-width) 0)
+ (let ((adjusted (* (/ (+ column tab-width -1) tab-width)
+ tab-width)))
+ (if (< adjusted (window-width))
+ (setq column adjusted)))))
;; Don't modify blank lines at start of region.
(goto-char from)
(while (and (< (point) endmark) (eolp))
@@ -1296,9 +1293,9 @@ Fill comments, backslashed lines, and variable definitions specially."
(while (= (preceding-char) ?\\)
(end-of-line 0))
;; Maybe we hit bobp, in which case we are not at EOL.
- (if (eq (point) (line-end-position))
- (forward-char))
- (point)))
+ (if (eolp)
+ (1+ (point))
+ (point))))
(end
(save-excursion
(while (= (preceding-char) ?\\)