GNU bug report logs - #16265
24.3.50; re-search-forward (error "Invalid search bound (wrong side of point)")

Previous Next

Package: emacs;

Reported by: Keith David Bershatsky <esq <at> lawlist.com>

Date: Fri, 27 Dec 2013 05:58:02 UTC

Severity: normal

Merged with 16326

Found in version 24.3.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 16265 in the body.
You can then email your comments to 16265 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#16265; Package emacs. (Fri, 27 Dec 2013 05:58:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Keith David Bershatsky <esq <at> lawlist.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 27 Dec 2013 05:58:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50; re-search-forward (error "Invalid search bound (wrong side of
 point)")
Date: Thu, 26 Dec 2013 21:57:14 -0800
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\303	\n$\211@\307
\211:\203$A\310A@#\240\210+\210\2032B\311\312A@\"*\211W\204XU\205[U?\205[b)\204\f >\204x\313\314\203r\202s\"\210\202\315\312A@\"*\316\312A@\"*!\211\"\203\313!\203\313\"V\204\313!W\204\313\"U\203\275\f\317>\204\313!U\203\335\f\320>\203\335\313\314\203\327\202\330\"\210\202,\321\f\322\"\203\371\323\324\312A@\"*\202%\321\f\323\"\203\325\202%\321\f\326\"\203\327\325\202%\321\f\330\"\203!\331\325\202%\325\211!\"b\210*\202" [end special-flag struct element type parent org-element--current-element :parent plist-put :end plist-get throw exit :contents-begin :contents-end (plain-list table) (center-block drawer dynamic-block inlinetask item plain-list quote-block special-block) eql plain-list item :structure nil property-drawer node-property table table-row value property keep-trail trail elem-end origin org-element-greater-elements cend cbeg] 6)
  org-element-at-point()

Thanks,

Keith



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

In GNU Emacs 24.3.50.1 (x86_64-apple-darwin10.8.0, NS apple-appkit-1038.36)
 of 2013-12-23 on MP.local
Bzr revision: 115720 eliz <at> gnu.org-20131223192425-a0qoytzo172df5lf
Windowing system distributor `Apple', version 10.3.1038
Configured using:
 `configure --with-ns'

Important settings:
  locale-coding-system: utf-8-unix

Major mode: Debugger

Minor modes in effect:
  delete-selection-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  desktop-save-mode: t
  tabbar-mode: t
  global-highlight-parentheses-mode: t
  highlight-parentheses-mode: t
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
s-k n 0 SPC @ SPC t e s t <return> <backspace> C-c 
C-c s-q s-q s-q s-k n <f12> s-a s-c <escape> x o r 
<backspace> <backspace> e m a c s - <return> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
r e p o r t - <return> <return> b u g <return>

Recent messages:
Clipboard pasted as level 2 subtree
Wrote /Users/HOME/.0.data/.0.emacs/.todo
Mark set [6 times]
Saving file /Users/HOME/.0.data/.0.emacs/.todo...
Wrote /Users/HOME/.0.data/.0.emacs/.todo
Template key: 
Clipboard pasted as level 2 subtree
Entering debugger...
Mark set [2 times]
Making completion list... [2 times]

Load-path shadows:
/Users/HOME/.0.data/.0.emacs/elpa/flim/md4 hides /Users/HOME/.0.data/.0.emacs/Emacs_12_23_2013.app/Contents/Resources/lisp/md4
/Users/HOME/.0.data/.0.emacs/elpa/flim/hex-util hides /Users/HOME/.0.data/.0.emacs/Emacs_12_23_2013.app/Contents/Resources/lisp/hex-util
/Users/HOME/.0.data/.0.emacs/elpa/flim/sasl hides /Users/HOME/.0.data/.0.emacs/Emacs_12_23_2013.app/Contents/Resources/lisp/net/sasl
/Users/HOME/.0.data/.0.emacs/elpa/flim/sasl-ntlm hides /Users/HOME/.0.data/.0.emacs/Emacs_12_23_2013.app/Contents/Resources/lisp/net/sasl-ntlm
/Users/HOME/.0.data/.0.emacs/elpa/flim/sasl-digest hides /Users/HOME/.0.data/.0.emacs/Emacs_12_23_2013.app/Contents/Resources/lisp/net/sasl-digest
/Users/HOME/.0.data/.0.emacs/elpa/flim/sasl-cram hides /Users/HOME/.0.data/.0.emacs/Emacs_12_23_2013.app/Contents/Resources/lisp/net/sasl-cram
/Users/HOME/.0.data/.0.emacs/elpa/flim/ntlm hides /Users/HOME/.0.data/.0.emacs/Emacs_12_23_2013.app/Contents/Resources/lisp/net/ntlm
/Users/HOME/.0.data/.0.emacs/elpa/flim/hmac-md5 hides /Users/HOME/.0.data/.0.emacs/Emacs_12_23_2013.app/Contents/Resources/lisp/net/hmac-md5
/Users/HOME/.0.data/.0.emacs/elpa/flim/hmac-def hides /Users/HOME/.0.data/.0.emacs/Emacs_12_23_2013.app/Contents/Resources/lisp/net/hmac-def
/Users/HOME/.0.data/.0.emacs/elpa/wanderlust/rfc2368 hides /Users/HOME/.0.data/.0.emacs/Emacs_12_23_2013.app/Contents/Resources/lisp/mail/rfc2368
/Users/HOME/.0.data/.0.emacs/elpa/wanderlust/utf7 hides /Users/HOME/.0.data/.0.emacs/Emacs_12_23_2013.app/Contents/Resources/lisp/gnus/utf7
/Users/HOME/.0.data/.0.emacs/elpa/semi/smime hides /Users/HOME/.0.data/.0.emacs/Emacs_12_23_2013.app/Contents/Resources/lisp/gnus/smime
/Users/HOME/.0.data/.0.emacs/elpa/el-get/.dir-locals hides /Users/HOME/.0.data/.0.emacs/Emacs_12_23_2013.app/Contents/Resources/lisp/gnus/.dir-locals
/Users/HOME/.0.data/.0.emacs/elpa/semi/pgg hides /Users/HOME/.0.data/.0.emacs/Emacs_12_23_2013.app/Contents/Resources/lisp/obsolete/pgg
/Users/HOME/.0.data/.0.emacs/elpa/semi/pgg-pgp5 hides /Users/HOME/.0.data/.0.emacs/Emacs_12_23_2013.app/Contents/Resources/lisp/obsolete/pgg-pgp5
/Users/HOME/.0.data/.0.emacs/elpa/semi/pgg-pgp hides /Users/HOME/.0.data/.0.emacs/Emacs_12_23_2013.app/Contents/Resources/lisp/obsolete/pgg-pgp
/Users/HOME/.0.data/.0.emacs/elpa/semi/pgg-parse hides /Users/HOME/.0.data/.0.emacs/Emacs_12_23_2013.app/Contents/Resources/lisp/obsolete/pgg-parse
/Users/HOME/.0.data/.0.emacs/elpa/semi/pgg-gpg hides /Users/HOME/.0.data/.0.emacs/Emacs_12_23_2013.app/Contents/Resources/lisp/obsolete/pgg-gpg
/Users/HOME/.0.data/.0.emacs/elpa/semi/pgg-def hides /Users/HOME/.0.data/.0.emacs/Emacs_12_23_2013.app/Contents/Resources/lisp/obsolete/pgg-def
/Users/HOME/.0.data/.0.emacs/elpa/utilities/longlines hides /Users/HOME/.0.data/.0.emacs/Emacs_12_23_2013.app/Contents/Resources/lisp/obsolete/longlines

Features:
(shadow wl-mime mime-edit pgg-parse pccl pccl-20 signature mime-setup
mail-mime-setup semi-setup mime-pgp pgg-def mime-play filename
mime-image modb-legacy modb-standard elmo-imap4 time-stamp emacsbug
message rfc822 mml mml-sec mm-decode mm-bodies mm-encode mailabbrev
gmm-utils mailheader sort bookmark parse-time org-element mule-util
cal-move tabify image-file org-wl org-w3m org-vm org-rmail org-mhe
org-mew org-irc org-jsinfo org-infojs org-html org-exp ob-exp
org-exp-blocks org-info org-gnus org-docview org-bibtex bibtex
org-bbdb server disp-table whitespace hl-line linum init-wl wl-demo
wl-draft eword-encode wl-template sendmail mail-utils elmo-net
elmo-cache elmo-map elmo-dop wl-news wl-address wl-thread wl-folder wl
wl-e21 wl-spam wl-action wl-summary wl-refile wl-util pp elmo-flag
elmo-localdir wl-message elmo-mime mmelmo-buffer mmelmo-imap mime-view
mime-conf calist semi-def mmimap mime-parse mmbuffer mmgeneric
elmo-multi elmo-spam elsp-header elsp-generic elmo elmo-signal
wl-highlight wl-vars wl-version epg-config elmo-msgdb modb
modb-generic modb-entity luna mime elmo-util emu invisible inv-23 poem
poem-e20 poem-e20_3 utf7 eword-decode mel mime-def alist std11
mcharset mcs-20 mcs-e20 pces pces-e20 pces-20 broken pcustom elmo-date
elmo-vars elmo-version path-util poe pym static apel-ver product
w3m-load mime-w3m w3m browse-url doc-view jka-compr image-mode
w3m-hist w3m-fb bookmark-w3m w3m-ems wid-edit w3m-ccl ccl w3m-favicon
w3m-image w3m-proc w3m-util multiple-cursors-autoloads package
ps-print ps-def lpr bbdb-autoloads bbdb timezone flyspell ispell
auto-save-buffers-enhanced delsel savehist fill-column-indicator
highlight-indentation column-marker col-highlight vline
centered-cursor-mode dired-aux dired yasnippet help-mode debug
multiple-cursors mc-separate-operations rectangular-region-mode
mc-mark-more thingatpt mc-cycle-cursors mc-edit-lines
multiple-cursors-core edmacro kmacro rect saveplace init-auctex
tex-site desktop frameset init-tabbar tabbar init-org derived cl-macs
gv holidays hol-loaddefs org-capture org-mks org-agenda org-toodledo
mailcap-toodledo lawlist-tls http-post-simple cl cl-loaddefs cl-lib
url-http tls url-auth mail-parse rfc2231 rfc2047 rfc2045 ietf-drums
url-gw url url-proxy url-privacy url-expand url-methods url-history
url-cookie url-domsuf url-util url-parse auth-source eieio eieio-core
gnus-util mm-util mail-prsvr password-cache url-vars mailcap json xml
w3mexcerpt org byte-opt bytecomp byte-compile cconv advice help-fns
ob-tangle ob-ref ob-lob ob-table org-footnote org-src ob-comint
ob-keys org-pcomplete pcomplete comint ansi-color ring org-list
org-faces org-entities noutline outline easy-mmode org-version
ob-emacs-lisp ob org-compat org-macs ob-eval org-loaddefs format-spec
find-func cal-menu calendar cal-loaddefs hideshow easymenu
highlight-parentheses redo time-date tooltip electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel ns-win tool-bar dnd fontset
image regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode
register page menu-bar rfn-eshadow timer select scroll-bar mouse
jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
cocoa ns multi-tty emacs)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16265; Package emacs. (Fri, 27 Dec 2013 12:56:02 GMT) Full text and rfc822 format available.

Message #8 received at 16265 <at> debbugs.gnu.org (full text, mbox):

From: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
To: Keith David Bershatsky <esq <at> lawlist.com>
Cc: 16265 <at> debbugs.gnu.org
Subject: Re: bug#16265: 24.3.50;
 re-search-forward (error "Invalid search bound (wrong side of point)")
Date: Fri, 27 Dec 2013 13:55:56 +0100
Keith David Bershatsky <esq <at> 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\303	\n$\211@\307
> \211:\203$

This backtrace looks incomplete.

-- 
Nico.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16265; Package emacs. (Fri, 27 Dec 2013 17:36:02 GMT) Full text and rfc822 format available.

Message #11 received at 16265 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
Cc: 16265 <at> debbugs.gnu.org
Subject: Re: bug#16265: 24.3.50;
 re-search-forward (error "Invalid search bound (wrong side of point)")
Date: Fri, 27 Dec 2013 09:35:39 -0800
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 <at> 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\303	\n$\211@\307
> > \211:\203$
> 
> This backtrace looks incomplete.
> 
> -- 
> Nico.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16265; Package emacs. (Sat, 28 Dec 2013 08:01:01 GMT) Full text and rfc822 format available.

Message #14 received at 16265 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
Cc: 16265 <at> debbugs.gnu.org
Subject: Re: bug#16265: 24.3.50;
 re-search-forward (error "Invalid search bound (wrong side of point)")
Date: Sat, 28 Dec 2013 00:00:36 -0800
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, 2013, 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]rder  [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 lawlist-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-quote 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-dehighlight) (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)




bug reassigned from package 'emacs' to 'org-mode'. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sat, 28 Dec 2013 08:50:02 GMT) Full text and rfc822 format available.

bug No longer marked as found in versions 24.3.50. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sat, 28 Dec 2013 08:50:02 GMT) Full text and rfc822 format available.

Information forwarded to emacs-orgmode <at> gnu.org:
bug#16265; Package org-mode. (Sat, 28 Dec 2013 20:45:01 GMT) Full text and rfc822 format available.

Message #21 received at 16265 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
Cc: 16265 <at> debbugs.gnu.org
Subject: Re: bug#16265: 24.3.50;
 re-search-forward (error "Invalid search bound (wrong side of point)")
Date: Sat, 28 Dec 2013 12:44:20 -0800
Nicolas:

This example demonstrates the problem caused when `org-capture` damages the line numbers in the `org-agenda-files`, making it impossible to go to the bottom of the buffer with (goto-char (point-max))  --  consequently, re-search-backward fails -- other functions fail also, e.g., `org-sort-entries`.

(defun example ()
(interactive)
   (let* (
      (org-todo-keywords '((sequence "Active(a)" "Next Action(n)" "Reference(r)"  "Someday(s)" "Delegated(d)" "|" "None(N)") ))
      (sample-todo (concat
        "* TASKS\n\n"
        "** Active [#A] smith @ drawer-one (fishing) | drawer-two (tennis). :lawlist:\n"
        "   DEADLINE: <2013-12-21 Sat 17:00>  SCHEDULED: <2013-12-21 Sat>\n"
        "   :PROPERTIES:\n"
        "   :DRAWER-ONE:  fishing\n"
        "   :DRAWER-TWO:  tennis\n"
        "   :END:\n\n"
        "** Next-Action [#B] doe @ drawer-one (football) | drawer-two (bowling). :fred:\n"
        "   DEADLINE: <2013-12-22 Sun 08:30>  SCHEDULED: <2013-12-22 Sun>\n"
        "   :PROPERTIES:\n"
        "   :DRAWER-ONE:  football\n"
        "   :DRAWER-TWO:  bowling\n"
        "   :END:\n\n"
        "* EVENTS\n\n"
        "** Reference [#C] john @ drawer-one (fishing) | drawer-two (sky-diving). :george:\n"
        "   DEADLINE: <2013-12-23 Mon 10:15>  SCHEDULED: <2013-12-23 Mon>\n"
        "   :PROPERTIES:\n"
        "   :DRAWER-ONE:  fishing\n"
        "   :DRAWER-TWO:  sky-diving\n"
        "   :END:\n\n"
        "* UNDATED\n\n"
        "** Someday [#D] jane @ drawer-one (basket-ball) | drawer-two (bowling). :sam:\n"
        "   DEADLINE: <2013-12-24 Tues 12:00>  SCHEDULED: <2013-12-24 Tues>\n"
        "   :PROPERTIES:\n"
        "   :DRAWER-ONE:  basket-ball\n"
        "   :DRAWER-TWO:  bowling\n"
        "   :END:")))
      (if (get-buffer "foo.org")
        (progn
          (switch-to-buffer "foo.org")
          (erase-buffer)
          (delete-other-windows))
        (switch-to-buffer (get-buffer-create "foo.org")))
      (org-mode)
      (linum-mode 1)
      (insert sample-todo)
      (goto-char (point-min))
      (or (y-or-n-p (format "For this example work, you must save this buffer as a file.  Proceed with example?"))
          (error "Canceled."))
      (write-file "~/Desktop/foo.org" t)
      (let* (
          (filename (buffer-file-name))
          (org-agenda-files (list filename))
          (org-capture-templates '(("n" "Next Action" entry (file+headline filename "TASKS")
      "** Next Action [#A] %?\n   DEADLINE: <%<%Y-%m-%d %a>>\n   :PROPERTIES:\n   :ToodledoID:\n   :ToodledoFolder: TASKS\n   :Hash:\n   :END:"
      :empty-lines 1))))
(search-backward-example)
(org-capture nil "n")
(message "-----------------------------")
(message "Here we can see that the line numbers in 'foo.org' got messed up.")
(sit-for 5)
(insert "Hello World! :lawlist:")
(org-capture-finalize)
(search-backward-example)
(message "-----------------------------")
(message "Here is where things really went wrong.  It's searching the WRONG todo.")
(message "-----------------------------")
(switch-to-buffer "*Messages*"))))


(defun search-backward-example ()
(require 'org-element)
  (let* (element todo-state title deadline scheduled day month year
        (org-todo-keywords '((sequence "Active(a)" "Next Action(n)" "Reference(r)"  "Someday(s)" "Delegated(d)" "|" "None(N)") )))
    (goto-char (point-max))
    (while (re-search-backward "^\*\* \\(Reference\\)" nil t)
      (setq element (org-element-at-point))
      (setq todo-state (org-element-property :todo-keyword element))
      (setq title (org-element-property :title element))
      (setq deadline (ignore-errors (org-element-property :deadline element) ))
      (setq scheduled (ignore-errors (org-element-property :scheduled element) ))
      (setq day (ignore-errors (org-element-property :day-start scheduled)))
      (setq month (ignore-errors (org-element-property :month-start scheduled)))
      (setq year (ignore-errors (org-element-property :year-start scheduled)))
      (message "-----------------------------")
      (message "todo-state:  %s" todo-state)
      (message "deadline:  %s" deadline)
      (message "scheduled:  %s" scheduled)
      (message "title:  %s" title)
      (message "day:  %s" day)
      (message "month:  %s" month)
      (message "year:  %s" year)
      (message "-----------------------------") )))




Information forwarded to emacs-orgmode <at> gnu.org:
bug#16265; Package org-mode. (Tue, 31 Dec 2013 12:07:02 GMT) Full text and rfc822 format available.

Message #24 received at 16265 <at> debbugs.gnu.org (full text, mbox):

From: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
To: Keith David Bershatsky <esq <at> lawlist.com>
Cc: 16265 <at> debbugs.gnu.org
Subject: Re: bug#16265: 24.3.50; re-search-forward (error "Invalid search
 bound (wrong side of point)")
Date: Tue, 31 Dec 2013 13:07:24 +0100
Le 28/12/2013 21:44, Keith David Bershatsky a écrit :
> This example demonstrates the problem caused when `org-capture`
> damages the line numbers in the `org-agenda-files`, making it
> impossible to go to the bottom of the buffer with (goto-char
> (point-max))  --  consequently, re-search-backward fails -- other
> functions fail also, e.g., `org-sort-entries`.

Thanks for the recipe, I can indeed reproduce problems, but they are
different from what you describe. I suspect they are tied, but I'm not
sure because I don't understand them.

Here is a reduced version of your recipe which shows what I see. Run the
following snippet using emacs -Q --batch -l filenamehere :
,---- this is filenamehere.el
| (setq test-file "/tmp/foo.org")
| (setq capture-todo (mapconcat
|                     #'identity
|                     (list "** whatever"
|                           ":PROPERTIES:"
|                           ":ToodledoFolder: TASKS"
|                           ":END:")
|                     "\n"))
| (when (file-exists-p test-file) (delete-file test-file) (message "Deleted file %s" test-file))
| (find-file test-file)
| (org-mode)
| (setq org-agenda-files (list test-file))
| (setq org-capture-templates `(("n" "NextAction" entry (file+headline test-file "TASKS")
| 			       ,capture-todo)))
| (org-capture nil "n")
| (org-capture-finalize)
| (goto-char (point-min))
| (insert "It's important to insert something ; I guess it triggers something\n")
| (search-forward "Toodledo")
| (end-of-line) ; this should land us before "\n:END:" not after it
| (if (looking-at "\n:END:")
|     (message "Great!")
|   (error "Problem here."))
`----

fun facts : if you remove the (insert ...) form, it works. Also, if you
do it interactively, then the problem appears too, but not if you clone
the buffer.

I'll bisect this (I tested 24.3, it works there) and post the result
unless someone understands what's going on before the bisect finishes
(it does take quite some time to rebuild each version of emacs on my
machine).

-- 
Nicolas.




Information forwarded to emacs-orgmode <at> gnu.org:
bug#16265; Package org-mode. (Tue, 31 Dec 2013 14:16:02 GMT) Full text and rfc822 format available.

Message #27 received at 16265 <at> debbugs.gnu.org (full text, mbox):

From: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
To: Keith David Bershatsky <esq <at> lawlist.com>
Cc: 16265 <at> debbugs.gnu.org
Subject: Re: bug#16265: 24.3.50;
 re-search-forward (error "Invalid search bound (wrong side of point)")
Date: Tue, 31 Dec 2013 15:16:40 +0100
Nicolas Richard <theonewiththeevillook <at> yahoo.fr> writes:
> I'll bisect this (I tested 24.3, it works there) and post the result

bisection is done.
# first bad commit: [f56f1e3993fd79240e03666cf8390f489b4a2435] Switch cache-long-scans to t by default.

and indeed, running
emacs -Q --batch --eval '(setq-default cache-long-scans nil)' -l filenamehere
worked for me.

Keith, can you test if it fixes the problems your are seeing as well ?
(If it doesn't then I guess we'll need another bug report.) If it does,
the next step is to understand why things break when the caching
mechanism is enabled -- I give up there.

-- 
Nico.




Information forwarded to emacs-orgmode <at> gnu.org:
bug#16265; Package org-mode. (Tue, 31 Dec 2013 17:38:02 GMT) Full text and rfc822 format available.

Message #30 received at 16265 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
Cc: 16265 <at> debbugs.gnu.org
Subject: Re: bug#16265: 24.3.50;
 re-search-forward (error "Invalid search bound (wrong side of point)")
Date: Tue, 31 Dec 2013 09:37:15 -0800
Nicolas:

Yes, `(setq-default cache-long-scans nil)` does indeed fix the problem.  In a version of Emacs Trunk built on October 5, 2013, the default value for `cache-long-scans` is `nil`.  In the recent version of Emacs Trunk built on December 23, 2013, the default value for `cache-long-scans` is `t`.

I would suspect that anyone who uses `org-capture` will have significant problems performing various operations on the `org-agenda-files` subsequent to the initial call.  So my recommendation would be that the Emacs team return the default value of `cache-long-scans` to `nil`; 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`.

Thank you very much for your hard work tracking down the issue.

Keith

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

At Tue, 31 Dec 2013 15:16:40 +0100,
Nicolas Richard wrote:
> 
> Nicolas Richard <theonewiththeevillook <at> yahoo.fr> writes:
> > I'll bisect this (I tested 24.3, it works there) and post the result
> 
> bisection is done.
> # first bad commit: [f56f1e3993fd79240e03666cf8390f489b4a2435] Switch cache-long-scans to t by default.
> 
> and indeed, running
> emacs -Q --batch --eval '(setq-default cache-long-scans nil)' -l filenamehere
> worked for me.
> 
> Keith, can you test if it fixes the problems your are seeing as well ?
> (If it doesn't then I guess we'll need another bug report.) If it does,
> the next step is to understand why things break when the caching
> mechanism is enabled -- I give up there.
> 
> -- 
> Nico.




bug reassigned from package 'org-mode' to 'emacs,org-mode'. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 31 Dec 2013 19:31:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org, emacs-orgmode <at> gnu.org:
bug#16265; Package emacs,org-mode. (Wed, 01 Jan 2014 09:46:01 GMT) Full text and rfc822 format available.

Message #35 received at 16265 <at> debbugs.gnu.org (full text, mbox):

From: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
To: Keith David Bershatsky <esq <at> lawlist.com>
Cc: 16265 <at> debbugs.gnu.org
Subject: Re: bug#16265: 24.3.50;
 re-search-forward (error "Invalid search bound (wrong side of point)")
Date: Wed, 01 Jan 2014 10:46:07 +0100
Keith David Bershatsky <esq <at> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org, emacs-orgmode <at> gnu.org:
bug#16265; Package emacs,org-mode. (Wed, 01 Jan 2014 17:51:02 GMT) Full text and rfc822 format available.

Message #38 received at 16265 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Keith David Bershatsky <esq <at> lawlist.com>
Cc: theonewiththeevillook <at> yahoo.fr, 16265 <at> debbugs.gnu.org
Subject: Re: bug#16265: 24.3.50;
 re-search-forward (error "Invalid search bound (wrong side of point)")
Date: Wed, 01 Jan 2014 19:50:12 +0200
> Date: Tue, 31 Dec 2013 09:37:15 -0800
> From: Keith David Bershatsky <esq <at> lawlist.com>
> Cc: 16265 <at> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org, emacs-orgmode <at> gnu.org:
bug#16265; Package emacs,org-mode. (Thu, 02 Jan 2014 01:31:02 GMT) Full text and rfc822 format available.

Message #41 received at 16265 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: theonewiththeevillook <at> yahoo.fr, 16265 <at> debbugs.gnu.org
Subject: Re: bug#16265: 24.3.50;
 re-search-forward (error "Invalid search bound (wrong side of point)")
Date: Wed, 01 Jan 2014 17:30:12 -0800
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 <at> lawlist.com>
> > Cc: 16265 <at> 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.




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Thu, 02 Jan 2014 03:39:02 GMT) Full text and rfc822 format available.

Notification sent to Keith David Bershatsky <esq <at> lawlist.com>:
bug acknowledged by developer. (Thu, 02 Jan 2014 03:39:03 GMT) Full text and rfc822 format available.

Message #46 received at 16265-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Keith David Bershatsky <esq <at> lawlist.com>
Cc: theonewiththeevillook <at> yahoo.fr, 16265-done <at> debbugs.gnu.org
Subject: Re: bug#16265: 24.3.50;
 re-search-forward (error "Invalid search bound (wrong side of point)")
Date: Thu, 02 Jan 2014 05:38:33 +0200
> Date:  Wed, 01 Jan 2014 17:30:12 -0800
> From:  Keith David Bershatsky <esq <at> lawlist.com>
> Cc:  theonewiththeevillook <at> yahoo.fr, 16265 <at> 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.




Forcibly Merged 16265 16326. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 02 Jan 2014 19:39:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 31 Jan 2014 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 99 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.