unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
To: Andreas Schwab <schwab@suse.de>
Cc: Emacs Devel <emacs-devel@gnu.org>
Subject: Re: Strange results from lwarn + match-string
Date: Tue, 19 Feb 2008 22:15:52 +0100	[thread overview]
Message-ID: <47BB4708.4060000@gmail.com> (raw)
In-Reply-To: <jey79g4qkz.fsf@sykes.suse.de>

Andreas Schwab wrote:
> "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> 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))
         )
       ;;)
       )))




  reply	other threads:[~2008-02-19 21:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-19 18:20 Strange results from lwarn + match-string Lennart Borgman (gmail)
2008-02-19 20:51 ` Andreas Schwab
2008-02-19 21:15   ` Lennart Borgman (gmail) [this message]
2008-02-19 22:08     ` Stefan Monnier
2008-02-19 22:22       ` Lennart Borgman (gmail)
2008-02-20  3:39         ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47BB4708.4060000@gmail.com \
    --to=lennart.borgman@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=schwab@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).