changeset 51395:ef9e066bc6f2

(lm-synopsis): Use relative filenames correctly. Show the synopsis to the user when appropriate. Do not kill buffers that were created outside `lm-synopsis'.
author Lute Kamstra <lute@gnu.org>
date Mon, 02 Jun 2003 10:21:13 +0000
parents d1641e2dfc5b
children 0637ff21efd1
files lisp/emacs-lisp/lisp-mnt.el
diffstat 1 files changed, 14 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emacs-lisp/lisp-mnt.el	Mon Jun 02 00:54:20 2003 +0000
+++ b/lisp/emacs-lisp/lisp-mnt.el	Mon Jun 02 10:21:13 2003 +0000
@@ -566,26 +566,21 @@
     (read-file-name "Synopsis for (file or dir): ")))
 
   (if (and file (file-directory-p file))
-      (with-temp-buffer
-	(mapcar
-	 (lambda (f)
-	   (if (string-match "\\.el\\'" f)
-	       (let ((syn (lm-synopsis f)))
-		 (if syn
-		     (progn
-		       (insert f ":")
-		       (lm-insert-at-column lm-comment-column syn "\n"))
-		   (when showall
-		     (insert f ":")
-		     (lm-insert-at-column lm-comment-column "NA\n"))))))
-	 (directory-files file)))
+      (with-output-to-temp-buffer "*Synopsis*"
+        (set-buffer standard-output)
+        (dolist (f (directory-files file nil ".*\\.el\\'"))
+          (let ((syn (lm-synopsis (expand-file-name f file))))
+            (when (or syn showall)
+              (insert f ":")
+              (lm-insert-at-column lm-comment-column (or syn "NA") "\n")))))
     (save-excursion
-      (if file
-	  (find-file file))
-      (prog1
-	  (lm-summary)
-	(if file
-	    (kill-buffer (current-buffer)))))))
+      (let ((must-kill (and file (not (get-file-buffer file)))))
+        (when file (find-file file))
+        (prog1
+            (if (interactive-p)
+                (message "%s" (lm-summary))
+              (lm-summary))
+          (when must-kill (kill-buffer (current-buffer))))))))
 
 (eval-when-compile (defvar report-emacs-bug-address))