comparison lisp/eshell/em-hist.el @ 112098:40af77a50adc

Merge changes from emacs-23 branch
author Chong Yidong <cyd@stupidchicken.com>
date Sun, 02 Jan 2011 15:28:40 -0500
parents f57f72bb4757 27e06e53f81b
children 417b1e4d63cd
comparison
equal deleted inserted replaced
112045:52100bac91db 112098:40af77a50adc
835 \(Previous history elements are earlier commands.) 835 \(Previous history elements are earlier commands.)
836 With prefix argument N, search for Nth previous match. 836 With prefix argument N, search for Nth previous match.
837 If N is negative, find the next or Nth next match." 837 If N is negative, find the next or Nth next match."
838 (interactive (eshell-regexp-arg "Previous input matching (regexp): ")) 838 (interactive (eshell-regexp-arg "Previous input matching (regexp): "))
839 (setq arg (eshell-search-arg arg)) 839 (setq arg (eshell-search-arg arg))
840 (if (> eshell-last-output-end (point))
841 (error "Point not located after prompt"))
840 (let ((pos (eshell-previous-matching-input-string-position regexp arg))) 842 (let ((pos (eshell-previous-matching-input-string-position regexp arg)))
841 ;; Has a match been found? 843 ;; Has a match been found?
842 (if (null pos) 844 (if (null pos)
843 (error "Not found") 845 (error "Not found")
844 (setq eshell-history-index pos) 846 (setq eshell-history-index pos)
845 (unless (minibuffer-window-active-p (selected-window)) 847 (unless (minibuffer-window-active-p (selected-window))
846 (message "History item: %d" (- (ring-length eshell-history-ring) pos))) 848 (message "History item: %d" (- (ring-length eshell-history-ring) pos)))
847 ;; Can't use kill-region as it sets this-command 849 ;; Can't use kill-region as it sets this-command
848 (delete-region eshell-last-output-end (point)) 850 (delete-region eshell-last-output-end (point))
849 (insert-and-inherit (eshell-get-history pos))))) 851 (insert-and-inherit (eshell-get-history pos)))))
850 852
851 (defun eshell-next-matching-input (regexp arg) 853 (defun eshell-next-matching-input (regexp arg)
852 "Search forwards through input history for match for REGEXP. 854 "Search forwards through input history for match for REGEXP.