help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: A few simple questions


From: Marco Parrone
Subject: Re: A few simple questions
Date: Sat, 10 May 2003 15:28:20 GMT
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Wang Yin <address@hidden> writes:

> Thank you very much!
> And I want a fast way to repeat your go-to-char, since the position I
> first go to may not be the position I want, and I think doing a 
> 
> C-c n <char>
> 
> again is too slow. I mean, is there a function like ";" in vi?

(setq last-go-to-char "")

(defun go-to-char (arg char)
  "Go to ARG'th occurrence of CHAR.
Case is ignored if `case-fold-search' is non-nil in the current buffer.
Goes backward if ARG is negative; error if CHAR not found."
  (interactive "p\ncGo to char: ")
  (setq last-go-to-char (char-to-string char))
  (search-forward last-go-to-char nil nil arg))

(defun go-to-char-again (arg)
  "Repeat the previous go-to-char command."
  (interactive "p")
  (search-forward last-go-to-char nil nil arg))

(defun go-to-whitespace-not-whitespace (arg)
  "Search forward for a whitespace followed by a non-whitespace."
  (interactive "p")
  (re-search-forward "[ \n\t][^ \n\t]" nil nil arg)
  (goto-char (- (point) 1)))

(define-key global-map (kbd "C-c f") 'go-to-char)
(define-key global-map (kbd "C-c ;") 'go-to-char-again)
(define-key global-map (kbd "C-c W") 'go-to-whitespace-not-whitespace)

GoodBye

- -- 
Marco Parrone - address@hidden
www.autistici.org/marc0
2143 9E77 D5E6 115A 48AD  A170 D0EE F736 (4E88 99C2)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>

iD8DBQE+vRpI0O73Nk6ImcIRAuYIAKCvisB2pHzl6IPy4YYyiWKlCgASyQCg9B2s
V2lEeQ2/UXZ4tD/sRFqUW3o=
=1zKf
-----END PGP SIGNATURE-----


reply via email to

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