unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#16265: 24.3.50; re-search-forward (error "Invalid search bound (wrong side of point)")
@ 2013-12-27  5:57 Keith David Bershatsky
  2013-12-27 12:55 ` Nicolas Richard
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Keith David Bershatsky @ 2013-12-27  5:57 UTC (permalink / raw)
  To: 16265

I initially thought it was related to org-element.el from version 8.2.3a, but it's not.  I replaced the entire org folder with a working version from a few months ago -- org version 7.9.3f, but that didn't change the error.  So my best guess is that the problem is with `re-search-forward` or a function that it relies upon -- however it's written in "C" which is out of my league.

The error comes about when calling `org-capture` a second time after creating the first todo.

Debugger entered--Lisp error: (error "Invalid search bound (wrong side of point)")
  re-search-forward("^\\(?:\\*+ \\|\\[\\(?:[0-9]+\\|fn:[-_[:word:]]+\\)\\]\\|[ 	]*\\(?:$\\|\\(?:|\\|\\+-[-+]\\)\\|[#:]\\|-\\{5,\\}[ 	]*$\\|\\\\begin{\\([A-Za-z0-9]+\\*?\\)}\\|\\(?:\\(?:CLO\\(?:CK\\|SED\\)\\|DEADLINE\\|SCHEDULED\\):\\)\\|\\(?:[-+*]\\|\\(?:[0-9]+\\)[.)]\\)\\(?:[ 	]\\|$\\)\\)\\)" 40674 m)
  org-element-paragraph-parser(40674)
  org-element--current-element(40674 element nil nil)
  byte-code("\306\b\303	\n$\211\x13@\x14\v\307
\x1e\x1a\x1e^[\211^[:\203$

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

* bug#16265: 24.3.50; re-search-forward (error "Invalid search bound (wrong side of point)")
  2013-12-27  5:57 bug#16265: 24.3.50; re-search-forward (error "Invalid search bound (wrong side of point)") Keith David Bershatsky
@ 2013-12-27 12:55 ` Nicolas Richard
  2013-12-27 17:35 ` Keith David Bershatsky
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Nicolas Richard @ 2013-12-27 12:55 UTC (permalink / raw)
  To: Keith David Bershatsky; +Cc: 16265

Keith David Bershatsky <esq@lawlist.com> writes:
>So my best guess is that the problem is with
> re-search-forward` or a function that it relies upon -- however it's
> written in "C" which is out of my league.

The given error happens when you search forward but set a limit before
point, e.g. (re-search-forward "." (1- (point))). It'd be very
surprising that the code throws that error wrongly.

> The error comes about when calling `org-capture` a second time after
> creating the first todo.

I tried calling org-capture twice but couldn't reproduce. Do you have a
recipe ?

> Debugger entered--Lisp error: (error "Invalid search bound (wrong side of point)")
>   re-search-forward("^\\(?:\\*+
> \\|\\[\\(?:[0-9]+\\|fn:[-_[:word:]]+\\)\\]\\|[
> ]*\\(?:$\\|\\(?:|\\|\\+-[-+]\\)\\|[#:]\\|-\\{5,\\}[
> ]*$\\|\\\\begin{\\([A-Za-z0-9]+\\*?\\)}\\|\\(?:\\(?:CLO\\(?:CK\\|SED\\)\\|DEADLINE\\|SCHEDULED\\):\\)\\|\\(?:[-+*]\\|\\(?:[0-9]+\\)[.)]\\)\\(?:[
> ]\\|$\\)\\)\\)" 40674 m)
>   org-element-paragraph-parser(40674)

org-element-paragraph-parser calls "end-of-line" before calling
re-search-forward, perhaps that's a problem in this situation ? I don't
know where the limit comes from.

>   org-element--current-element(40674 element nil nil)
>   byte-code("\306\b\303	\n$\211@\v\307
> \x1a^[\211:\203$

This backtrace looks incomplete.

-- 
Nico.





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

* bug#16265: 24.3.50; re-search-forward (error "Invalid search bound (wrong side of point)")
  2013-12-27  5:57 bug#16265: 24.3.50; re-search-forward (error "Invalid search bound (wrong side of point)") Keith David Bershatsky
  2013-12-27 12:55 ` Nicolas Richard
@ 2013-12-27 17:35 ` Keith David Bershatsky
  2013-12-28  8:00 ` Keith David Bershatsky
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Keith David Bershatsky @ 2013-12-27 17:35 UTC (permalink / raw)
  To: Nicolas Richard; +Cc: 16265

Nicolas:

I will put together a recipe for reproducing the error and provide a full backtrace.  I am away from the computer today, and will start working on it tonight and provide it once it is completed.

Thanks,

Keith

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

At Fri, 27 Dec 2013 13:55:56 +0100,
Nicolas Richard wrote:
> 
> Keith David Bershatsky <esq@lawlist.com> writes:
> >So my best guess is that the problem is with
> > re-search-forward` or a function that it relies upon -- however it's
> > written in "C" which is out of my league.
> 
> The given error happens when you search forward but set a limit before
> point, e.g. (re-search-forward "." (1- (point))). It'd be very
> surprising that the code throws that error wrongly.
> 
> > The error comes about when calling `org-capture` a second time after
> > creating the first todo.
> 
> I tried calling org-capture twice but couldn't reproduce. Do you have a
> recipe ?
> 
> > Debugger entered--Lisp error: (error "Invalid search bound (wrong side of point)")
> >   re-search-forward("^\\(?:\\*+
> > \\|\\[\\(?:[0-9]+\\|fn:[-_[:word:]]+\\)\\]\\|[
> > ]*\\(?:$\\|\\(?:|\\|\\+-[-+]\\)\\|[#:]\\|-\\{5,\\}[
> > ]*$\\|\\\\begin{\\([A-Za-z0-9]+\\*?\\)}\\|\\(?:\\(?:CLO\\(?:CK\\|SED\\)\\|DEADLINE\\|SCHEDULED\\):\\)\\|\\(?:[-+*]\\|\\(?:[0-9]+\\)[.)]\\)\\(?:[
> > ]\\|$\\)\\)\\)" 40674 m)
> >   org-element-paragraph-parser(40674)
> 
> org-element-paragraph-parser calls "end-of-line" before calling
> re-search-forward, perhaps that's a problem in this situation ? I don't
> know where the limit comes from.
> 
> >   org-element--current-element(40674 element nil nil)
> >   byte-code("\306\b\303	\n$\211@\v\307
> > \x1a^[\211:\203$
> 
> This backtrace looks incomplete.
> 
> -- 
> Nico.





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

* bug#16265: 24.3.50; re-search-forward (error "Invalid search bound (wrong side of point)")
  2013-12-27  5:57 bug#16265: 24.3.50; re-search-forward (error "Invalid search bound (wrong side of point)") Keith David Bershatsky
  2013-12-27 12:55 ` Nicolas Richard
  2013-12-27 17:35 ` Keith David Bershatsky
@ 2013-12-28  8:00 ` Keith David Bershatsky
       [not found] ` <m2eh4sgbw4.wl%esq@lawlist.com>
  2014-01-02  1:30 ` Keith David Bershatsky
  4 siblings, 0 replies; 8+ messages in thread
From: Keith David Bershatsky @ 2013-12-28  8:00 UTC (permalink / raw)
  To: Nicolas Richard; +Cc: 16265

Nicolas:

I'm still working on narrowing down the issue.  A likely suspect is a failed `org-sort-entries` before running the *second* round of org-capture.  The `org-sort-entries` kicks in `recursive-edit`, which does not go back to the top level after an error.  re-search-forward and re-search-backward apparently throw errors when the org buffer is in `recursive-edit`.  Last night I had to create a work-around to search the org buffer to update my calendar while org-capture was in use because I couldn't search the buffer either.  So it may not be only recursive edit that causes re-search-forward / backward to throw errors -- it may be linked to whatever org-capture is doing to the main org file buffer -- e.g., narrowing.  The org-sort-entries worked fine in the Emacs Trunk version from October 5, 2
 013, but not the recent version of Emacs Trunk built a few days ago.

Keith


		Debugger entered--Lisp error: (error "Nothing to sort")
  signal(error ("Nothing to sort"))
  error("Nothing to sort")
  (if (>= beg end) (error "Nothing to sort"))
  (let ((case-func (if with-case (quote identity) (quote downcase))) (cmstr (if (equal (marker-buffer org-clock-marker) (current-buffer)) (progn (save-excursion (goto-char org-clock-marker) (looking-back "^.*") (match-string-no-properties 0))))) start beg end stars re re2 txt what tmp) (cond ((org-region-active-p) (setq end (region-end) what "region") (goto-char (region-beginning)) (if (not (org-at-heading-p)) (outline-next-heading)) (setq start (point))) ((or (org-at-heading-p) (condition-case nil (progn (org-back-to-heading t) t) (error nil))) (org-back-to-heading t) (setq start (point) end (progn (org-end-of-subtree t t) (or (bolp) (insert "\n")) (org-back-over-empty-lines) (point)) what "children") (goto-char start) (show-subtree) (outline-next-heading)) (t (goto-char (point-min)) (or 
 (org-at-heading-p) (outline-next-heading)) (setq start (point)) (goto-char (point-max)) (beginning-of-line 1) (if (looking-at ".*?\\S-") (progn (end-of-line 1) (insert "\n"))) (setq end (point-max)) (setq what "top-level") (goto-char start) (show-all))) (setq beg (point)) (if (>= beg end) (error "Nothing to sort")) (looking-at "\\(\\*+\\)") (setq stars (match-string 1) re (concat "^" (regexp-quote stars) " +") re2 (concat "^" (regexp-quote (substring stars 0 -1)) "[ 	\n]") txt (buffer-substring beg end)) (if (not (equal (substring txt -1) "\n")) (setq txt (concat txt "\n"))) (if (and (not (equal stars "*")) (string-match re2 txt)) (error "Region to sort contains a level above the first entry")) (if sorting-type nil (message "Sort %s: [a]lpha  [n]umeric  [p]riority  p[r]operty  todo[o]rde
 r  [f]unc\n               [t]ime [s]cheduled  [d]eadline  [c]reated\n               A/N/P/R/O/F/T/S/D/C means reversed:" what) (setq sorting-type (read-char-exclusive)) (and (= (downcase sorting-type) 102) (setq getkey-func (org-icompleting-read "Sort using function: " obarray (quote fboundp) t nil nil)) (setq getkey-func (intern getkey-func))) (and (= (downcase sorting-type) 114) (setq property (org-icompleting-read "Property: " (mapcar (quote list) (org-buffer-property-keys t)) nil t)))) (save-restriction (narrow-to-region start end) (let ((dcst (downcase sorting-type)) (case-fold-search nil) (now (current-time))) (sort-subr (/= dcst sorting-type) (function (lambda nil (if (re-search-forward re nil t) (goto-char ...) (goto-char ...)))) (function (lambda nil (let (...) (unwind-protect .
 .. ...)))) (function (lambda nil (cond (... ...) (... ...) (... ...) (... ...) (... ...) (... ...) (... ...) (... ...) (... ...) (... ...) (t ...)))) nil (cond ((= dcst 97) (quote string<)) ((= dcst 102) compare-func) ((member dcst (quote ...)) (quote <)))))) (run-hooks (quote org-after-sorting-entries-or-items-hook)) (if cmstr (progn (save-excursion (goto-char start) (search-forward cmstr nil t) (move-marker org-clock-marker (point))))))
  org-sort-entries(t 97)
  (while (re-search-backward "^* " nil t) (org-sort-entries t 97) (org-sort-entries t 111) (org-sort-entries t 112) (org-sort-entries t 116))
  (let (lawlist-item-old) (switch-to-buffer (get-file-buffer lawlist-todo-file)) (setq lawlist-item-old (lawlist-org-get-heading)) (goto-char (point-max)) (while (re-search-backward "^* " nil t) (org-sort-entries t 97) (org-sort-entries t 111) (org-sort-entries t 112) (org-sort-entries t 116)) (goto-char (point-max)) (while (re-search-backward "^* DONE" nil t) (org-sort-entries t 97) (org-sort-entries t 111) (org-sort-entries t 112)) (lawlist-org-cleanup) (org-cycle-hide-drawers (quote all)) (hs-hide-all) (re-search-backward (regexp-quote lawlist-item-new) nil t) (setq beg (point)) (re-search-forward (regexp-quote lawlist-item-new) nil t) (setq end (point)) (isearch-highlight beg end) (recenter) (sit-for 2) (isearch-dehighlight) (goto-char (point-max)) (re-search-backward (regexp-quote law
 list-item-old) nil t) (save-buffer) (setq buffer-read-only t) (recenter))
  (progn (let (lawlist-item-old) (switch-to-buffer (get-file-buffer lawlist-todo-file)) (setq lawlist-item-old (lawlist-org-get-heading)) (goto-char (point-max)) (while (re-search-backward "^* " nil t) (org-sort-entries t 97) (org-sort-entries t 111) (org-sort-entries t 112) (org-sort-entries t 116)) (goto-char (point-max)) (while (re-search-backward "^* DONE" nil t) (org-sort-entries t 97) (org-sort-entries t 111) (org-sort-entries t 112)) (lawlist-org-cleanup) (org-cycle-hide-drawers (quote all)) (hs-hide-all) (re-search-backward (regexp-quote lawlist-item-new) nil t) (setq beg (point)) (re-search-forward (regexp-quote lawlist-item-new) nil t) (setq end (point)) (isearch-highlight beg end) (recenter) (sit-for 2) (isearch-dehighlight) (goto-char (point-max)) (re-search-backward (regexp-qu
 ote lawlist-item-old) nil t) (save-buffer) (setq buffer-read-only t) (recenter)))
  (if (not (get-buffer-window "*Org Agenda*" (selected-frame))) (progn (let (lawlist-item-old) (switch-to-buffer (get-file-buffer lawlist-todo-file)) (setq lawlist-item-old (lawlist-org-get-heading)) (goto-char (point-max)) (while (re-search-backward "^* " nil t) (org-sort-entries t 97) (org-sort-entries t 111) (org-sort-entries t 112) (org-sort-entries t 116)) (goto-char (point-max)) (while (re-search-backward "^* DONE" nil t) (org-sort-entries t 97) (org-sort-entries t 111) (org-sort-entries t 112)) (lawlist-org-cleanup) (org-cycle-hide-drawers (quote all)) (hs-hide-all) (re-search-backward (regexp-quote lawlist-item-new) nil t) (setq beg (point)) (re-search-forward (regexp-quote lawlist-item-new) nil t) (setq end (point)) (isearch-highlight beg end) (recenter) (sit-for 2) (isearch-dehig
 hlight) (goto-char (point-max)) (re-search-backward (regexp-quote lawlist-item-old) nil t) (save-buffer) (setq buffer-read-only t) (recenter))))
  (let* (beg end (lawlist-item-new (lawlist-org-get-heading)) (month-regexp "January\\|February\\|March\\|April\\|May\\|June\\|July\\|August\\|September\\|October\\|November\\|December")) (org-capture-finalize) (if (get-buffer-window "*Org Agenda*" (selected-frame)) (progn (set-buffer "*Org Agenda*") (goto-char (point-min)) (cond ((save-excursion (re-search-forward "tags:  " nil t)) (re-search-forward "tags:  " nil t) (let ((tag-beg ...)) (end-of-line) (let* (tag-match ...) (setq tag-match ...) (switch-to-buffer ...) (let ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) (tag nil tag-match) (if ... ...)))) ((save-excursion (re-search-forward month-regexp nil t)) (let ((date-beg ...)) (end-of-line) (let* (date-match ...) (setq date-match ...) (let* ... ...
  ... ... ... ... ...))))))) (if (not (get-buffer-window "*Org Agenda*" (selected-frame))) (progn (let (lawlist-item-old) (switch-to-buffer (get-file-buffer lawlist-todo-file)) (setq lawlist-item-old (lawlist-org-get-heading)) (goto-char (point-max)) (while (re-search-backward "^* " nil t) (org-sort-entries t 97) (org-sort-entries t 111) (org-sort-entries t 112) (org-sort-entries t 116)) (goto-char (point-max)) (while (re-search-backward "^* DONE" nil t) (org-sort-entries t 97) (org-sort-entries t 111) (org-sort-entries t 112)) (lawlist-org-cleanup) (org-cycle-hide-drawers (quote all)) (hs-hide-all) (re-search-backward (regexp-quote lawlist-item-new) nil t) (setq beg (point)) (re-search-forward (regexp-quote lawlist-item-new) nil t) (setq end (point)) (isearch-highlight beg end) (recenter
 ) (sit-for 2) (isearch-dehighlight) (goto-char (point-max)) (re-search-backward (regexp-quote lawlist-item-old) nil t) (save-buffer) (setq buffer-read-only t) (recenter)))))
  lawlist-org-capture-finalize()
  call-interactively(lawlist-org-capture-finalize nil nil)
  command-execute(lawlist-org-capture-finalize)





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

* bug#16265: 24.3.50; re-search-forward (error "Invalid search bound (wrong side of point)")
       [not found] ` <m2eh4sgbw4.wl%esq@lawlist.com>
@ 2014-01-01  9:46   ` Nicolas Richard
  2014-01-01 17:50   ` Eli Zaretskii
  1 sibling, 0 replies; 8+ messages in thread
From: Nicolas Richard @ 2014-01-01  9:46 UTC (permalink / raw)
  To: Keith David Bershatsky; +Cc: 16265

Keith David Bershatsky <esq@lawlist.com> writes:
> Yes, `(setq-default cache-long-scans nil)` does indeed fix the
> problem.

Great. As I said I must give up here, because I don't know what to do at
this point ; but I can dig further if someone tells me what I'm looking
for, or what is to be done.

-- 
Nico.





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

* bug#16265: 24.3.50; re-search-forward (error "Invalid search bound (wrong side of point)")
       [not found] ` <m2eh4sgbw4.wl%esq@lawlist.com>
  2014-01-01  9:46   ` Nicolas Richard
@ 2014-01-01 17:50   ` Eli Zaretskii
  1 sibling, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2014-01-01 17:50 UTC (permalink / raw)
  To: Keith David Bershatsky; +Cc: theonewiththeevillook, 16265

> Date: Tue, 31 Dec 2013 09:37:15 -0800
> From: Keith David Bershatsky <esq@lawlist.com>
> Cc: 16265@debbugs.gnu.org
> 
> So my recommendation would be that the Emacs team return the default value of `cache-long-scans` to `nil`

Unlikely to happen.

> or, fix it somehow so that it doesn't interfere with popular functions like `re-search-forward` and `re-search-backward` after calling `org-capture`.

I think I fixed this in trunk revision 115826, please try the latest
version of the code.  (I only verified that the simplified test case
works after the fix.)

Thanks.





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

* bug#16265: 24.3.50; re-search-forward (error "Invalid search bound (wrong side of point)")
  2013-12-27  5:57 bug#16265: 24.3.50; re-search-forward (error "Invalid search bound (wrong side of point)") Keith David Bershatsky
                   ` (3 preceding siblings ...)
       [not found] ` <m2eh4sgbw4.wl%esq@lawlist.com>
@ 2014-01-02  1:30 ` Keith David Bershatsky
  2014-01-02  3:38   ` Eli Zaretskii
  4 siblings, 1 reply; 8+ messages in thread
From: Keith David Bershatsky @ 2014-01-02  1:30 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: theonewiththeevillook, 16265

Yes, the issue has indeed been resolved in the latest version of Emacs Trunk that I built today.  I used my example to conduct the test, and it works now with `cache-long-scans` enabled.

Great job -- thank you Eli, and thanks again Nicolas!

Keith

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

At Wed, 01 Jan 2014 19:50:12 +0200,
Eli Zaretskii wrote:
> 
> > Date: Tue, 31 Dec 2013 09:37:15 -0800
> > From: Keith David Bershatsky <esq@lawlist.com>
> > Cc: 16265@debbugs.gnu.org
> > 
> > So my recommendation would be that the Emacs team return the default value of `cache-long-scans` to `nil`
> 
> Unlikely to happen.
> 
> > or, fix it somehow so that it doesn't interfere with popular functions like `re-search-forward` and `re-search-backward` after calling `org-capture`.
> 
> I think I fixed this in trunk revision 115826, please try the latest
> version of the code.  (I only verified that the simplified test case
> works after the fix.)
> 
> Thanks.





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

* bug#16265: 24.3.50; re-search-forward (error "Invalid search bound (wrong side of point)")
  2014-01-02  1:30 ` Keith David Bershatsky
@ 2014-01-02  3:38   ` Eli Zaretskii
  0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2014-01-02  3:38 UTC (permalink / raw)
  To: Keith David Bershatsky; +Cc: theonewiththeevillook, 16265-done

> Date:  Wed, 01 Jan 2014 17:30:12 -0800
> From:  Keith David Bershatsky <esq@lawlist.com>
> Cc:  theonewiththeevillook@yahoo.fr, 16265@debbugs.gnu.org
> 
> Yes, the issue has indeed been resolved in the latest version of Emacs Trunk that I built today.  I used my example to conduct the test, and it works now with `cache-long-scans` enabled.

Thanks, I'm closing the bug, then.





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

end of thread, other threads:[~2014-01-02  3:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-27  5:57 bug#16265: 24.3.50; re-search-forward (error "Invalid search bound (wrong side of point)") Keith David Bershatsky
2013-12-27 12:55 ` Nicolas Richard
2013-12-27 17:35 ` Keith David Bershatsky
2013-12-28  8:00 ` Keith David Bershatsky
     [not found] ` <m2eh4sgbw4.wl%esq@lawlist.com>
2014-01-01  9:46   ` Nicolas Richard
2014-01-01 17:50   ` Eli Zaretskii
2014-01-02  1:30 ` Keith David Bershatsky
2014-01-02  3:38   ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).