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

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

some search code and a question.


From: Tom Wurgler
Subject: some search code and a question.
Date: Thu, 6 Dec 2001 15:22:43 -0500 (EST)

First the question:

I currently toggle the keypad on my HP computer between numeric and application
keypad via xmodmap.  This works fine except that it affects the keypad for
all applications, not just emacs.  Not that I use any other code, but others in
my group do :).

Is there a way to switch the keypad functionality all from within emacs without
affecting other programs?


And then to keep me legal:

A user asked me for this, so I wrote it.  Actually, I like it better than I
thought I would.  See what you think:

(defun hunt-forward (start end)
  "Search forward for the next occurence of the text in the current region"
  (interactive "r")
  (let ((text (buffer-substring start end)))
    (if (not (search-forward text nil t))
        (error "Search failed: %s" text)
      (set-mark (match-beginning 0)))))
    
(defun hunt-backward (start end)
  "Search backward for the previous occurence of the text in the current region"
  (interactive "r")
  (let ((text (buffer-substring start end)))
    (if (not (search-backward text nil t))
        (error "Search failed: %s" text)
      (set-mark (match-end 0)))))

Thanks!

tom

-- 
============================================================================
Tom Wurgler                             The Goodyear Tire & Rubber Company
Principal Engineer                      Tire-Vehicle Engineering Technology
Phone:         330-796-1656             Technical Center D/460G            
Fax:           330-796-3292             P.O.Box 3531                       
internet mail: address@hidden    Akron, Ohio 44309-3531             
============================================================================



reply via email to

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