emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/compat 12e2d82a5a 4/4: compat-29: Add delete-line


From: ELPA Syncer
Subject: [elpa] externals/compat 12e2d82a5a 4/4: compat-29: Add delete-line
Date: Tue, 17 Jan 2023 17:57:27 -0500 (EST)

branch: externals/compat
commit 12e2d82a5a469aabadb1082678f7a33539779d8b
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    compat-29: Add delete-line
---
 NEWS.org        |  1 +
 compat-29.el    | 28 ++++++++++++++++------------
 compat-tests.el |  7 +++++++
 compat.texi     |  5 +++++
 4 files changed, 29 insertions(+), 12 deletions(-)

diff --git a/NEWS.org b/NEWS.org
index 31d5a52408..a8ba33d778 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -11,6 +11,7 @@
 - compat-29: Add ~plist-get~ generalized variable.
 - compat-29: Add ~plistp~.
 - compat-29: Add ~list-of-strings-p~.
+- compat-29: Add ~delete-line~.
 
 * Release of "Compat" Version 29.1.2.0
 
diff --git a/compat-29.el b/compat-29.el
index e84c628d96..9373c0ce62 100644
--- a/compat-29.el
+++ b/compat-29.el
@@ -84,18 +84,6 @@ Unibyte strings are converted to multibyte for comparison."
   (declare (pure t) (side-effect-free t))
   (eq t (compare-strings string1 0 nil string2 0 nil t)))
 
-(compat-defun list-of-strings-p (object) ;; <compat-tests:lists-of-strings-p>
-  "Return t if OBJECT is nil or a list of strings."
-  (declare (pure t) (side-effect-free t))
-  (while (and (consp object) (stringp (car object)))
-    (setq object (cdr object)))
-  (null object))
-
-(compat-defun plistp (object) ;; <compat-tests:plistp>
-  "Non-nil if and only if OBJECT is a valid plist."
-  (let ((len (proper-list-p object)))
-    (and len (zerop (% len 2)))))
-
 (compat-defun plist-get (plist prop &optional predicate) ;; 
<compat-tests:plist-get>
   "Handle optional argument PREDICATE."
   :explicit t
@@ -183,6 +171,22 @@ This function does not move point.  Also see 
`line-end-position'."
 
 ;;;; Defined in subr.el
 
+(compat-defun list-of-strings-p (object) ;; <compat-tests:lists-of-strings-p>
+  "Return t if OBJECT is nil or a list of strings."
+  (declare (pure t) (side-effect-free t))
+  (while (and (consp object) (stringp (car object)))
+    (setq object (cdr object)))
+  (null object))
+
+(compat-defun plistp (object) ;; <compat-tests:plistp>
+  "Non-nil if and only if OBJECT is a valid plist."
+  (let ((len (proper-list-p object)))
+    (and len (zerop (% len 2)))))
+
+(compat-defun delete-line () ;; <compat-tests:delete-line>
+  "Delete the current line."
+  (delete-region (pos-bol) (pos-bol 2)))
+
 (compat-defmacro with-memoization (place &rest code) ;; 
<compat-tests:with-memoization>
   "Return the value of CODE and stash it in PLACE.
 If PLACE's value is non-nil, then don't bother evaluating CODE
diff --git a/compat-tests.el b/compat-tests.el
index a15f3f5185..1b61570af8 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -906,6 +906,13 @@
     (should (string-prefix-p "compat" (symbol-name (gensym "compat"))))
     (should-equal gensym-counter (+ orig 3))))
 
+(ert-deftest delete-line ()
+  (with-temp-buffer
+    (insert "first\nsecond\nthird\n")
+    (goto-char 7)
+    (delete-line)
+    (should (equal (buffer-string) "first\nthird\n"))))
+
 (ert-deftest list-of-strings-p ()
   (should-not (list-of-strings-p 1))
   (should (list-of-strings-p nil))
diff --git a/compat.texi b/compat.texi
index 6aec7f40ca..bb86925125 100644
--- a/compat.texi
+++ b/compat.texi
@@ -2012,6 +2012,11 @@ provided by Compat. Note that due to upstream changes, 
it might happen
 that there will be the need for changes, so use these functions with
 care.
 
+@c based on lisp/subr.el
+@defun delete-line
+Delete the current line.
+@end defun
+
 @c based on lisp/subr.el
 @defun list-of-strings-p object
 Return @code{t} if @var{object} is @code{nil} or a list of strings.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]