Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tlug] Emacs Lisp file-exists usage



Although I tend to agree with Curt, I'll assume there's some reason
you don't want to mess with the local MTA.

Charles Muller writes:

  (if (file-exists-p "/mail-u-tokyo")
      (setq mew-smtp-port "25")
    (setq mew-smtp-server "mail.l.u-tokyo.ac.jp"))

`if' evidently works differently from what you think.  The form is

  (if TEST THEN-FORM ELSE-FORMS...)

THEN-FORM is a single form, so you need a `progn'.  Alternatively, use
`when' instead of `if', or a single `setq'

  (if (file-exists-p "/mail-u-tokyo")
      (setq mew-smtp-port "25"
            mew-smtp-server "mail.l.u-tokyo.ac.jp"))

or

  (cond ((file-exists-p "/mail-u-tokyo")
         (setq mew-smtp-port "25")
         (setq mew-smtp-server "mail.l.u-tokyo.ac.jp"))
        ((file-exists-p "/mail-home")
         (setq mew-smtp-port "587")
         (setq mew-smtp-server "mail.so-net.ne.jp")))


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links