all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Sebastien Vauban" <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org>
To: emacs-devel-mXXj517/zsQ@public.gmane.org
Subject: Point at beginning of search pattern incompatible with M-p
Date: Sat, 06 Oct 2012 11:04:52 +0200	[thread overview]
Message-ID: <80mx00ug23.fsf@somewhere.org> (raw)

Hello,

I had, for some time, the following code in my .emacs.

The goal: always exit searches at the beginning of the expression found.

--8<---------------cut here---------------start------------->8---
  (add-hook 'isearch-mode-end-hook 'custom-goto-match-beginning)
  
  (defun custom-goto-match-beginning ()
    "Use with isearch hook to end search at first char of match."
    (when isearch-forward (goto-char isearch-other-end)))
--8<---------------cut here---------------end--------------->8---

Problem: when I want to reuse earlier search strings (with the command `M-p'),
I get the following error:

--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
  goto-char(nil)
  (progn (goto-char isearch-other-end))
  (if isearch-forward (progn (goto-char isearch-other-end)))
  (when isearch-forward (goto-char isearch-other-end))
  custom-goto-match-beginning()
  run-hooks(isearch-mode-end-hook)
  isearch-done(t t)
  byte-code(...)
  byte-code(...)
  isearch-edit-string()
  isearch-ring-adjust(nil)
  isearch-ring-retreat()
  call-interactively(isearch-ring-retreat nil nil)
--8<---------------cut here---------------end--------------->8---

Can this be fixed somehow, to enjoy both features (exiting searches at the
beginning of the expression, and reusing earlier search strings) together?

Best regards,
Seb

-- 
Sebastien Vauban




             reply	other threads:[~2012-10-06  9:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-06  9:04 Sebastien Vauban [this message]
2012-10-06 17:31 ` Point at beginning of search pattern incompatible with M-p Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=80mx00ug23.fsf@somewhere.org \
    --to=wxhgmqzgwmuf-genee64ty+gs+fvcfc7uqw@public.gmane.org \
    --cc=emacs-devel-mXXj517/zsQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.