emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strange results from lwarn + match-string


From: Lennart Borgman (gmail)
Subject: Re: Strange results from lwarn + match-string
Date: Tue, 19 Feb 2008 22:15:52 +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

Andreas Schwab wrote:
"Lennart Borgman (gmail)" <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]