Kilka tipsów dla Conkerora znalezionych na blogu: http://bc.tech.coop/blog/060603.html
Firefox for Emacs users – Part 2 (Tips and Techniques)
Saturday, June 3, 2006
I recently
posted about my experience using
Conkeror, a Firefox extension that lets you use emacs-style key
bindings in place of the mouse. I really enjoy using Conkeror, but the
documentation does leave a bit to be desired! The #conkeror IRC
channel and the
mailing list are good sources of information; however, new users
often like to read through some basic stuff first to help them get
started. So, to help others who might want to play around with
Conkeror, I have accumulated a whole bunch of tips & techniques from
the mailing list and IRC channel and my own personal experience using
Conkeror. Some of the code samples are already in Conkeror; however,
looking at them may help others figure out how to start scripting
things in Conkeror. Hopefully, this will help someone
else get up-to-speed faster with using Conkeror.
Here they are (edited and reformatted a bit so that they are in a
Question/Answer format):
- Q. There doesn’t seem to be any way to list „buffers” in
Conkeror.A. When you do a C-x r b (for a bookmark) or C-x b (for a buffer),
pressing tab cycles through the available choices. There is also
support for „partial completion” (e.g. – if you type in the first few
characters, TAB only cycles through the ones that start with those
characters). - Q. I really like Conkeror; however, there are times when I want to
use „normal” Firefox. Is there any way to do this other than going
through the ResetChrome/ExitConkeror/RestartFirefox routine?A. Yes, put the following in your .conkerorrc file:
// Regular Firefox (non-conkeror)
function firefox (arg)
{
window.openDialog("chrome://browser/content/");
}
add_command ("ff", firefox, []);Then, when you want to start up Firefox, type:
M-x ff
Incidentally, creating a
bookmarklet in „normal” Firefox should allow you to do the same
thing in reverse (e.g. – bring up Conkeror without exiting
Firefox). I created the following bookmarklet:javascript:window.openDialog('chrome://conkeror/content/');
Unfortunately, it
doesn’t work as it creates a security exception in Firefox
(surprisingly, it actually worked the first time I tried it but not
after that). If
anyone can figure out how to make this work, I would appreciate the enlightenment! - Q. Is there anything I can use to help debug commands that I
create in my .conkerorrc file.A. Try using the Javascript Console. Put the following in your
.conkerorrc file to create a „jsconsole” command:// Javascript console
function jsconsole(args)
{
var prefix = args[0];
open_url_in (prefix, "chrome://global/content/console.xul");
}
add_command("jsconsole", jsconsole, [["p"]]); - Q. I make a lot of changes to my .conkerorrc file. Can’t I reload
it without exiting/restarting Conkeror?A. Yes, you can use the built-in „source” command to load any
Javascript file (including your .conkerorrc file). Alternatively,
you can create the following „reinit” command in your .conkerorrc file:// Reload .conkeror RC file
function reinit()
{
load_rc_file("/Users/bc/.conkerorrc");
}
add_command("reinit", reinit, []); - Q. Is there any way to copy a numbered link’s URL? I can’t figure out
how get to a link without activating it, or reaching for the mouse,
clicking nearby and tabbing my way to it so I can yank it with 'Y’,
which kind of defeats the point of having a keyboard-driven browser.A. (number) M-RET will select the link. I don’t think that’s documented
anywhere. obviously it should be. C-RET opens in a new buffer.
Just pressing 'c’ RET copies the link of the current page. - Q. Since there is no toolbar, how do you do things like access the
preferences?A. You can use Conkeror commands for most things (or create your own
commands and stick them in your .conkerorrc file). For example:M-x customize
brings up the Firefox Preferences dialog
M-x extensions
brings up the Firefox Extensions dialog
- Q. Things don’t seem to work in Conkeror anymore. I’ve mucked
around with my installation and I think I should just start over
again.A. If things get really hosed (e.g. – nothing seems to work), to uninstall & reinstall conkeror, do:
M-x help-page
hit the 'Reset Chrome' button
quit conkeror
boot regular firefox -> extensions -> uninstall conkeror
quit firefox
boot firefox
install conkeror - Q. Some things don’t work as documented on Mac OS X.
A. There are some problems with Conkeror on Mac OS X:
- The initial conkeror window doesn’t allow itself to be resized if
you start firefox from the command line (as per the installation
instructions). However any following created conkeror windows can be
resized without any problems. My strategy is to create a new window
and kill the first one. - For numbered links, M-RET focuses the link fine, but C-RET
doesn’t do anything. - M-< and M-> do not do anything.
- Some people have the „Option” key mapped to „Meta” in Emacs;
however, there is not any way to detect „Option” in Conkeror so
„Meta” is always mapped to the Apple „Cmd” key.
- The initial conkeror window doesn’t allow itself to be resized if
- Q. Are you able to switch between several open Conkeror windows with the
letter 'f’ key?A. The 'f’ key will cycle through the frames on a page. you’ll have to use
your window manager to switch between conkeror windows. - Q. How do you open up a new „buffer” in firefox from a command
line (or calling from another program)?A. Try this:
firefox -a firefox -remote "openURL(http://slashdot.org,new-tab)"
- Q. I have lots of bookmarks in subdirectories that I can’t see.
A. The following code will list all of your bookmarks (a variation of this is now
included in Conkeror as „C-x r l”):function findit () {
var dirService = Components.classes["@mozilla.org/file/directory_service=;1"] .getService(Components.interfaces.nsIProperties);
var dir = dirService.get("ProfD", Components.interfaces.nsIFile);
dir.append("bookmarks.html");
open_url_in (1, "file://" + dir.path);
}
add_command("my-bookmarks", findit, []);
define_key(ctrlc_kmap, make_key("b", MOD_CTRL), "my-bookmarks");You can stick that in your .conkerorrc file.
- Q. Is there a way to highlight text that can be copied without using the
mouse? It seems intuitive to have a cursor that can be turned on or
off for this purpose.A. Press F7 gets you into „caret mode” with a visible cursor on the
HTML page – then hold Shift and use arrows to select. This also
works in standard Firefox. the cursor with arrow keys to select
something. Some people find this setting useful:user_pref("accessibility.warn_on_browsewithcaret", false);
- Q. Say I’ve got a link #108 on a page. How can I select it and
open it in a different buffer?A. Use the following:
1 0 8 M-RET C C-x C-f C-y RET
(C-x C-f is the same as C-u g, but more emacs-y)
- Q. Some people have difficulty with
getting emacs’ 'browse-url’ functions to play nice with Conkeror. What
settings work?A. Some people find that the following settings work fine…
(setq
browse-url-browser-function 'browse-url-firefox
browse-url-new-window-flag t
browse-url-firefox-new-window-is-tab nil)Obviously you need to have Firefox’s chrome set to
„chrome://conkeror/content” for that to work. And any URL you
'browse-url’ on will open in a new Conkeror frame. Don’t set 'browse-url-firefox-new-window-is-tab’ to 't’ because
Conkeror seems not to understand the „new-tab” option to be an 'openURL’
call. - Q. How can you edit Firefox preferences from within Conkeror?
A. I’ve found two ways to edit Firefox prefs from within Conkeror.
First, you can…g about:config
…and edit the raw variables by hand. The downside is that you have
to know what you’re doing. I figured that there had to be a better
way, so I came up with…function my_prefs () {
openDialog("chrome://browser/content/pref/pref.xul", "PrefWindow",
"chrome,titlebar,resizable,modal", "catFeaturesbutton");
}
add_command("prefs", my_prefs, []);
define_key(ctrlc_kmap, make_key("p", MOD_META), "prefs");Then 'C-c M-p’ opens the familiar Firefox preferences dialog. There
is also the built-in 'customize’ command now. - Q. How do you print a web page from conkeror?
A. There are a couple of ways. There is the built-in command
'print-buffer’; however, you can also do:g javascript:window.print()
… which pops up a printing dialog.
- Q. I use gmail extensively, and it fights with conqueror for keybindings. Has anyone else come up with a solution for this?
A. Well, this should soon be in Conkeror, but the relevant little block of
code in utils.js (just after the call to clearMessage() in
readKeyPress()) is:// BWE: hack out non-modified keys from Gmail
if( kmap == top_kmap &&
!metaPressed(event) && !event.ctrlKey &&
window._content.location.host == 'mail.google.com' ) {
return;
}It’s a hack, but it makes conkeror ignore all unmodified keystrokes
for pages at Gmail, which is enough to free up the regular Gmail
keybindings. A near future challenge is to try and hack something
with Greasemonkey to let me set my own Gmail keybindings for all the
currently mouseonly stuff I need, then I can use it without the mouse,
and without the over-numlinked HTML interface. - Q. How does the jump to bookmark command work ?
A. This is the C-x r b binding right? You type the name of the bookmark. Unfortunately it’s case sensitive
and bookmark names are often long and difficult to remember. You can
use TAB to tab complete. I usually just hit TAB and cycle through them
until I get to the one I want. This isn’t very good, of course. One
Day, I’d like to implement something like iswitchb… - Q. How can I save an image or use the „save target as” function ?
A.Currently you can’t really do it. The workaround is: Press 'i’ and a pink number will appear in the corner of the
image. type the number, press RET. The image uri will be copied into the
clipboard. you can then yank the url into a shell and use wget or
something similar to download it. - Q. How do you open the link of the current page in a new buffer?
A. There’s a section on the help page about the universal argument. To summarize:
C-u g www.someurl.com
opens url in new buffer
C-u C-u g www.someurl.com
opens url in new window
C-u will also work for other commands.
- Q. Is there a way to follow a link in a
new buffer? (I did try the universal argument, with no luck.)A. Yes:
C-u i link#
or
C-u n link#
- Q. Is it possible to toggle visibility of pictures from conkeror?
It would be very helpful to have this available. In general, is it
possible to access the settings that can be usually accessed from
firefox’s preferences in conkeror or is editing firefox/…/prefs.js by
hand the preffered solution?A. Putting the code below in your .conkerorrc should do the trick. The
last line maps toggle-images to C-c tfunction toggle_images() {
if (!gPrefService) {
message("EEP: no gPrefService");
return 0;
}
var pref;
if (!gPrefService.prefHasUserValue("network.image.imageBehavior")) {
pref = 0;
} else {
pref = gPrefService.getIntPref("network.image.imageBehavior");
}
gPrefService.setIntPref("network.image.imageBehavior", pref ? 0 : 2);
pref = gPrefService.getIntPref("network.image.imageBehavior");
// redraw();
message ("imageBehavior set to " + pref);
}
add_command("toggle-images", toggle_images, []);
define_key(ctrlc_kmap, make_key("t", 0), "toggle-images"); - Q. When I first started Conkeror, I got an error message
ending with „…chrome://conkeror/content/utils.js::LocalFile::line 846
date::no”
(I looked at line in utils.js, but I don’t know what it means.)A. This could be related to the conkeror rc file. Perhaps you had a value
for the conkeror.rcfile pref (specifies your rc file) set but the file
specified didn’t exist? Apparently, that was it. I did a „touch .conkerorrc” and the error
went away.