emacs-devel
[Top][All Lists]
Advanced

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

Re: Should Emacs provide a uuid function?


From: Eli Zaretskii
Subject: Re: Should Emacs provide a uuid function?
Date: Mon, 09 May 2011 18:50:08 +0300

> From: Stefan Monnier <address@hidden>
> Cc: address@hidden,  address@hidden,  address@hidden,  address@hidden
> Date: Mon, 09 May 2011 12:41:04 -0300
> 
> I was only making a general remark about your assertion that "using
> platform-dependent interfaces in Lisp is not the Emacs way, in my book".

Fair enough.  My wording was probably too general, sorry.  I have that
bad habit ;-)

> In this particular case, if some half gets written in C and the other in
> Elisp, the benefit of using Elisp might not be worth the trouble, indeed.

I was particularly trying to avoid proliferating the ugliness of the
kind we have in battery.el:

  (defcustom battery-status-function
    (cond ((and (eq system-type 'gnu/linux)
                (file-readable-p "/proc/apm"))
           'battery-linux-proc-apm)
          ((and (eq system-type 'gnu/linux)
                (file-directory-p "/proc/acpi/battery"))
           'battery-linux-proc-acpi)
          ((and (eq system-type 'gnu/linux)
                (file-directory-p "/sys/class/power_supply/")
                (directory-files "/sys/class/power_supply/" nil "BAT[0-9]$"))
           'battery-linux-sysfs)
          ((and (eq system-type 'darwin)
                (condition-case nil
                    (with-temp-buffer
                      (and (eq (call-process "pmset" nil t nil "-g" "ps") 0)
                           (> (buffer-size) 0)))
                  (error nil)))
           'battery-pmset)
          ((eq system-type 'windows-nt)
           'w32-battery-status))

I think it would be much cleaner to have 5 different implementations
in sysdep.c of the same primitive, than have the above followed by 4
different Lisp functions plus one primitive.



reply via email to

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