From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Bozhidar Batsov Newsgroups: gmane.emacs.devel Subject: Re: trunk r115036: * lisp/progmodes/ruby-mode.el (ruby-mode-set-encoding): Use Date: Fri, 8 Nov 2013 21:48:19 +0200 Message-ID: References: <87zjpehj1t.fsf@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a1133357605b4f304eaafaa89 X-Trace: ger.gmane.org 1383940847 18122 80.91.229.3 (8 Nov 2013 20:00:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 8 Nov 2013 20:00:47 +0000 (UTC) Cc: emacs-devel , Dmitry Gutov To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 08 21:00:50 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VesEb-0007N2-4G for ged-emacs-devel@m.gmane.org; Fri, 08 Nov 2013 21:00:49 +0100 Original-Received: from localhost ([::1]:48596 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VesEa-0000QJ-LQ for ged-emacs-devel@m.gmane.org; Fri, 08 Nov 2013 15:00:48 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:50112) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VesAq-0006kR-Ds for emacs-devel@gnu.org; Fri, 08 Nov 2013 15:00:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ves2W-0002YE-Bd for emacs-devel@gnu.org; Fri, 08 Nov 2013 14:51:55 -0500 Original-Received: from mail-oa0-x229.google.com ([2607:f8b0:4003:c02::229]:34627) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ves2W-0002Y8-6l for emacs-devel@gnu.org; Fri, 08 Nov 2013 14:48:20 -0500 Original-Received: by mail-oa0-f41.google.com with SMTP id g12so1259923oah.28 for ; Fri, 08 Nov 2013 11:48:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=86alaacyoFROZdGKBRMiLvpUsSLz3ULFwzr9w14timg=; b=epX7nK5AtllRF/c0r+n3gkZsNwrRUl0W/eCG0TZpyL1SvbJJ7ZRIpjkMSFE6TV6t4u wdj4CrkT9TEAROm1ixR3Y39h1d+9KkcFiXJZMgCq4qLDLWAXKGXFCuQIUSaJrloxC9MP k0vUPz6GglFixmWygrvHA+JGIWH6ac8A+tUBuK7F6eWGCvQfEIWOcLleBm4/l0JLIj+i hWIZr+39gENyNqzK29bkCXIW0YEkHDDwQEOkogBgVA6MNiCYeyuR4IiPHFNCPUrkeQ7Q FOd475+RHpKzGR3oWGkXbsh7Vs2OsmZo1/QwDnvh59ejdYXQTn+qnEp3lwojHINVCVsX IISg== X-Received: by 10.60.70.209 with SMTP id o17mr1588584oeu.65.1383940099517; Fri, 08 Nov 2013 11:48:19 -0800 (PST) Original-Received: by 10.76.21.173 with HTTP; Fri, 8 Nov 2013 11:48:19 -0800 (PST) In-Reply-To: X-Google-Sender-Auth: a749857db9YeiqyxWgx-cn4_5uw X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c02::229 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:165080 Archived-At: --001a1133357605b4f304eaafaa89 Content-Type: text/plain; charset=UTF-8 So you're saying I should use `cond', right? I was under the impression that `case' is preferable if you'll be always checking the value of the same expression. On 8 November 2013 21:04, Stefan Monnier wrote: > >> + (case ruby-encoding-magic-comment-style > >> + ('ruby "# coding: %s") > >> + ('emacs "# -*- coding: %s -*-") > >> + ('custom > ruby-custom-encoding-magic-comment-template)))) > > This will use the first branch if ruby-encoding-magic-comment-style is > `quote' (and the two other branches will also check to see if > ruby-encoding-magic-comment-style is equal to `quote' tho that check > will be redundant). > > > Stefan > --001a1133357605b4f304eaafaa89 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
So you're saying I should use `cond', right? I was= under the impression that `case' is preferable if you'll be always= checking the value of the same expression.


On 8 November 2013 21:04, Stefan Monnier= <monnier@iro.umontreal.ca> wrote:
>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(case ruby-encoding-mag= ic-comment-style
>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0('ruby "# coding: %s"= ;)
>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0('emacs "# -*- coding: %s= -*-")
>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0('custom ruby-custom-encoding-= magic-comment-template))))

This will use the first branch if ruby-encoding-magic-comment-style i= s
`quote' (and the two other branches will also check to see if
ruby-encoding-magic-comment-style is equal to `quote' tho that check will be redundant).


=C2=A0 =C2=A0 =C2=A0 =C2=A0 Stefan

--001a1133357605b4f304eaafaa89--