emacs-devel
[Top][All Lists]
Advanced

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

Re: Include vCard.el


From: Stefan Monnier
Subject: Re: Include vCard.el
Date: Wed, 31 Oct 2007 14:20:19 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux)

> (defgroup vcard nil
>   "Support for the vCard electronic business card format."
>   :group 'vcard

Don't put the group within itself.

> ;; This is used by vcard-region-decode-base64

Why not use base64-decode-region?

>         (save-excursion
>           (set-buffer buf)

Please use with-current-buffer.

>       (kill-buffer buf))

You can use with-temp-buffer rather than
generate-new-buffer+unwind-protect+with-current-buffer+kill-buffer. 

>         (goto-char (point-min))
>         (while (re-search-forward vcard-regexp-begin-vcard nil t)
>           (let ((vcard-data nil))
>             (set-marker pos (point))
>             (while (and (not (looking-at vcard-regexp-end-vcard))
>                         (re-search-forward ":[ \t]*" nil t))
>               (set-marker newpos (match-end 0))
>               (setq properties
>                     (vcard-parse-region-properties pos (match-beginning 0)))
>               (set-marker pos (marker-position newpos))
>               (re-search-forward "[ \t]*\n")
>               (set-marker newpos (match-end 0))
>               (setq value
>                     (vcard-parse-region-value properties pos (match-beginning 
> 0)))
>               (set-marker pos (marker-position newpos))
>               (goto-char pos)
>               (funcall filter properties value)
>               (setq vcard-data (cons (cons properties value) vcard-data)))
>             (setq vcard-list-data (cons (nreverse vcard-data) 
> vcard-list-data))))))
>     (nreverse vcard-list-data)))

AFAICT your code doesn't modify the buffer, so there's no need for markers.
E.g. you can just replace (set-marker newpos (match-end 0))
with (setq pos (match-end 0)).

> (defun vcard-split-string (string &optional separator limit)

Why not use split-string?


        Stefan




reply via email to

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