]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix bootstrap errors after previous easy-mmode change
authorLars Ingebrigtsen <larsi@gnus.org>
Sat, 2 Apr 2022 14:53:24 +0000 (16:53 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Sat, 2 Apr 2022 14:53:24 +0000 (16:53 +0200)
* lisp/subr.el (ensure-empty-lines, string-lines): Moved from
subr-x so that they can be used in early bootstrap files.

* lisp/emacs-lisp/easy-mmode.el (easy-mmode--mode-docstring):
Don't use string-empty-p because of bootstrap issues.

lisp/emacs-lisp/easy-mmode.el
lisp/emacs-lisp/subr-x.el
lisp/subr.el

index 6827faab208c2c375fa8dd963918e39baaba4ba3..21a29a722c3475ea00351ecbef68881780f61416 100644 (file)
@@ -114,7 +114,7 @@ it is disabled.")
         ;; line.
         (ensure-empty-lines)
         (while (and lines
-                    (string-empty-p (car lines)))
+                    (equal (car lines) ""))
           (pop lines))
         ;; Insert the doc string.
         (dolist (line lines)
index 7ad4e9ba2ab192f8ac8878dfb20c4ad520df75ef..abf85ab6c675719499eea2780c669a4c1ba9aec4 100644 (file)
@@ -320,12 +320,6 @@ than this function."
      (end (substring string (- (length string) length)))
      (t (substring string 0 length)))))
 
-;;;###autoload
-(defun string-lines (string &optional omit-nulls)
-  "Split STRING into a list of lines.
-If OMIT-NULLS, empty lines will be removed from the results."
-  (split-string string "\n" omit-nulls))
-
 (defun string-pad (string length &optional padding start)
   "Pad STRING to LENGTH using PADDING.
 If PADDING is nil, the space character is used.  If not nil, it
@@ -414,32 +408,6 @@ and return the value found in PLACE instead."
                ,(funcall setter val)
                ,val)))))
 
-;;;###autoload
-(defun ensure-empty-lines (&optional lines)
-  "Ensure that there are LINES number of empty lines before point.
-If LINES is nil or omitted, ensure that there is a single empty
-line before point.
-
-If called interactively, LINES is given by the prefix argument.
-
-If there are more than LINES empty lines before point, the number
-of empty lines is reduced to LINES.
-
-If point is not at the beginning of a line, a newline character
-is inserted before adjusting the number of empty lines."
-  (interactive "p")
-  (unless (bolp)
-    (insert "\n"))
-  (let ((lines (or lines 1))
-        (start (save-excursion
-                 (if (re-search-backward "[^\n]" nil t)
-                     (+ (point) 2)
-                   (point-min)))))
-    (cond
-     ((> (- (point) start) lines)
-      (delete-region (point) (- (point) (- (point) start lines))))
-     ((< (- (point) start) lines)
-      (insert (make-string (- lines (- (point) start)) ?\n))))))
 
 ;;;###autoload
 (defun string-pixel-width (string)
index 603acffea7a1d67b9f643dbdecc3ea5e6c547752..34f7bb6888a41aa08066d16958c30c07fbc358b3 100644 (file)
@@ -6619,4 +6619,35 @@ OBJECT if it is readable."
                    (forward-line 1)
                    (point))))
 
+(defun ensure-empty-lines (&optional lines)
+  "Ensure that there are LINES number of empty lines before point.
+If LINES is nil or omitted, ensure that there is a single empty
+line before point.
+
+If called interactively, LINES is given by the prefix argument.
+
+If there are more than LINES empty lines before point, the number
+of empty lines is reduced to LINES.
+
+If point is not at the beginning of a line, a newline character
+is inserted before adjusting the number of empty lines."
+  (interactive "p")
+  (unless (bolp)
+    (insert "\n"))
+  (let ((lines (or lines 1))
+        (start (save-excursion
+                 (if (re-search-backward "[^\n]" nil t)
+                     (+ (point) 2)
+                   (point-min)))))
+    (cond
+     ((> (- (point) start) lines)
+      (delete-region (point) (- (point) (- (point) start lines))))
+     ((< (- (point) start) lines)
+      (insert (make-string (- lines (- (point) start)) ?\n))))))
+
+(defun string-lines (string &optional omit-nulls)
+  "Split STRING into a list of lines.
+If OMIT-NULLS, empty lines will be removed from the results."
+  (split-string string "\n" omit-nulls))
+
 ;;; subr.el ends here