[Top][All Lists]

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

Re: Incremental search of a package

From: Emanuel Berg
Subject: Re: Incremental search of a package
Date: Sat, 23 Jul 2016 23:55:31 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

egarrulo wrote:

> I have tried, but the following code makes
> Emacs loop on an error (therefore save your
> work before trying it):
> (defun isearch-forward-package ()
>    (interactive)
>    (add-hook 'isearch-mode-hook 'yank-package-line-regexp nil t)
>    (unwind-protect
>        (isearch-forward-regexp)
>      (remove-hook 'isearch-mode-hook 'yank-package-line-regexp t)))
> (defun yank-package-line-regexp ()
>    (isearch-yank-string "^  "))

No, I mean, why can't you just search for the
package name? Without any additional Elisp?

Otherwise I'd doe something like this:

    (defun search-package (pack)
      (interactive "sPackage: ")
      (let ((regexp (format "^  %s" pack)))
        (if (search-forward-regexp regexp (point-max) t) ; NOERROR
          (message "No package: %s" pack) )))

underground experts united ....
Emacs Gnus Blogomatic .........
                   - so far: 58 Blogomatic articles -                   

reply via email to

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