From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Joost Kremers Newsgroups: gmane.emacs.help Subject: Re: pcase and minus-sign Date: Wed, 30 Nov 2016 13:38:25 +0100 Message-ID: <87r35tb0se.fsf@fastmail.fm> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1480509567 30935 195.159.176.226 (30 Nov 2016 12:39:27 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 30 Nov 2016 12:39:27 +0000 (UTC) User-Agent: mu4e 0.9.17; emacs 25.1.50.3 Cc: Help Gnu Emacs mailing list To: Andreas =?utf-8?Q?R=C3=B6hler?= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Nov 30 13:39:22 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cC4AS-0007S3-Cn for geh-help-gnu-emacs@m.gmane.org; Wed, 30 Nov 2016 13:39:20 +0100 Original-Received: from localhost ([::1]:43623 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cC4AW-0002zX-BV for geh-help-gnu-emacs@m.gmane.org; Wed, 30 Nov 2016 07:39:24 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33088) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cC4A4-0002z3-CQ for help-gnu-emacs@gnu.org; Wed, 30 Nov 2016 07:38:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cC4A1-0000v6-Pc for help-gnu-emacs@gnu.org; Wed, 30 Nov 2016 07:38:56 -0500 Original-Received: from out5-smtp.messagingengine.com ([66.111.4.29]:52808) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cC4A1-0000uJ-KS for help-gnu-emacs@gnu.org; Wed, 30 Nov 2016 07:38:53 -0500 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 1887B20388; Wed, 30 Nov 2016 07:38:50 -0500 (EST) Original-Received: from frontend2 ([10.202.2.161]) by compute5.internal (MEProxy); Wed, 30 Nov 2016 07:38:50 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.fm; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=10f49Ue+Mj7My5Y poaOrGLmz0D8=; b=Ignn7Tiq8ums1iUvVFrZHs6y9pOXjKL3zb/fQDtrT1MnVMz BlnQtMMC4F+d9PBuPJV1pMoFnHYCzD/xuw6oR2UGZfbLox1AfbezGe8jLMjNcmoR MAU+jUm0WUCjk0jF3/eu87WOwCleP9A3a2Kcirfp7AMlUOxlZUN3KfihPBrE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= smtpout; bh=10f49Ue+Mj7My5YpoaOrGLmz0D8=; b=tKZyQRBQhYswuSfj185K HbwSuNhH3MUoLo/E/v77ZmuZhV+Nb6JU00LFQVj2UetF9itr+fwra6GJMT/cuNnN GvR80PL1Eg1G14OG6yEGn+8/Md4ml+FsPw79w8hzBsnJ1ziW06Tyjolk1t2tzwb5 ijBGcKAu8V0xWhYS1EIxto4= X-ME-Sender: X-Sasl-enc: hlcCVGs/r8YmdnSkYqRQamfndH1KdNMebY+PbyYhxLat 1480509529 Original-Received: from IdeaPad.messagingengine.com (x4d0aed8b.dyn.telefonica.de [77.10.237.139]) by mail.messagingengine.com (Postfix) with ESMTPA id 687DC24161; Wed, 30 Nov 2016 07:38:49 -0500 (EST) In-reply-to: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.29 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:111830 Archived-At: On Wed, Nov 30 2016, Andreas Röhler wrote: > Hi, > > see code below. With numerical argument "1", first pattern is > matched as > expected. > > However without arg the minus is matched - the second pattern, > not the > default "_" at last. > > Any explanation? > > (defun foo (arg) > (interactive "P") > (pcase arg > (1 (message "%s" "ARG was `1'")) > (- (message "%s" "ARG was minus-sign")) > (_ (message "%s" "ARG not minus-sign")))) Probably because - is a symbol and hence a variable. It works if you quote it: (defun foo (arg) (interactive "P") (pcase arg (1 (message "%s" "ARG was `1'")) ('- (message "%s" "ARG was minus-sign")) (_ (message "%s" "ARG not minus-sign")))) -- Joost Kremers Life has its moments