define select_word { # Copyright 2004 Thorsten Haude # # This is free software; you may modify and redistribute it under # the terms of the GNU General Public License, Version 2 or, at your # option, any later version. # (http://www.gnu.org/licenses/gpl.html) # Check if there is a word around. if ($cursor != search("\\w", $cursor, "regex") && \ $cursor - 1 != search("\\w", $cursor - 1, "regex")) { beep() return } origCursorPos = $cursor if ($cursor != search("<", $cursor, "regex")) { # Don't back up if you are already at a word's start. backward_word() } start = $cursor forward_word("tail") select(start, $cursor) # Set cursor to original position set_cursor_pos(origCursorPos) }