]> code.delx.au - gnu-emacs/commitdiff
makefile-fill-paragraph tweak
authorGlenn Morris <rgm@gnu.org>
Thu, 3 Jan 2013 08:23:10 +0000 (00:23 -0800)
committerGlenn Morris <rgm@gnu.org>
Thu, 3 Jan 2013 08:23:10 +0000 (00:23 -0800)
* lisp/progmodes/make-mode.el (makefile-fill-paragraph): Add doc.
Handle paragraph starting at beginning of buffer.

lisp/ChangeLog
lisp/progmodes/make-mode.el

index 0d34da2c049664b9f0b6fa6f40ebfc5924d1f6bb..2b7cb55da89c870a75fa9b45af2eb982758c692f 100644 (file)
@@ -1,5 +1,8 @@
 2013-01-03  Glenn Morris  <rgm@gnu.org>
 
+       * progmodes/make-mode.el (makefile-fill-paragraph): Add doc.
+       Handle paragraph starting at beginning of buffer.
+
        * subr.el (eval-after-load): Don't purecopy the form, so that it
        can be nconc'd later on; reverts 2009-11-11 change.  (Bug#13331)
 
index 793c3bbbf3767b9934d4d710e410a5e7943b652c..8ab4c6f95b6cf9ca27c7facc996947f9815b3ead 100644 (file)
@@ -1273,9 +1273,9 @@ definition and conveniently use this command."
 
 ;; Filling
 
-(defun makefile-fill-paragraph (_arg)
-  ;; Fill comments, backslashed lines, and variable definitions
-  ;; specially.
+(defun makefile-fill-paragraph (_justify)
+  "Function used for `fill-paragraph-function' in Makefile mode.
+Fill comments, backslashed lines, and variable definitions specially."
   (save-excursion
     (beginning-of-line)
     (cond
@@ -1295,7 +1295,9 @@ definition and conveniently use this command."
               (end-of-line 0)
               (while (= (preceding-char) ?\\)
                 (end-of-line 0))
-              (forward-char)
+              ;; Maybe we hit bobp, in which case we are not at EOL.
+              (if (eq (point) (line-end-position))
+                  (forward-char))
               (point)))
            (end
             (save-excursion