[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fixing numerous `message' bugs..
From: |
D . Goel |
Subject: |
Fixing numerous `message' bugs.. |
Date: |
Wed, 05 Dec 2007 19:14:47 -0500 |
The emacs source code is littered with thousands of buggy calls to
`message'. Here is an example of such a structure:
(message
(if foo
nil
(if bar "abc"
(concat "def" filename))))
This example will lead to an error if the filename has %s in it.
At the same time, the simplistic fix of replacing (message by (message
"%s" would be incorrect because if foo is true, the coder wanted
(message nil), and not (message "%s" nil).
The appropriate fix to this would be
(let ((arg ((rest-of-the-code))))
(if (null arg)
(message nil)
(message "%s" arg)))
^^^ This fix will have to be repeated thousands of time as I go
through the source code.
It would rather make much more sense to code this fix into a little
function:
(defun msg (arg)
(if (null arg)
(message nil)
(message (format "%s" arg))))
Then, I simply have to replace buggy calls to `message' with `msg'
----
.. this new function can be further improved to be more general, so
that develepors can simply start preferring the new msg if they like -
(defun msg (&rest args)
(cond
((null args) (message nil))
((null (car args) (message nil)))
((= (length args) 1) (message "%s" (car args)))
(apply 'message args)))
I would like to add `msg' to simple.el, and replace buggy `message'
calls by `msg'. Can you please confirm or comment?
((My correct email is now address@hidden, please cc there as well;
emacs-devel seems to send those messages to spam, so I am emailing
from my older gnufans address. If an admin sees this, can you please
unblock my other email to emacs-devel sent earlier today about a
bugfix I made to find-func.el? thanks.)
- deego (Deepak Goel)
- Fixing numerous `message' bugs..,
D . Goel <=
- Re: Fixing numerous `message' bugs.., David Kastrup, 2007/12/06
- Re: Fixing numerous `message' bugs.., Dave Goel, 2007/12/06
- Re: Fixing numerous `message' bugs.., Glenn Morris, 2007/12/06
- Re: Fixing numerous `message' bugs.., Dave Goel, 2007/12/06
- Re: Fixing numerous `message' bugs.., Johan Bockgård, 2007/12/06
- Re: Fixing numerous `message' bugs.., Glenn Morris, 2007/12/07
- Re: Fixing numerous `message' bugs.., Dave Goel, 2007/12/07
Re: Fixing numerous `message' bugs.., Stefan Monnier, 2007/12/06