Function: define-thing-chars

define-thing-chars is a macro defined in thingatpt.el.gz.

Signature

(define-thing-chars THING CHARS)

Documentation

Define THING as a sequence of CHARS.

E.g.:
(define-thing-chars twitter-screen-name "[:alnum:]_")

Source Code

;; Defined in /usr/src/emacs/lisp/thingatpt.el.gz
;; Things defined by sets of characters

(defmacro define-thing-chars (thing chars)
  "Define THING as a sequence of CHARS.
E.g.:
\(define-thing-chars twitter-screen-name \"[:alnum:]_\")"
  `(progn
     (put ',thing 'end-op
          (lambda ()
            (re-search-forward (concat "\\=[" ,chars "]*") nil t)))
     (put ',thing 'beginning-op
          (lambda ()
            (if (re-search-backward (concat "[^" ,chars "]") nil t)
                (forward-char)
	      (goto-char (point-min)))))))