From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jambunathan K Subject: [BUG] crash while ping-ponging between back-to-back footnotes. Date: Wed, 29 Jun 2011 17:18:47 +0530 Message-ID: <81hb78n9i8.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:34411) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QbtGb-0002An-9W for emacs-orgmode@gnu.org; Wed, 29 Jun 2011 07:49:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QbtGY-0005LM-Ea for emacs-orgmode@gnu.org; Wed, 29 Jun 2011 07:49:12 -0400 Received: from mail-pv0-f169.google.com ([74.125.83.169]:37904) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QbtGX-0005LC-Vy for emacs-orgmode@gnu.org; Wed, 29 Jun 2011 07:49:10 -0400 Received: by pvc12 with SMTP id 12so907662pvc.0 for ; Wed, 29 Jun 2011 04:49:08 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Cc: Nicolas Goaziou Summary: Sample org file down below also doubles up as bug report. * Sample Add footnote-1 using C-c C-x f [fn:1][fn:2] * Footnotes [fn:1] This is footnote-1. Jump back to the text by mouse-clicking the footnote link. Once you jump back, immediately create another footnote reference using C-c C-x f. [fn:2] This footnote-2. Try jumping back to text by mouse-clicking this fn-2 link. Note the following message on the screen "if: Cannot find reference of footnote fn:2". Stack trace is attached.. Debugger entered--Lisp error: (error #("Cannot find reference of footnote= fn:2" 34 38 (face org-footnote keymap (keymap (follow-link . mouse-face) (= mouse-3 . org-find-file-at-mouse) (mouse-2 . org-open-at-mouse)) mouse-face= highlight org-no-flyspell t help-echo "Footnote definition" fontified t))) signal(error (#("Cannot find reference of footnote fn:2" 34 38 (face org-= footnote keymap (keymap (follow-link . mouse-face) (mouse-3 . org-find-file= -at-mouse) (mouse-2 . org-open-at-mouse)) mouse-face highlight org-no-flysp= ell t help-echo "Footnote definition" fontified t)))) error("Cannot find reference of footnote %s" #("fn:2" 0 4 (fontified t he= lp-echo "Footnote definition" org-no-flyspell t mouse-face highlight keymap= (keymap (follow-link . mouse-face) (mouse-3 . org-find-file-at-mouse) (mou= se-2 . org-open-at-mouse)) face org-footnote))) (if (not ref) (error "Cannot find reference of footnote %s" label) (goto-= char (nth 1 ref)) (org-show-context (quote link-search))) (let* ((label (org-footnote-normalize-label label)) ref) (save-excursion = (setq ref (or (org-footnote-get-next-reference label t) (org-footnote-get-n= ext-reference label) (save-restriction (widen) (or (org-footnote-get-next-r= eference label t) (org-footnote-get-next-reference label)))))) (if (not ref= ) (error "Cannot find reference of footnote %s" label) (goto-char (nth 1 re= f)) (org-show-context (quote link-search)))) org-footnote-goto-previous-reference(#("fn:2" 0 4 (fontified t help-echo = "Footnote definition" org-no-flyspell t mouse-face highlight keymap (keymap= (follow-link . mouse-face) (mouse-3 . org-find-file-at-mouse) (mouse-2 . o= rg-open-at-mouse)) face org-footnote))) (cond (special (message "Footnotes: [s]ort | [r]enumber fn:N | [S]=3D= r+s |->[n]umeric | [d]elete") (setq c (read-char-exclusive)) (cond ((equa= l c 115) (org-footnote-normalize (quote sort))) ((equal c 114) (org-footnot= e-renumber-fn:N)) ((equal c 83) (org-footnote-renumber-fn:N) (org-footnote-= normalize (quote sort))) ((equal c 110) (org-footnote-normalize)) ((equal c= 100) (org-footnote-delete)) (t (error "No such footnote command %c" c)))) = ((setq tmp (org-footnote-at-reference-p)) (if (car tmp) (org-footnote-goto-= definition (car tmp)) (goto-char (nth 1 tmp)) (forward-char 5))) ((setq tmp= (org-footnote-at-definition-p)) (org-footnote-goto-previous-reference (car= tmp))) (t (org-footnote-new))) (let (tmp c) (cond (special (message "Footnotes: [s]ort | [r]enumber fn= :N | [S]=3Dr+s |->[n]umeric | [d]elete") (setq c (read-char-exclusive))= (cond ((equal c 115) (org-footnote-normalize (quote sort))) ((equal c 114)= (org-footnote-renumber-fn:N)) ((equal c 83) (org-footnote-renumber-fn:N) (= org-footnote-normalize (quote sort))) ((equal c 110) (org-footnote-normaliz= e)) ((equal c 100) (org-footnote-delete)) (t (error "No such footnote comma= nd %c" c)))) ((setq tmp (org-footnote-at-reference-p)) (if (car tmp) (org-f= ootnote-goto-definition (car tmp)) (goto-char (nth 1 tmp)) (forward-char 5)= )) ((setq tmp (org-footnote-at-definition-p)) (org-footnote-goto-previous-r= eference (car tmp))) (t (org-footnote-new)))) org-footnote-action() (cond ((and (org-on-heading-p) (not (org-in-regexp (concat org-plain-link= -re "\\|" org-bracket-link-regexp "\\|" org-angle-link-re "\\|" "[ ]:[^ \= n]+:[ ]*$"))) (not (get-text-property (point) (quote org-linked-text)))) (= or (org-offer-links-in-entry arg) (progn (require (quote org-attach)) (org-= attach-reveal (quote if-exists))))) ((run-hook-with-args-until-success (quo= te org-open-at-point-functions))) ((org-at-timestamp-p t) (org-follow-times= tamp-link)) ((and (or (org-footnote-at-reference-p) (org-footnote-at-defini= tion-p)) (not (org-in-regexp org-bracket-link-regexp))) (org-footnote-actio= n)) (t (let (type path link line search (pos (point))) (catch (quote match)= (save-excursion (skip-chars-forward "^]\n") (when (org-in-regexp org-brack= et-link-regexp 1) (setq link (org-extract-attributes ...)) (while (string-m= atch " *\n *" link) (setq link ...)) (setq link (org-link-expand-abbrev lin= k)) (cond (... ...) (... ...) (t ...)) (throw (quote match) t))) (when (get= -text-property (point) (quote org-linked-text)) (setq type "thisfile" pos (= if (get-text-property ... ...) (1+ ...) (point)) path (buffer-substring (or= ... ...) (or ... ...))) (throw (quote match) t)) (save-excursion (when (or= (org-in-regexp org-angle-link-re) (org-in-regexp org-plain-link-re)) (setq= type (match-string 1) path (match-string 2)) (throw (quote match) t))) (sa= ve-excursion (when (org-in-regexp (org-re "\\(:[[:alnum:]_@#%:]+\\):[ ]*$"= )) (setq type "tags" path (match-string 1)) (while (string-match ":" path) = (setq path ...)) (throw (quote match) t))) (when (org-in-regexp "<\\([^><\n= ]+\\)>") (setq type "tree-match" path (match-string 1)) (throw (quote match= ) t))) (unless path (error "No link found")) (with-current-buffer (or refer= ence-buffer (current-buffer)) (if (string-match " +\\'" path) (setq path (r= eplace-match "" t t path))) (if (and org-link-translation-function (fboundp= org-link-translation-function)) (let ((tmp ...)) (setq type (car tmp) path= (cdr tmp)))) (cond ((assoc type org-link-protocols) (funcall (nth 1 ...) p= ath)) ((equal type "mailto") (let (... ... args1 ... ... a) (if ... ...) (w= hile args ...) (apply cmd ...))) ((member type (quote ...)) (browse-url (co= ncat type ":" ...))) ((string=3D type "doi") (browse-url (concat "http://dx= .doi.org/" ...))) ((member type (quote ...)) (browse-url (concat type ":" p= ath))) ((string=3D type "tags") (org-tags-view arg path)) ((string=3D type = "tree-match") (org-occur (concat "\\[" ... "\\]"))) ((string=3D type "file"= ) (if (string-match "::\\([0-9]+\\)\\'" path) (setq line ... path ...) (if = ... ...)) (if (string-match "[*?{]" ...) (dired path) (org-open-file path a= rg line search))) ((string=3D type "shell") (let (...) (if ... ... ...))) (= (string=3D type "elisp") (let (...) (if ... ... ...))) ((and (string=3D typ= e "thisfile") (run-hook-with-args-until-success ... path))) ((string=3D typ= e "thisfile") (if arg (switch-to-buffer-other-window ...) (org-mark-ring-pu= sh)) (let (...) (condition-case nil ... ...))) (t (browse-url-at-point)))))= )) (if (call-interactively (function org-babel-open-src-block-result)) nil (= org-load-modules-maybe) (move-marker org-open-link-marker (point)) (setq or= g-window-config-before-follow-link (current-window-configuration)) (org-rem= ove-occur-highlights nil nil t) (cond ((and (org-on-heading-p) (not (org-in= -regexp (concat org-plain-link-re "\\|" org-bracket-link-regexp "\\|" org-a= ngle-link-re "\\|" "[ ]:[^ \n]+:[ ]*$"))) (not (get-text-property (point= ) (quote org-linked-text)))) (or (org-offer-links-in-entry arg) (progn (req= uire (quote org-attach)) (org-attach-reveal (quote if-exists))))) ((run-hoo= k-with-args-until-success (quote org-open-at-point-functions))) ((org-at-ti= mestamp-p t) (org-follow-timestamp-link)) ((and (or (org-footnote-at-refere= nce-p) (org-footnote-at-definition-p)) (not (org-in-regexp org-bracket-link= -regexp))) (org-footnote-action)) (t (let (type path link line search (pos = (point))) (catch (quote match) (save-excursion (skip-chars-forward "^]\n") = (when (org-in-regexp org-bracket-link-regexp 1) (setq link ...) (while ... = ...) (setq link ...) (cond ... ... ...) (throw ... t))) (when (get-text-pro= perty (point) (quote org-linked-text)) (setq type "thisfile" pos (if ... ..= . ...) path (buffer-substring ... ...)) (throw (quote match) t)) (save-excu= rsion (when (or ... ...) (setq type ... path ...) (throw ... t))) (save-exc= ursion (when (org-in-regexp ...) (setq type "tags" path ...) (while ... ...= ) (throw ... t))) (when (org-in-regexp "<\\([^><\n]+\\)>") (setq type "tree= -match" path (match-string 1)) (throw (quote match) t))) (unless path (erro= r "No link found")) (with-current-buffer (or reference-buffer (current-buff= er)) (if (string-match " +\\'" path) (setq path (replace-match "" t t path)= )) (if (and org-link-translation-function (fboundp org-link-translation-fun= ction)) (let (...) (setq type ... path ...))) (cond ((assoc type org-link-p= rotocols) (funcall ... path)) ((equal type "mailto") (let ... ... ... ...))= ((member type ...) (browse-url ...)) ((string=3D type "doi") (browse-url .= ..)) ((member type ...) (browse-url ...)) ((string=3D type "tags") (org-tag= s-view arg path)) ((string=3D type "tree-match") (org-occur ...)) ((string= =3D type "file") (if ... ... ...) (if ... ... ...)) ((string=3D type "shell= ") (let ... ...)) ((string=3D type "elisp") (let ... ...)) ((and ... ...)) = ((string=3D type "thisfile") (if arg ... ...) (let ... ...)) (t (browse-url= -at-point))))))) (move-marker org-open-link-marker nil) (run-hook-with-args= (quote org-follow-link-hook))) (unless (call-interactively (function org-babel-open-src-block-result)) (= org-load-modules-maybe) (move-marker org-open-link-marker (point)) (setq or= g-window-config-before-follow-link (current-window-configuration)) (org-rem= ove-occur-highlights nil nil t) (cond ((and (org-on-heading-p) (not (org-in= -regexp (concat org-plain-link-re "\\|" org-bracket-link-regexp "\\|" org-a= ngle-link-re "\\|" "[ ]:[^ \n]+:[ ]*$"))) (not (get-text-property (point= ) (quote org-linked-text)))) (or (org-offer-links-in-entry arg) (progn (req= uire (quote org-attach)) (org-attach-reveal (quote if-exists))))) ((run-hoo= k-with-args-until-success (quote org-open-at-point-functions))) ((org-at-ti= mestamp-p t) (org-follow-timestamp-link)) ((and (or (org-footnote-at-refere= nce-p) (org-footnote-at-definition-p)) (not (org-in-regexp org-bracket-link= -regexp))) (org-footnote-action)) (t (let (type path link line search (pos = (point))) (catch (quote match) (save-excursion (skip-chars-forward "^]\n") = (when (org-in-regexp org-bracket-link-regexp 1) (setq link ...) (while ... = ...) (setq link ...) (cond ... ... ...) (throw ... t))) (when (get-text-pro= perty (point) (quote org-linked-text)) (setq type "thisfile" pos (if ... ..= . ...) path (buffer-substring ... ...)) (throw (quote match) t)) (save-excu= rsion (when (or ... ...) (setq type ... path ...) (throw ... t))) (save-exc= ursion (when (org-in-regexp ...) (setq type "tags" path ...) (while ... ...= ) (throw ... t))) (when (org-in-regexp "<\\([^><\n]+\\)>") (setq type "tree= -match" path (match-string 1)) (throw (quote match) t))) (unless path (erro= r "No link found")) (with-current-buffer (or reference-buffer (current-buff= er)) (if (string-match " +\\'" path) (setq path (replace-match "" t t path)= )) (if (and org-link-translation-function (fboundp org-link-translation-fun= ction)) (let (...) (setq type ... path ...))) (cond ((assoc type org-link-p= rotocols) (funcall ... path)) ((equal type "mailto") (let ... ... ... ...))= ((member type ...) (browse-url ...)) ((string=3D type "doi") (browse-url .= ..)) ((member type ...) (browse-url ...)) ((string=3D type "tags") (org-tag= s-view arg path)) ((string=3D type "tree-match") (org-occur ...)) ((string= =3D type "file") (if ... ... ...) (if ... ... ...)) ((string=3D type "shell= ") (let ... ...)) ((string=3D type "elisp") (let ... ...)) ((and ... ...)) = ((string=3D type "thisfile") (if arg ... ...) (let ... ...)) (t (browse-url= -at-point))))))) (move-marker org-open-link-marker nil) (run-hook-with-args= (quote org-follow-link-hook))) org-open-at-point() org-open-at-mouse((mouse-2 (# 249 (55 . 235) 673= 49250 nil 249 (4 . 11) nil (7 . 15) (12 . 20)))) call-interactively(org-open-at-mouse nil nil) --=20