comparison lisp/simple.el @ 2416:cd01176e9dc5

*** empty log message ***
author Eric S. Raymond <esr@snark.thyrsus.com>
date Mon, 29 Mar 1993 04:58:31 +0000
parents 9e7ec92a4fdf
children eb9815e0a71d
comparison
equal deleted inserted replaced
2415:8c4f5a05b65f 2416:cd01176e9dc5
1673 (defun backward-kill-word (arg) 1673 (defun backward-kill-word (arg)
1674 "Kill characters backward until encountering the end of a word. 1674 "Kill characters backward until encountering the end of a word.
1675 With argument, do this that many times." 1675 With argument, do this that many times."
1676 (interactive "p") 1676 (interactive "p")
1677 (kill-word (- arg))) 1677 (kill-word (- arg)))
1678
1679 (defun current-word ()
1680 "Return the word point is on as a string, if it's between two
1681 word-constituent characters. If not, but it immediately follows one,
1682 move back first. Otherwise, if point precedes a word constituent,
1683 move forward first. Otherwise, move backwards until a word constituent
1684 is found and get that word; if you reach a newline first, move forward
1685 instead."
1686 (interactive)
1687 (save-excursion
1688 (let ((oldpoint (point)) (start (point)) (end (point)))
1689 (skip-syntax-backward "w_") (setq start (point))
1690 (goto-char oldpoint)
1691 (skip-syntax-forward "w_") (setq end (point))
1692 (if (and (eq start oldpoint) (eq end oldpoint))
1693 (progn
1694 (skip-syntax-backward "^w_"
1695 (save-excursion (beginning-of-line) (point)))
1696 (if (eq (preceding-char) ?\n)
1697 (progn
1698 (skip-syntax-forward "^w_")
1699 (setq start (point))
1700 (skip-syntax-forward "w_")
1701 (setq end (point)))
1702 (setq end (point))
1703 (skip-syntax-backward "w_")
1704 (setq start (point)))))
1705 (buffer-substring start end))))
1678 1706
1679 (defconst fill-prefix nil 1707 (defconst fill-prefix nil
1680 "*String for filling to insert at front of new line, or nil for none. 1708 "*String for filling to insert at front of new line, or nil for none.
1681 Setting this variable automatically makes it local to the current buffer.") 1709 Setting this variable automatically makes it local to the current buffer.")
1682 (make-variable-buffer-local 'fill-prefix) 1710 (make-variable-buffer-local 'fill-prefix)