X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/a749f1c648f2b9bf1a0b0b10e2da4c1c4e3d431d..4a2f33d1a11e0608d521520afcb14ec13dd1a722:/lisp/align.el diff --git a/lisp/align.el b/lisp/align.el index 82a55b0fea..f09f57032d 100644 --- a/lisp/align.el +++ b/lisp/align.el @@ -1,6 +1,6 @@ ;;; align.el --- align text to a specific column, by regexp -*- lexical-binding:t -*- -;; Copyright (C) 1999-2015 Free Software Foundation, Inc. +;; Copyright (C) 1999-2016 Free Software Foundation, Inc. ;; Author: John Wiegley ;; Maintainer: emacs-devel@gnu.org @@ -888,15 +888,15 @@ on the format of these lists." (let ((sec-first end) (sec-last beg)) (align-region beg end - (or exclude-rules - align-mode-exclude-rules-list - align-exclude-rules-list) nil separator - (function - (lambda (b e mode) - (when (and mode (listp mode)) - (setq sec-first (min sec-first b) - sec-last (max sec-last e)))))) + nil ; rules + (or exclude-rules + align-mode-exclude-rules-list + align-exclude-rules-list) + (lambda (b e mode) + (when (consp mode) + (setq sec-first (min sec-first b) + sec-last (max sec-last e))))) (if (< sec-first sec-last) (align-region sec-first sec-last 'entire (or rules align-mode-rules-list align-rules-list) @@ -1051,7 +1051,9 @@ to be colored." ;;;###autoload (defun align-newline-and-indent () - "A replacement function for `newline-and-indent', aligning as it goes." + "A replacement function for `newline-and-indent', aligning as it goes. +The alignment is done by calling `align' on the region that was +indented." (interactive) (let ((separate (or (if (and (symbolp align-region-separate) (boundp align-region-separate)) @@ -1348,7 +1350,7 @@ aligner would have dealt with are." (if real-beg (goto-char beg) (if (or (not thissep) (eq thissep 'entire)) - (error "Cannot determine alignment region for '%s'" + (error "Cannot determine alignment region for `%s'" (symbol-name (cdr (assq 'title rule))))) (beginning-of-line) (while (and (not (eobp)) @@ -1437,12 +1439,12 @@ aligner would have dealt with are." (message "Aligning `%s' (rule %d of %d) %d%%..." (symbol-name symbol) rule-index rule-count - (/ (* (- (point) real-beg) 100) - (- end-mark real-beg))) + (floor (* (- (point) real-beg) 100.0) + (- end-mark real-beg))) (message "Aligning %d%%..." - (/ (* (- (point) real-beg) 100) - (- end-mark real-beg)))))) + (floor (* (- (point) real-beg) 100.0) + (- end-mark real-beg)))))) ;; if the search ended us on the beginning of ;; the next line, move back to the end of the