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

radio buttons for default search engine [PATCH]



The attached patch changes the defcustom for w3m-search-default-engine
so that it presents a list of valid choices and restricts selection to
that list.

I need to admit that my experience with this patch is inconsistent. When
I try it on a "fresh" emacs, using `emacs -Q', it works, but on my
already-running instance, the final entry of the alist appears as a
'blank' option, and no changes are ever applied. Not sure why that is.

-- 
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0
Index: ChangeLog
===================================================================
RCS file: /storage/cvsroot/emacs-w3m/ChangeLog,v
retrieving revision 1.3648
diff -u -r1.3648 ChangeLog
--- ChangeLog	16 Feb 2018 06:53:15 -0000	1.3648
+++ ChangeLog	18 Feb 2018 14:48:49 -0000
@@ -1,3 +1,8 @@
+2018-02-18  Boruch Baum  <boruch_baum@xxxxxxx>
+
+	* w3m-search.el (w3m-search-default-engine): Restrict options to valid
+	current choices and present them as radio buttons.
+
 2018-02-16  Katsumi Yamaoka  <yamaoka@xxxxxxx>

 	* w3m-fb.el (w3m-fb-mode, w3m-fb-delete-frame-kill-buffers):
Index: w3m-search.el
===================================================================
RCS file: /storage/cvsroot/emacs-w3m/w3m-search.el,v
retrieving revision 1.84
diff -u -r1.84 w3m-search.el
--- w3m-search.el	11 Dec 2017 04:30:37 -0000	1.84
+++ w3m-search.el	18 Feb 2018 14:48:49 -0000
@@ -236,10 +236,11 @@
 			    (string :format "PostData: %v\n")))))

 (defcustom w3m-search-default-engine "google"
-  "*Name of the default search engine.
+  "Name of the default search engine.
 See also `w3m-search-engine-alist'."
   :group 'w3m
-  :type 'string)
+  :type (nconc '(radio) (mapcar (lambda (x) (list 'const (w3m-substring-no-properties (car x)) )) w3m-search-engine-alist)))
+

 (defcustom w3m-search-word-at-point t
   "*Non-nil means that the word at point is used as an initial string.