summaryrefslogtreecommitdiff
path: root/lisp/subr.el
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2018-01-21 23:45:43 +0200
committerNoam Postavsky <npostavs@gmail.com>2018-08-04 11:37:39 -0400
commitcc233365a925dcf9fa7270630819f2e6e75280da (patch)
tree7d3ecdf237cfe9a014d35034bc32cd1ec55ebfff /lisp/subr.el
parentf0b8e64fb7720a9376bde80cc59fe37b0df83b9d (diff)
downloademacs-cc233365a925dcf9fa7270630819f2e6e75280da.tar.gz
New function read-answer (Bug#31782)
* lisp/emacs-lisp/map-ynp.el (read-answer-short): New defcustom. (read-answer): New function. * lisp/subr.el (assoc-delete-all): New function. * etc/NEWS: Announce them. * lisp/dired.el (dired-delete-file): Use read-answer. (dired--yes-no-all-quit-help): Remove function. (dired-delete-help): Remove defconst. (backported from master, "New function read-answer (bug#30073)" and "Respect non-saved value of `read-short-answer' (Bug#31782)")
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 f8ac70edefa..7582b6cdb85 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.