From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Should Emacs provide a uuid function? Date: Mon, 09 May 2011 14:03:44 -0300 Message-ID: References: <87ipu3v0ru.fsf@stupidchicken.com> <871v0raqub.fsf@uwakimon.sk.tsukuba.ac.jp> <42A7030B-DE0C-4CCA-A768-B82BE70C42F9@raeburn.org> <87liyynm6a.fsf@stupidchicken.com> <83aaewjq1x.fsf@gnu.org> <83vcxkhqqj.fsf@gnu.org> <83liyfj2kv.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1304960639 6462 80.91.229.12 (9 May 2011 17:03:59 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 9 May 2011 17:03:59 +0000 (UTC) Cc: cyd@stupidchicken.com, raeburn@raeburn.org, sdl.web@gmail.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 09 19:03:54 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QJTsA-0005qg-7E for ged-emacs-devel@m.gmane.org; Mon, 09 May 2011 19:03:54 +0200 Original-Received: from localhost ([::1]:51750 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QJTs9-0001JR-Mq for ged-emacs-devel@m.gmane.org; Mon, 09 May 2011 13:03:53 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:35478) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QJTs6-0001HM-Bt for emacs-devel@gnu.org; Mon, 09 May 2011 13:03:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QJTs5-0000YY-Eq for emacs-devel@gnu.org; Mon, 09 May 2011 13:03:50 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]:54846) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QJTs5-0000YU-DK for emacs-devel@gnu.org; Mon, 09 May 2011 13:03:49 -0400 Original-Received: from 213-159-126-200.fibertel.com.ar ([200.126.159.213]:39533 helo=ceviche.home) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1QJTs3-0000oe-RC; Mon, 09 May 2011 13:03:48 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 35FBE66152; Mon, 9 May 2011 14:03:44 -0300 (ART) In-Reply-To: <83liyfj2kv.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 09 May 2011 18:50:08 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.10 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:139282 Archived-At: > 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 don't mind this kind of dispatch table, personally. > 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. I don't find the dispatch table worse than the sysdep.c code, personally. Stefan