]> code.delx.au - gnu-emacs/commitdiff
Fix some folding issues in read-multiple-choice
authorLars Ingebrigtsen <larsi@gnus.org>
Wed, 10 Feb 2016 00:14:45 +0000 (11:14 +1100)
committerLars Ingebrigtsen <larsi@gnus.org>
Wed, 10 Feb 2016 00:14:45 +0000 (11:14 +1100)
* lisp/subr.el (read-multiple-choice): Fix folding when you
have many items.

lisp/subr.el

index f70f3edd028107a2f76a4e3be1161542e2ea16cd..447c3eb1a4fe12470571f718d59a93691cb821fa 100644 (file)
@@ -2340,9 +2340,10 @@ Usage example:
                         ;; Add padding.
                         (while (not (eobp))
                           (end-of-line)
-                          (insert (make-string (- (* (mod times columns)
-                                                     (+ fill-column 4))
-                                                  (current-column))
+                          (insert (make-string (max (- (* (mod times columns)
+                                                          (+ fill-column 4))
+                                                       (current-column))
+                                                    0)
                                                ?\s))
                           (forward-line 1))))
                     (setq times (1+ times))
@@ -2354,10 +2355,11 @@ Usage example:
                                       (cdr (assq (car elem) altered-names))))
                              (fill-region (point-min) (point-max))
                              (when (nth 2 elem)
-                               (insert (nth 2 elem))
-                               (unless (bolp)
-                                 (insert "\n"))
-                               (fill-region start (point-max)))
+                               (let ((start (point)))
+                                 (insert (nth 2 elem))
+                                 (unless (bolp)
+                                   (insert "\n"))
+                                 (fill-region start (point-max))))
                              (buffer-string))))
                       (goto-char start)
                       (dolist (line (split-string text "\n"))