emacs-devel
[Top][All Lists]
Advanced

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

Point at beginning of search pattern incompatible with M-p


From: Sebastien Vauban
Subject: Point at beginning of search pattern incompatible with M-p
Date: Sat, 06 Oct 2012 11:04:52 +0200
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.1 (windows-nt)

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 via email to

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