help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: configuring emacs as a programmer's editor


From: Le Wang
Subject: Re: configuring emacs as a programmer's editor
Date: 30 Jun 2006 21:20:48 -0700
User-agent: G2/0.2

Eli Zaretskii wrote:
> > From: "Le Wang" <l26wang@gmail.com>
> > Date: 30 Jun 2006 01:02:40 -0700
> >
> > (if (string-match "win" (prin1-to-string system-type))
>                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> It's much easier to use (symbol-name system-type).  That's if you
> really need the string representation of system-type; you could simply
> use (eq system-type 'windows-nt) or (memq system-type '(windows-nt cygwin))
> instead.

Very good point.  I didn't know about `symbol-name'.  I suggested
regular expression here because I use it in a macro, so the slowdown
only happens at compile time.  But I didn't want to scare Ted off with
the slightly more brackety version. ;-)

(defmacro Init-system-type-load (&rest args)
  "Evaluates to appropriate form based on `system-type'

Takes args in this way

  (Init-system-load (\"regex\" (form1a) (form1b)) (\"string2\"
(forms2a)))

t will match anything."
  (dolist (arg args)
    (when (or (eq (car arg) t)
              (string-match (car arg) (symbol-name system-type)))
      (return (cons 'progn (cdr arg))))))

--
Le



reply via email to

[Prev in Thread] Current Thread [Next in Thread]