[gnu.emacs] help w/ defun return value

msb@hosmsb.ATT.COM (Mike Balenger) (01/18/90)

Why does this defun return nil instead of the value of buf-string?

================================================================

(defun expand-month (month) "Expand MONTH into full name of month"
  (interactive "sExpand what month? ")
  (let ((buf-string)
	(case-fold-search t)
	(case-replace t))
    (set-buffer (generate-new-buffer " *expand-month*"))
    (insert month)
    (delete-region (min 4 (point-max)) (point-max)) ;keep 3 characters at most
    (goto-char (point-min))

    ;; plump 'em up
    (replace-string "jan" "january")
    (replace-string "feb" "february")
    (replace-string "mar" "march")
    (replace-string "apr" "april")
    (replace-string "may" "may")
    (replace-string "jun" "june")
    (replace-string "jul" "july")
    (replace-string "aug" "august")
    (replace-string "sep" "september")
    (replace-string "oct" "october")
    (replace-string "nov" "november")
    (replace-string "dec" "december")

    (setq buf-string (buffer-string))	;hang onto the results
    (kill-buffer (buffer-name))		;clean up
    buf-string))			;return results



--
----------------------------------------------------------------------
<cute quote>            Michael S. Balenger             (201) 949-8789
<cute disclaimer>       AT&T Bell Labs
                        Room 1L-405
msb@ho5cad.att.com      Crawfords Corner Road
att!ho5cad!msb          Holmdel, NJ   07733

Duchier-Denys@cs.yale.edu (Denys Duchier) (01/18/90)

In article <MSB.90Jan17162225@hosmsb.ATT.COM>, msb@hosmsb (Mike Balenger) writes:
> 
> Why does this defun return nil instead of the value of buf-string?

It doesn't! Perhaps you made buf-string buffer local.

--Denys