From xemacs-m  Sun Feb 16 19:07:29 1997
Received: from jagor.srce.hr (hniksic@jagor.srce.hr [161.53.2.130])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id TAA14759
	for <xemacs-beta@xemacs.org>; Sun, 16 Feb 1997 19:07:28 -0600 (CST)
Received: (from hniksic@localhost)
          by jagor.srce.hr (8.8.5/8.8.4)
	  id CAA16821; Mon, 17 Feb 1997 02:07:27 +0100 (MET)
Sender: hniksic@public.srce.hr
To: xemacs-beta@xemacs.org
Subject: [patch] edmacro bug
X-URL: ftp://gnjilux.cc.fer.hr/pub/unix/util/wget/
X-Attribution: Hrv
X-Face: &}4JQk=L;e.~x+|eo]#DGk@x3~ed!.~lZ}YQcYb7f[WL9L'Z*+OyA\nAEL1M(".[qvI#a2E
 6WYI5>>e7'@_)3Ol9p|Nn2wNa/;~06jL*B%tTcn/XvhAu7qeES0\|MF%$;sI#yn1+y"
From: Hrvoje Niksic <hniksic@srce.hr>
Date: 17 Feb 1997 02:07:26 +0100
Message-ID: <kig3euwp7e9.fsf@jagor.srce.hr>
Lines: 139
X-Mailer: Gnus v5.4.13/XEmacs 19.14

edmacro would bug out when creating a new `C-x e' macro.  Here's a
patch (the patch is not that big, it's mostly the indentation that is
patched :-)):

--- /home/hniksic/work/xemacs-20.1-b1/lisp/ChangeLog.orig	Mon Feb 17 02:02:06 1997
+++ /home/hniksic/work/xemacs-20.1-b1/lisp/ChangeLog	Mon Feb 17 02:02:08 1997
@@ -1,3 +1,8 @@
+Mon Feb 17 02:01:27 1997  Hrvoje Niksic  <hniksic@bjesomar.srce.hr>
+
+	* utils/edmacro.el (edmacro-format-keys): Would bug out on empty
+ 	macro.
+
 Sat Feb 15 13:58:14 1997  Kyle Jones  <kyle_jones@wonderworks.com>
 
 	* packages/info.el: Don't call switch-to-buffer if the Info frame
--- /home/hniksic/work/xemacs-20.1-b1/lisp/utils/edmacro.el.orig	Mon Feb 17 02:01:23 1997
+++ /home/hniksic/work/xemacs-20.1-b1/lisp/utils/edmacro.el	Mon Feb 17 02:04:03 1997
@@ -590,61 +590,63 @@
     res))
 
 (defun edmacro-format-keys (macro &optional verbose)
-  (let ((cnt 0)
-	(res ""))
-    ;; XEmacs:
-    ;; If we're dealing with events, convert them to symbols first.
-    (and (fboundp 'events-to-keys)
-	 (eventp (aref macro 0))
-	 (setq macro (events-to-keys macro t)))
+  (if (zerop (length macro))
+      ""
+    (let ((cnt 0)
+	  (res ""))
+      ;; XEmacs:
+      ;; If we're dealing with events, convert them to symbols first.
+      (and (fboundp 'events-to-keys)
+	   (eventp (aref macro 0))
+	   (setq macro (events-to-keys macro t)))
 
-    ;; I'm not sure I understand the original code, but this seems to
-    ;; work.
-    (and (eq verbose 1)
-	 (setq verbose nil))
+      ;; I'm not sure I understand the original code, but this seems to
+      ;; work.
+      (and (eq verbose 1)
+	   (setq verbose nil))
 
-    ;; Oh come on -- I want a list!  Much easier to process...
-    (setq macro (mapcar 'identity macro))
+      ;; Oh come on -- I want a list!  Much easier to process...
+      (setq macro (mapcar 'identity macro))
 
-    (while macro
-      (let (key lookup (times 1) self-insert-p)
-	(loop do
-	      (setq key (nconc key (list (car macro)))
-		    macro (cdr macro)
-		    lookup (lookup-key global-map (mapvector 'identity key)))
-	      while
-	      (and lookup (not (commandp lookup))))
-	(if (and (eq lookup 'self-insert-command)
-		 (= (length key) 1)
-		 (not (memq (car key)
-			    '(?\  ?\r ?\n space return linefeed tab))))
-	    (while (and (< (length key) 23)
-			(eq (lookup-key global-map (car macro))
-			    'self-insert-command)
-			(not (memq (car macro)
-				   '(?\  ?\r ?\n space return linefeed tab))))
-	      (setq key (nconc key (list (car macro)))
-		    macro (cdr macro)
-		    self-insert-p t))
-	  (while (edmacro-seq-equal key macro)
-	    (setq macro (nthcdr (length key) macro))
-	    (incf times)))
-	(if (or self-insert-p
-		(null (cdr key))
-		(= times 1))
-	    (callf concat res (edmacro-format-1 key (if verbose lookup
-						      nil)
-						times self-insert-p)
-		   (if verbose "\n" " "))
-	  (loop repeat times
-		do
-		(callf concat res
-		  (edmacro-format-1 key (if verbose lookup
-					  nil)
-				    1 self-insert-p)
-		       (if verbose "\n" " "))))
-	))
-      res))
+      (while macro
+	(let (key lookup (times 1) self-insert-p)
+	  (loop do
+		(setq key (nconc key (list (car macro)))
+		      macro (cdr macro)
+		      lookup (lookup-key global-map (mapvector 'identity key)))
+		while
+		(and lookup (not (commandp lookup))))
+	  (if (and (eq lookup 'self-insert-command)
+		   (= (length key) 1)
+		   (not (memq (car key)
+			      '(?\  ?\r ?\n space return linefeed tab))))
+	      (while (and (< (length key) 23)
+			  (eq (lookup-key global-map (car macro))
+			      'self-insert-command)
+			  (not (memq (car macro)
+				     '(?\  ?\r ?\n space return linefeed tab))))
+		(setq key (nconc key (list (car macro)))
+		      macro (cdr macro)
+		      self-insert-p t))
+	    (while (edmacro-seq-equal key macro)
+	      (setq macro (nthcdr (length key) macro))
+	      (incf times)))
+	  (if (or self-insert-p
+		  (null (cdr key))
+		  (= times 1))
+	      (callf concat res (edmacro-format-1 key (if verbose lookup
+							nil)
+						  times self-insert-p)
+		     (if verbose "\n" " "))
+	    (loop repeat times
+		  do
+		  (callf concat res
+		    (edmacro-format-1 key (if verbose lookup
+					    nil)
+				      1 self-insert-p)
+		    (if verbose "\n" " "))))
+	  ))
+      res)))
 
 (defun edmacro-seq-equal (seq1 seq2)
   (while (and seq1 seq2

-- 
Hrvoje Niksic <hniksic@srce.hr> | Student at FER Zagreb, Croatia
--------------------------------+--------------------------------
* Q: What is an experienced Emacs user?
* A: A person who wishes that the terminal had pedals.

