emacs-devel
[Top][All Lists]
Advanced

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

Re: Include vCard.el


From: Leo
Subject: Re: Include vCard.el
Date: Tue, 13 Nov 2007 21:52:33 +0000
User-agent: Gnus/5.130000 Emacs/23.0.50 (20071101) Fedora 8 (gnu/linux)

On 2007-10-31 18:20 +0000, Stefan Monnier wrote:
>> (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

I have included the author of vcard.el in the list.

-- 
.:  Leo  :.  [ sdl.web AT gmail.com ]  .:  [ GPG Key: 9283AA3F ]  :.

          Use the best OS -- http://www.fedoraproject.org/




reply via email to

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