From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Include vCard.el Date: Wed, 31 Oct 2007 14:20:19 -0400 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1193854926 8482 80.91.229.12 (31 Oct 2007 18:22:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 31 Oct 2007 18:22:06 +0000 (UTC) Cc: emacs-devel@gnu.org To: Leo Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 31 19:22:09 2007 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 1InICb-0006uY-7r for ged-emacs-devel@m.gmane.org; Wed, 31 Oct 2007 19:22:05 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1InICR-0006cj-H7 for ged-emacs-devel@m.gmane.org; Wed, 31 Oct 2007 14:21:55 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1InIAw-0005Rf-9Z for emacs-devel@gnu.org; Wed, 31 Oct 2007 14:20:22 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1InIAv-0005Pl-B5 for emacs-devel@gnu.org; Wed, 31 Oct 2007 14:20:21 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1InIAv-0005PG-0w for emacs-devel@gnu.org; Wed, 31 Oct 2007 14:20:21 -0400 Original-Received: from tomts40.bellnexxia.net ([209.226.175.97] helo=tomts40-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1InIAu-0007q4-Md for emacs-devel@gnu.org; Wed, 31 Oct 2007 14:20:20 -0400 Original-Received: from pastel.home ([74.12.208.145]) by tomts40-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20071031182019.UVKJ1617.tomts40-srv.bellnexxia.net@pastel.home> for ; Wed, 31 Oct 2007 14:20:19 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 5D93B7F9F; Wed, 31 Oct 2007 14:20:18 -0400 (EDT) In-Reply-To: (Leo's message of "Wed\, 31 Oct 2007 12\:48\:26 +0000") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Solaris 8 (1) 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:82241 Archived-At: > (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