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

better default for search



In the following code, I replaced 'word with 'sexp and get
much better results.  It is much more common that I search
for a word-like-this than one word.

Perhaps w3m can either change this to sexp as I have done
below or allow a variable for it.

Thanks.


(defun w3m-search-read-query (prompt prompt-with-default &optional history)
  "Read a query from the minibuffer, prompting with string PROMPT.
When a default value for the query is discovered, prompt with string
PROMPT-WITH-DEFAULT instead of string PROMPT."
  (let ((default
	  (if (w3m-region-active-p)
	      (buffer-substring (region-beginning) (region-end))
	    (unless (and (eq major-mode 'w3m-mode)
			 (listp (get-text-property (point-at-bol) 'face))
			 (memq 'w3m-header-line-location-title
			       (get-text-property (point-at-bol) 'face)))
==>	      (thing-at-point 'sexp))))
	initial)
    (when default
      (set-text-properties 0 (length default) nil default)
      (when (or w3m-search-word-at-point (w3m-region-active-p))
	(setq initial default
	      default nil))
      (when (w3m-region-active-p)
	(w3m-deactivate-region)))
    (read-string (if default
		     (format prompt-with-default default)
		   prompt)
		 initial history default)))

-- 
Myalgic encephalomyelitis denialism is causing death and severe suffering,
worse than MS.  Conflicts of interest are destroying research.  /You/ can
get the disease at any time permanently.  Do science and justice matter to
you?  http://www.meactionuk.org.uk/What_Is_ME_What_Is_CFS.htm