[Top][All Lists]

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

Re: insert-string

From: Pavel Janík
Subject: Re: insert-string
Date: Sat, 01 Dec 2001 16:57:26 +0100
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.1.50 (i386-suse-linux-gnu)

   From: Richard Stallman <address@hidden>
   Date: Fri, 30 Nov 2001 10:01:18 -0700 (MST)

   > I see one clear problem with this patch: insert-string must continue
   > to do what it does now.  User Lisp code surely uses it, and possibly
   > with non-string arguments.  Making it equivalent to insert is sure to
   > cause problems.  So please reimplement it with the same old
   > functionality.  An implementation in Lisp would be fine.

We (me and Stefan) thought that simple defalias is enough, because no part
of Emacs did used it with non-string argument. If you think it is needed,
I will implement in Lisp.

   > We may find that some of the other functions in mlsupport are
   > sometimes used.

So should I move mlsupport.el to lisp/obsolete instead of removing it?
I think it would be then easier to move them to subr.el as you write in
the next sentence.

   > If so, we will want to add the specific functions back, perhaps in
   > subr.el.

What about this implementation? It is a bit different in its internals, but
has the same functionality for the user. Strings and numbers are inserted
as before. Only error messages from it are a bit different. E.g.:

(insert-string 5.1)

original: (wrong-type-argument stringp 56.7)
new: (wrong-type-argument char-or-string-p 5.1)

But I think that this is enough. What is your opinion here?

(defun insert-string (&rest args)
  "Mocklisp-compatibility insert function.
Like the function `insert' except that any argument that is a number
is converted into a string by expressing it in decimal."
  (let ((temp args))
    (while temp
      (if (integerp (car temp))
          (insert (format "%d" (car temp)))
        (insert (car temp)))
      (setq temp (cdr temp)))))
Pavel Janík

Never take me serious when I rant about C++ ;)
                  -- Hubert Mantel

reply via email to

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