2

I'm trying to add a search engine in emacs-w3m and use duckduckgo to search emacswiki

(eval-after-load "w3m-search"
  '(progn
     (setq w3m-search-engine-alist
           (append '(
                     ("emacswiki" "https://duckduckgo.com/?q=%s++site%3Aemacswiki.org&ia=web" nil)
                     ))
                     )))

It does not work as intended because of the second "%". How can we escape the % character in emacs?

  • 1
    Please note that progn and append are both useless in this specific snippet. I guess it was trimmed down from some real code. Also note that a recent emacs will allow the use of with-eval-after-load, which looks nicer (no need for a progn and no need to quote the form). – YoungFrog Sep 6 '16 at 8:25
3

I guess internally this uses the function 'format' so you can use %% to produce one %

| improve this answer | |
  • Thanks for the formatting. Will keep it in mind next time. – DJJ Sep 6 '16 at 8:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.