From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Lennart Borgman (gmail)" Newsgroups: gmane.emacs.devel Subject: Re: Strange results from lwarn + match-string Date: Tue, 19 Feb 2008 22:15:52 +0100 Message-ID: <47BB4708.4060000@gmail.com> References: <47BB1DEF.6080407@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1203455812 29592 80.91.229.12 (19 Feb 2008 21:16:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 19 Feb 2008 21:16:52 +0000 (UTC) Cc: Emacs Devel To: Andreas Schwab Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 19 22:17:16 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JRZpS-0006DX-3V for ged-emacs-devel@m.gmane.org; Tue, 19 Feb 2008 22:16:42 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JRZox-0000WB-8m for ged-emacs-devel@m.gmane.org; Tue, 19 Feb 2008 16:16:11 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JRZor-0000VL-Gb for emacs-devel@gnu.org; Tue, 19 Feb 2008 16:16:05 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JRZop-0000Uq-09 for emacs-devel@gnu.org; Tue, 19 Feb 2008 16:16:05 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JRZoo-0000Un-QT for emacs-devel@gnu.org; Tue, 19 Feb 2008 16:16:02 -0500 Original-Received: from ch-smtp01.sth.basefarm.net ([80.76.149.212]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JRZoo-0005fK-Hw for emacs-devel@gnu.org; Tue, 19 Feb 2008 16:16:02 -0500 Original-Received: from c83-254-148-228.bredband.comhem.se ([83.254.148.228]:59509 helo=[127.0.0.1]) by ch-smtp01.sth.basefarm.net with esmtp (Exim 4.68) (envelope-from ) id 1JRZok-0002LV-6J; Tue, 19 Feb 2008 22:16:00 +0100 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666 In-Reply-To: X-Antivirus: avast! (VPS 080219-0, 2008-02-19), Outbound message X-Antivirus-Status: Clean X-Originating-IP: 83.254.148.228 X-Scan-Result: No virus found in message 1JRZok-0002LV-6J. X-Scan-Signature: ch-smtp01.sth.basefarm.net 1JRZok-0002LV-6J 3588f07184ab8526f727695938a73186 X-detected-kernel: by monty-python.gnu.org: Linux 2.6? (barebone, rare!) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:89597 Archived-At: Andreas Schwab wrote: > "Lennart Borgman (gmail)" writes: > >> Can anyone see anything wrong with this line: >> >> (lwarn t :warning "1: %s" (match-string-no-properties 1)) >> >> I get some very strange result sometimes. > > Please define "strange". I was running the function below (I am trying to export to FreeMind). I am in the .notes file buffer when I exectute the function. The first lines in this file contains * Notes ** Wed Oct 24 22:13:56 2007 (Output filter for Thunderbird?) This is what I get: Warning (t): 0: * Notes Warning (t): 1: t 24 Warning (t): 2: nil Warning (t): 3: nil Below is the function. I also get some crashes, I believe that was when I had `anything' instead of `nonl' in the pattern. There was some other strange errors too, but maybe this is enough? I have tested this with unpatched Emacs too: GNU Emacs 23.0.50.1 (i386-mingw-nt5.1.2600) of 2008-01-27 (defun org2mm-buffer-to-freemind () (interactive) (unless (derived-mode-p 'org-mode) (error "Not an org-mode buffer")) (save-match-data (let* ((default-mm-file (concat (file-name-sans-extension (file-name-nondirectory (buffer-file-name))) ".mm")) (mm-file (read-file-name "Output FreeMind file: " nil nil nil default-mm-file (lambda (fn) (string-match "^mm$" (file-name-extension fn))))) (node-pattern (rx bol (submatch (1+ "*")) (1+ space) (submatch (*? nonl)) eol))) (message "%s" mm-file) ;;(save-excursion (goto-char (point-min)) (when (re-search-forward node-pattern) (lwarn t :warning "0: %s" (match-string-no-properties 0)) (lwarn t :warning "1: %s" (match-string-no-properties 1)) (lwarn t :warning "2: %s" (match-string-no-properties 2)) (lwarn t :warning "3: %s" (match-string-no-properties 3)) ) ;;) )))