diff -uNr old_src/chrome/content/options.xul new_src/chrome/content/options.xul
--- old_src/chrome/content/options.xul	2008-12-05 01:16:35.000000000 -0600
+++ new_src/chrome/content/options.xul	2009-02-20 13:45:07.000000000 -0600
@@ -66,6 +66,9 @@
       <preference id="pref-ybookmarks-original-keyword-conflicts-warn"
                               name="extensions.ybookmarks@yahoo.original.keyword.conflicts.warn"
                               type="bool" />
+			<preference id="pref-ybookmarks-searchautotag-enable"
+									name="extensions.ybookmarks@yahoo.searchautotag.enable"
+                              type="bool" />
       <preference id="pref-ybookmarks-debug"
                               name="extensions.ybookmarks@yahoo.debug"
                               type="bool" />
@@ -294,6 +297,14 @@
                                   label="&delicious.original.keyword.conflicts.warn.label;"
                                 preference="pref-ybookmarks-original-keyword-conflicts-warn"/>
             </groupbox>
+						<groupbox align="start">
+							<caption label="&delicious.searchautotag.caption;" class="options-caption" />
+						
+							<checkbox id="pref-ybookmarks-searchautotag-enable-checkbox"
+												label="&delicious.searchautotag.label;"
+												preference="pref-ybookmarks-searchautotag-enable"/>
+							
+						</groupbox>
             <groupbox align="start">
               <caption label="&delicious.sync.caption;" class="options-caption" />
               <description>&delicious.fullsync.desc;</description>
diff -uNr old_src/chrome/content/yAddBookMark.js new_src/chrome/content/yAddBookMark.js
--- old_src/chrome/content/yAddBookMark.js	2008-12-05 01:16:37.000000000 -0600
+++ new_src/chrome/content/yAddBookMark.js	2009-02-20 13:45:07.000000000 -0600
@@ -640,6 +640,30 @@
       else {
          this.post.title = this.post.url;
       }
+			if( this.prefs.getBoolPref("extensions.ybookmarks@yahoo.searchautotag.enable") ) {
+				// check to see if a search got us here.  If it did, pull the terms out
+				// and add them to the post as tags
+				hist = webNav.sessionHistory;
+				for(var i = 0; i < (hist.index + 1); ++i)
+				{
+					// only scrape search terms if the search was the previous page, or the
+					// page before that.
+					if( i > hist.index - 3) {
+						uri = hist.getEntryAtIndex(i, false).URI;
+						if( uri.host == 'www.google.com' ) {
+							keywords = uri.path.match(/[&\?]q=(.+?)&/);
+							if( keywords ) {
+								this.post.tags = keywords[1].split('+');
+							}
+						} else if( uri.host == 'search.yahoo.com' ) {
+							keywords = uri.path.match(/[&\?]p=(.+?)&/);
+							if( keywords ) {
+								this.post.tags = keywords[1].split('+');
+							}
+						}
+					}
+				}
+			}
    },
 
    _setSuggestions: function( tags, containerName, maxTags ) {
Binary files old_src/chrome.zip and new_src/chrome.zip differ
Binary files old_src/delicious_bookmarks-2.1.018-fx.xpi and new_src/delicious_bookmarks-2.1.018-fx.xpi differ
Binary files old_src/new.xpi and new_src/new.xpi differ
