From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: no-spam@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.bugs Subject: Re: Apparent problem with looking-at? Date: 18 Jun 2002 11:42:00 +0200 Organization: StormWare Sender: bug-gnu-emacs-admin@gnu.org Message-ID: <5xfzzkrkif.fsf@kfs2.cua.dk> References: <9E217BAD4019CE4095869023168429A9CCF918@vulture.corp.resmed.org> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1024389745 27129 127.0.0.1 (18 Jun 2002 08:42:25 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 18 Jun 2002 08:42:25 +0000 (UTC) Return-path: Original-Received: from fencepost.gnu.org ([199.232.76.164]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 17KEZE-00073S-00 for ; Tue, 18 Jun 2002 10:42:24 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 17KEZH-000707-00; Tue, 18 Jun 2002 04:42:27 -0400 Original-Received: from dread03.news.tele.dk ([193.88.15.212]) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 17KEYC-0006uo-00 for ; Tue, 18 Jun 2002 04:41:20 -0400 Original-Received: (from news@localhost) by dread03.news.tele.dk (8.11.3/8.11.3) id g5I8fIE21539; Tue, 18 Jun 2002 10:41:18 +0200 (CEST) (envelope-from news) Original-To: gnu-emacs-bug@prep.ai.mit.edu Original-Newsgroups: gnu.emacs.bug User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 Original-Lines: 58 Original-NNTP-Posting-Host: 195.215.206.177 Original-X-Trace: 1024389678 dread03.news.tele.dk 27638 195.215.206.177 Original-X-Complaints-To: abuse@post.tele.dk Errors-To: bug-gnu-emacs-admin@gnu.org X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Bug reports for GNU Emacs, the Swiss army knife of text editors List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.bugs:2109 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:2109 PeterM@resmed.com.au (Peter Milliken) writes: > Hi, I have some elisp that has been unchanged for several major versions of > EMacs now - it nolonger works in version 21.2.1. Your code is seriously flawed, so if it worked with older emacs versions, they must have been buggy too :-) Notice that looking-at arg is a REGEXP, not a STRING. So "/*" matches the empty string (zero or more /'es). And "/* " matches zero or more /'es followed by a space. So it is obvious that "/*" will match "/*..." (as it starts with one slash), while "/* " does not match "/*..." (as there is a * and not a space following the /). According to its doc string, the comment-start variable is a STRING for INSERTING the comment start. It cannot be used as a regexp directly. To do that, use (looking-at (regexp-quote comment-start)) > > I am currently running Emacs 21.2.1 built using cygwin tools on a NT > platform. The situation is that I (normally) comment out lines in code files > I am working on and then wish to remove the comments later on i.e. > > /* */ > > Note that the comment start (.c file) is located at the beginning of line. > The elisp code snippet looks like this: > > (beginning-of-line) > (if (looking-at comment-start) > > The (looking-at comment-start) returns nil. I don't believe it should return > nil and never has in previous versions of Emacs. If I alter the code snippet > to (looking-at "/*") then it works (note the absence of the space after the > '*'). Also, if I place a space character at the start of the line i.e. > > /* */ > > and run the original code (testing for comment-start with point at the BOL) > then the test returns t. > > Thanks > Peter > > Peter Milliken > Software Engineer > ResMed > Phone: +61 2 9886-5059 > -- Kim F. Storm http://www.cua.dk