Chinaunix首页 | 论坛 | 博客
  • 博客访问: 184835
  • 博文数量: 43
  • 博客积分: 1150
  • 博客等级: 少尉
  • 技术积分: 450
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-29 15:52
文章分类

全部博文(43)

文章存档

2012年(18)

2011年(24)

2008年(1)

分类: LINUX

2011-11-14 17:26:28


(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) |
给主人留下些什么吧!~~