Despite the fact that I spend many hours every day programming in emacs with php-mode enabled I’ve never gotten around to learning all the ins and outs of it. Every now and then I get a slow day where I dig in a bit deeper to learn about a few new features. Today I decided I was finally going to play with the options for reading the PHP Manual inside of emacs and for looking up definitions on different functions. After hitting C-c C-f (php-search-documentation) I was presented with the following error:
No Usable Browser Found
No problem, I thought, I’ll just install lynx and I’m sure I’ll be good to go. A quick apt-get install and I had lynx on that box and after trying in emacs again I was greeted with the same error. Turns out it wasn’t that simple. So a little digging and I found this page which showed me the solution, however it was in Spanish. In his example he used Icecat for the browser, I tried simply substituting the icecat reference for lynx but once again found it wasn’t that simple. So at that point I did some more research and found out I could use w3m, so I installed and set that up based on the guide at http://emacs-w3m.namazu.org/ and set up the following configuration inside my .emacs file:
(add-to-list 'load-path "~/.elisp/emacs-w3m-1.4.4") (require 'w3m-load) (setq browse-url-generic-program (executable-find "w3m") browse-url-browser-function 'browse-url-generic) (defvar php-search-url "http://www.php.net/") (defvar php-manual-url "http://www.php.net/manual/en/") (defun php-search-documentation () "Search PHP documentation for the word at the point." (interactive) (w3m-browse-url (concat php-search-url (current-word t)))) (defun php-browse-manual () "Bring up manual for PHP." (interactive) (w3m-browse-url php-manual-url))
It’s important to note that I had to put this AFTER I loaded up php-mode in the .emacs file. If you put it before it seems to override the search-url and manual-url and the command executes without an error but no page ever ends up being loaded. With this in place I was able to browse the manual without lifting my hand to pick up the mouse ๐
A seasoned Senior Solutions Architect with 20 years of experience in technology design and implementation. Renowned for innovative solutions and strategic insights, he excels in driving complex projects to success. Outside work, he is a passionate fisherman and fish keeper, specializing in planted tanks.
This is pretty funny. I did exactly as you did, except instead of finding the page you did I found yours. I thought you’d appreciate the irony.
I do! Thanks for sharing ๐