From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Bruce Ingalls Newsgroups: gmane.emacs.help Subject: Re: extract regexp Date: Tue, 22 Apr 2003 14:08:32 GMT Organization: Road Runner - NYC Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: <2vAna.20416$TR5.13296@twister.nyc.rr.com> <3E9EE4FF.7060902@yahoo.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1051020696 24893 80.91.224.249 (22 Apr 2003 14:11:36 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 22 Apr 2003 14:11:36 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Tue Apr 22 16:11:35 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 197yUg-0006TJ-00 for ; Tue, 22 Apr 2003 16:11:35 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 197yU0-0000dL-01 for gnu-help-gnu-emacs@m.gmane.org; Tue, 22 Apr 2003 10:10:52 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed-east.nntpserver.com!nntpserver.com!news-west.rr.com!news-server.columbus.rr.com!cyclone.rdc-nyc.rr.com!news-out.nyc.rr.com!twister.nyc.rr.com.POSTED!53ab2750!not-for-mail User-Agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.3) Gecko/20030314 X-Accept-Language: en-us, en Original-Newsgroups: gnu.emacs.help In-Reply-To: <3E9EE4FF.7060902@yahoo.com> Original-Lines: 31 Original-NNTP-Posting-Host: 24.168.135.82 Original-X-Complaints-To: abuse@rr.com Original-X-Trace: twister.nyc.rr.com 1051020512 24.168.135.82 (Tue, 22 Apr 2003 10:08:32 EDT) Original-NNTP-Posting-Date: Tue, 22 Apr 2003 10:08:32 EDT Original-Xref: shelby.stanford.edu gnu.emacs.help:112178 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:8677 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:8677 Kevin Rodgers wrote: > lawrence mitchell wrote: Thanks for your help. This is what I ended up with: (setq moz-prefs-filename "~/.mozilla/...[random name].../default/prefs.js") (defun moz-get-prefs (key) "Returns value in prefs.js corresponding to key. key is line in prefs.js file, up to desired value (which is followed by closing double quote). Returns nil, if no key or value not found. Requires the variable moz-prefs-filename, which is set in e-config.el." (with-temp-buffer (condition-case err (insert-file-contents-literally moz-prefs-filename) (error 'nil)) (if (re-search-forward key nil t) (setq server (match-string 1)) 'nil))) And here is how I call it: (moz-get-prefs "user_pref(\"mail.server.server1.hostname\", \"\\([^\"]+\\)") Unfortunately, it gets a little more tricky, as I should check that mail.server.server*.type is pop3 or imap, and not nntp, but this is good enough.