;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
;;; Code:
(defun del-alist (key alist)
"Delete an element whose car equals KEY from ALIST.
Return the modified ALIST."
- (if (equal key (car (car alist)))
- (cdr alist)
- (let ((pr alist)
- (r (cdr alist)))
- (catch 'tag
- (while (not (null r))
- (if (equal key (car (car r)))
- (progn
- (rplacd pr (cdr r))
- (throw 'tag alist)))
- (setq pr r)
- (setq r (cdr r)))
- alist))))
+ (let ((pair (assoc key alist)))
+ (if pair
+ (delq pair alist)
+ alist)))
;;;###autoload
(defun set-alist (symbol key value)