summaryrefslogtreecommitdiff
path: root/lisp/subr.el
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2018-01-21 23:45:43 +0200
committerJuri Linkov <juri@linkov.net>2018-01-21 23:45:43 +0200
commitafba4ccb8b8c6347a44efd0b9f4d6fb85756f85b (patch)
tree42b97dca576f2020dc18a33ccabcc7ff1ddf2c93 /lisp/subr.el
parent9ae0e4aa1aee3d7ff2546e34aa83536f72f8c06a (diff)
downloademacs-afba4ccb8b8c6347a44efd0b9f4d6fb85756f85b.tar.gz
New function read-answer (bug#30073)
* lisp/emacs-lisp/map-ynp.el (read-answer): New function. (read-answer-short): New defcustom. * lisp/dired.el (dired-delete-file): Use read-answer. (dired--yes-no-all-quit-help): Remove function. (dired-delete-help): Remove defconst. * lisp/subr.el (assoc-delete-all): New function.
Diffstat (limited to 'lisp/subr.el')
-rw-r--r--lisp/subr.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index 46cf5a34ccc..092850a44d9 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -705,6 +705,21 @@ Non-strings in LIST are ignored."
(setq list (cdr list)))
list)
+(defun assoc-delete-all (key alist)
+ "Delete from ALIST all elements whose car is `equal' to KEY.
+Return the modified alist.
+Elements of ALIST that are not conses are ignored."
+ (while (and (consp (car alist))
+ (equal (car (car alist)) key))
+ (setq alist (cdr alist)))
+ (let ((tail alist) tail-cdr)
+ (while (setq tail-cdr (cdr tail))
+ (if (and (consp (car tail-cdr))
+ (equal (car (car tail-cdr)) key))
+ (setcdr tail (cdr tail-cdr))
+ (setq tail tail-cdr))))
+ alist)
+
(defun assq-delete-all (key alist)
"Delete from ALIST all elements whose car is `eq' to KEY.
Return the modified alist.