Search code examples
emacsorg-mode

In Emacs, how to search from beginning of file?


In Emacs, how I can I instruct isearch-forward to search not from the location of the point, but from the beginning of the file?


Solution

  • The simplest option is to just move the point to the beginning of file with M-< before invoking isearch. Or, you can write a command that does it for you:

    (defun isearch-from-buffer-start ()
      (interactive)
      (goto-char (point-min))
      (isearch-forward))
    (global-set-key [(control s)] 'isearch-from-buffer-start)