unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Fixing numerous `message' bugs..
@ 2007-12-06  0:14 D. Goel
  2007-12-06 10:56 ` David Kastrup
                   ` (2 more replies)
  0 siblings, 3 replies; 34+ messages in thread
From: D. Goel @ 2007-12-06  0:14 UTC (permalink / raw)
  To: emacs-devel, Dave Goel


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 deego3@gmail.com, 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)

^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2007-12-10 23:02 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-06  0:14 Fixing numerous `message' bugs D. Goel
2007-12-06 10:56 ` David Kastrup
2007-12-06 14:36   ` Dave Goel
2007-12-06 19:26     ` Glenn Morris
2007-12-06 19:34       ` Dave Goel
2007-12-06 20:21       ` Johan Bockgård
2007-12-07  5:28         ` Glenn Morris
2007-12-07 15:52           ` Dave Goel
2007-12-06 15:53 ` Stefan Monnier
2007-12-06 16:01   ` Dave Goel
2007-12-06 16:49     ` Stefan Monnier
2007-12-06 16:58       ` David Kastrup
2007-12-06 17:19         ` David Kastrup
2007-12-07 17:17         ` Richard Stallman
2007-12-07 17:37           ` David Kastrup
2007-12-07 17:17         ` Richard Stallman
2007-12-07 17:18         ` Richard Stallman
2007-12-07 17:24           ` David Kastrup
2007-12-07 18:00             ` Dave Goel
2007-12-07 18:38               ` Stefan Monnier
2007-12-08  0:56                 ` Glenn Morris
2007-12-08  2:21                   ` Stefan Monnier
2007-12-08 10:55                     ` David Kastrup
2007-12-08 19:15                 ` Richard Stallman
2007-12-10 17:41                   ` Dave Goel
2007-12-10 18:04                     ` Jason Rumney
2007-12-10 19:05                       ` Dave Goel
2007-12-10 19:56                         ` Andreas Schwab
2007-12-10 20:31                           ` Dave Goel
2007-12-10 21:19                             ` David Kastrup
2007-12-10 22:44                               ` Dave Goel
2007-12-10 23:02                                 ` David Kastrup
2007-12-08 19:15             ` Richard Stallman
2007-12-07 17:18 ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).