Emacs: xah-get-thing.el
xah-get-thing.el
is a emacs lisp utility for grabbing text under cursor.
Download
Features
The package gives you the several functions to get the boundary of current word, line, glyph, text block (paragraph), filepath, url, etc, or text selection if there is active region.
This package is similar to emacs builtin thing-at-point
package
thingatpt.el
.
[see ELisp: thing-at-point]
The differences are:
- Is not based on syntax table. So, the “thing” are predicable in any major mode. (exception is when you get “symbol”, because different language have very different take on what chars are allowed in identifier.)
- provides the
'block
, which is similar to emacs's'paragraph
, but strictly defined by between blank lines. - Functions that get the text selection first, if a region is active. This saves you few lines of code.
- Thing
'url
and'filepath
, are not based on syntax table, but based on regex of likely characters. Also, result is never modified version of what's in the buffer. For example, if'url
, the http prefix is not automatically added if it doesn't exist in original text. - Thing
'line
never includes newline character. This avoid inconsistency when line is last line.
Can Return a Cons Pair or Vector
- The return value can be a cons pair, same as
thingatpt.el
, so you can just drop-in replace by changing the function names in your code. - Has functions that return a vector, so they can be used with
seq-setq
andseq-let
. [see ELisp: Destructure Binding]