all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Point at beginning of search pattern incompatible with M-p
@ 2012-10-06  9:04 Sebastien Vauban
  2012-10-06 17:31 ` Juri Linkov
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastien Vauban @ 2012-10-06  9:04 UTC (permalink / raw)
  To: emacs-devel-mXXj517/zsQ

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




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-10-06 17:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-06  9:04 Point at beginning of search pattern incompatible with M-p Sebastien Vauban
2012-10-06 17:31 ` Juri Linkov

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.