Emacs以非交互方式搜索所有缓冲区

时间:2015-06-24 17:57:27

标签: emacs

我目前有以下功能:

(defun goto-python-class (classname)
  (interactive "sClass name: ")
  (search-forward (concat "class " classname)))

我正在尝试找到一个向前或向后搜索的搜索功能。基本上,搜索整个缓冲区。似乎没有任何东西。有没有其他方法这样做,而不必弄清楚搜索是否成功,并尝试向后搜索?

1 个答案:

答案 0 :(得分:0)

通常这样做:

(defun goto-python-class (classname)
  (interactive "sClass name: ")
  (goto-char (point-min))
  (unless (re-search-forward
           (concat "class " classname)
           nil t)
    (message "Class %S not found" classname)))