From: morioka Date: Thu, 25 Sep 1997 16:36:10 +0000 (+0000) Subject: (butlast): New function; imported from cl.el. X-Git-Tag: semi-0_115~7 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=f81a5bb7c859f5b0724df1dd0cb05e64886a16a1;p=elisp%2Fsemi.git (butlast): New function; imported from cl.el. (nbutlast): New function; imported from cl.el. --- diff --git a/mime-def.el b/mime-def.el index 3e71f9a..b2df95e 100644 --- a/mime-def.el +++ b/mime-def.el @@ -3,7 +3,7 @@ ;; Copyright (C) 1995,1996,1997 Free Software Foundation, Inc. ;; Author: MORIOKA Tomohiko -;; Version: $Id: mime-def.el,v 0.64 1997-09-25 13:08:33 morioka Exp $ +;; Version: $Id: mime-def.el,v 0.65 1997-09-25 16:36:10 morioka Exp $ ;; Keywords: definition, MIME, multimedia, mail, news ;; This file is part of SEMI (SEMI is Emacs MIME Interfaces). @@ -27,6 +27,20 @@ (require 'emu) +(defun-maybe butlast (x &optional n) + "Returns a copy of LIST with the last N elements removed." + (if (and n (<= n 0)) x + (nbutlast (copy-sequence x) n))) + +(defun-maybe nbutlast (x &optional n) + "Modifies LIST to remove the last N elements." + (let ((m (length x))) + (or n (setq n 1)) + (and (< n m) + (progn + (if (> n 0) (setcdr (nthcdr (- (1- m) n) x) nil)) + x)))) + (defconst semi-version-name "Hinomiko") (autoload 'mule-caesar-region "mule-caesar"