help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: extract regexp


From: Bruce Ingalls
Subject: Re: extract regexp
Date: Tue, 22 Apr 2003 14:08:32 GMT
User-agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.3) Gecko/20030314

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.



reply via email to

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