emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

More conventient move beginning/end of line


From: Lennart Borgman (gmail)
Subject: More conventient move beginning/end of line
Date: Sat, 22 Sep 2007 03:03:14 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070728 Thunderbird/2.0.0.6 Mnenhy/0.7.5.666

Some editor I used long ago had some behaviour similar to the functions below. One press on HOME moved to the beginning of line, next to the start of the text on that line. It would be nice to have this in Emacs (maybe the ARG part should be skipped):

(defun my-move-beginning-of-line(arg)
  (interactive "p")
  (or arg (setq arg 1))
  (let ((pos (point)))
    (move-beginning-of-line arg)
    (when (= pos (point)) (skip-chars-forward " \t"))))
(put 'my-move-beginning-of-line 'CUA 'move)
(global-set-key [home] 'my-move-beginning-of-line)

(defun my-move-end-of-line(arg)
  (interactive "p")
  (or arg (setq arg 1))
  (let ((pos (point)))
    (move-end-of-line arg)
    (when (= pos (point)) (skip-chars-backward " \t"))))
(put 'my-move-end-of-line 'CUA 'move)
(global-set-key [end] 'my-move-end-of-line)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]