From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Patrick Mahan Newsgroups: gmane.emacs.help Subject: Re: Specifying a file in auto-mode-alist Date: Fri, 23 Apr 2021 15:14:50 -0700 Message-ID: References: <87y2d8d97a.fsf@telefonica.net> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35602"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: Stefan Monnier Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Apr 24 00:16:03 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1la45i-00098s-Ig for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 24 Apr 2021 00:16:02 +0200 Original-Received: from localhost ([::1]:49814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1la45h-0004HN-Lk for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 23 Apr 2021 18:16:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1la44m-00044u-SF for help-gnu-emacs@gnu.org; Fri, 23 Apr 2021 18:15:04 -0400 Original-Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]:35644) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1la44k-0006oq-Ti for help-gnu-emacs@gnu.org; Fri, 23 Apr 2021 18:15:04 -0400 Original-Received: by mail-lj1-x232.google.com with SMTP id a13so3423897ljp.2 for ; Fri, 23 Apr 2021 15:15:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/DeEvqs6LHCwkUpxSURErdkCTHL1IC7aSJHrtYhCFmo=; b=kX2IcYB+vkE97ziPw6WKfrSJflF5K81Lybrttj6/zfXcEPaTfCMjmoKGThMC3rQdFC UObESFkQvY7ik6rJn49SRyH1I6p3nnDccmjJNFpSjV4ELLopehCp9zEN1LJlQX/f84CE ergVnM6HpSfMrg1trO9hfVLTKcO7vbw6NdC16SKwlcyCP+IPBZdfm5SjtOi9G7IoC6RU aq3nCP3YZlBEfaGuDQfCG5RokKi5rffR0ZOZAyRJFVuVQ5cRyWaFTA6OefkQjJJzjnqQ GWf/sW5fcTKwfnxD55dESLahZC3zoqekrbIK+wU1ehmlZpfP+2xlf3WHxiAWk0Lct5a/ y8uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/DeEvqs6LHCwkUpxSURErdkCTHL1IC7aSJHrtYhCFmo=; b=MckWLkP8qo8XOMUIV21D0vWkib+lxiJqXi9aMRXqbjuk7+asXDNGE76G3SpOCIGOW5 aQSbZHPGJW6pl89c9xERAia8EENY4u0xxRYHpvBr4z16kCs8CyBBOhq5409o+/ofH4J0 G4RN0O30471JifcUNN/pvGZTK+brLSZJyWDa8AdjfKUPSf+6YSsRK+zN27hvoKUAjdYv nmBja/CkTcify1MZxlo/xIHr6E2xaYdT38NBII0qK5Ph1q3ocYkaMeyGkKLOHhezreer 52qtJAkOm2GtiwAvR1A6mlwZmWJUA/Syo77KX9AZ6KDvnbp1VuReDPL+/tccrFMIcV6X tkeg== X-Gm-Message-State: AOAM5338aKQh/eixwMeRCyzKf1LzmR2wLmXThXoMDO/TD5dduodMI7rf ULHvM1qZidETafDmlOw2URi/vNynvtf3AZTcpHo= X-Google-Smtp-Source: ABdhPJxj8gJPlve3sEx+MNN7Rl0ohPrJQzagsTXqcJxvgx6FPO2EhjznCVDZMCpu8IDUZRe94CNBGo6fzGqlB4CJqI8= X-Received: by 2002:a2e:8547:: with SMTP id u7mr3992877ljj.182.1619216101000; Fri, 23 Apr 2021 15:15:01 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::232; envelope-from=plmahan@gmail.com; helo=mail-lj1-x232.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:129134 Archived-At: On Fri, Apr 23, 2021 at 2:52 PM Stefan Monnier wrote: > >> (add-to-list 'auto-mode-alist (quote("build*\\.log'" . > compilation-mode))) > > ____________________________________________________^ > > Here you needed to replace ' with \\' > > >> When I edit a file say 'build.log' it does not enable compilation mode. > >> > >> I tried - > >> > >> (add-to-list 'auto-mode-alist (quote("build*\\'" . compilation-mode))) > > ________________________________________________^ > > > > And here you just forgot the \\.log > > > Why the ' ? > > > > Try this regexp: "^[Bb]uild.*\\.log$" > > No, he was on the right path. > > The correct regexp construct to match the end of a string is \' (which > inside a string ends up looking like \\' since the backslash needs to be > escaped), whereas the $ you're recommending matches both the end of > a string and an end of *line*, so it can mis-match with a file named > "build.log\nhello.svg". > > Yes! Success! Thanks Stefan! Changing it to escape the ' makes it work now. Patrick