(defconst not-symbol-chars "^a-zA-Z0-9_-")
(defconst symbol-chars "a-zA-Z0-9_-\\cc")
(defun chars-start()
(let ((regexp-chars (concat "[" not-symbol-chars "]")) )
(re-search-backward regexp-chars nil t)
(char-forward)
(point)))
(defun chars-end()
(let ((regexp-chars (concat "[" not-symbol-chars "]")) )
(re-search-forward regexp-chars nil t)
(char-backward)
(point)))
(defun char?()
(let ((regexp-chars (concat "[" symbol-chars "]")) )
(set-buffer (get-buffer-create "temp"))
(looking-at regexp-chars)))
(defun test-point()
(set-buffer (get-buffer-create "temp"))
(buffer-substring-no-properties (chars-start) (chars-end)) )
(defun char-backward ()
(cond ((<= (point) (point-min)) nil)
((char?) t)
((goto-char (- (point) 1))
(char-backward))))
(defun char-forward ()
(cond ((>= (point) (point-max)) nil)
((char?) t)
((goto-char (+ (point) 1))
(char-forward))))
(defun get-word ()
(test-point)
)
阅读(1045) | 评论(0) | 转发(0) |