emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] crash while ping-ponging between back-to-back footnotes.
@ 2011-06-29 11:48 Jambunathan K
  2011-06-29 12:28 ` Nicolas Goaziou
  2011-06-29 13:26 ` Bastien
  0 siblings, 2 replies; 7+ messages in thread
From: Jambunathan K @ 2011-06-29 11:48 UTC (permalink / raw)
  To: emacs-orgmode; +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-flyspell t help-echo "Footnote definition" fontified t))))
  error("Cannot find reference of footnote %s" #("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 . 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-next-reference label) (save-restriction (widen) (or (org-footnote-get-next-reference label t) (org-footnote-get-next-reference label)))))) (if (not ref) (error "Cannot find reference of footnote %s" label) (goto-char (nth 1 ref)) (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 . org-open-at-mouse)) face org-footnote)))
  (cond (special (message "Footnotes: [s]ort  |  [r]enumber fn:N  |  [S]=r+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-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]=r+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-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))))
  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 (quote org-open-at-point-functions))) ((org-at-timestamp-p t) (org-follow-timestamp-link)) ((and (or (org-footnote-at-reference-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 (org-extract-attributes ...)) (while (string-match " *\n *" link) (setq link ...)) (setq link (org-link-expand-abbrev link)) (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))) (save-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 reference-buffer (current-buffer)) (if (string-match " +\\'" path) (setq path (replace-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 ...) path)) ((equal type "mailto") (let (... ... args1 ... ... a) (if ... ...) (while args ...) (apply cmd ...))) ((member type (quote ...)) (browse-url (concat type ":" ...))) ((string= type "doi") (browse-url (concat "http://dx.doi.org/" ...))) ((member type (quote ...)) (browse-url (concat type ":" path))) ((string= type "tags") (org-tags-view arg path)) ((string= type "tree-match") (org-occur (concat "\\[" ... "\\]"))) ((string= type "file") (if (string-match "::\\([0-9]+\\)\\'" path) (setq line ... path ...) (if ... ...)) (if (string-match "[*?{]" ...) (dired path) (org-open-file path arg line search))) ((string= type "shell") (let (...) (if ... ... ...))) ((string= type "elisp") (let (...) (if ... ... ...))) ((and (string= type "thisfile") (run-hook-with-args-until-success ... path))) ((string= type "thisfile") (if arg (switch-to-buffer-other-window ...) (org-mark-ring-push)) (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 org-window-config-before-follow-link (current-window-configuration)) (org-remove-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-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 (quote org-open-at-point-functions))) ((org-at-timestamp-p t) (org-follow-timestamp-link)) ((and (or (org-footnote-at-reference-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-property (point) (quote org-linked-text)) (setq type "thisfile" pos (if ... ... ...) path (buffer-substring ... ...)) (throw (quote match) t)) (save-excursion (when (or ... ...) (setq type ... path ...) (throw ... t))) (save-excursion (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 (error "No link found")) (with-current-buffer (or reference-buffer (current-buffer)) (if (string-match " +\\'" path) (setq path (replace-match "" t t path))) (if (and org-link-translation-function (fboundp org-link-translation-function)) (let (...) (setq type ... path ...))) (cond ((assoc type org-link-protocols) (funcall ... path)) ((equal type "mailto") (let ... ... ... ...)) ((member type ...) (browse-url ...)) ((string= type "doi") (browse-url ...)) ((member type ...) (browse-url ...)) ((string= type "tags") (org-tags-view arg path)) ((string= type "tree-match") (org-occur ...)) ((string= type "file") (if ... ... ...) (if ... ... ...)) ((string= type "shell") (let ... ...)) ((string= type "elisp") (let ... ...)) ((and ... ...)) ((string= 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 org-window-config-before-follow-link (current-window-configuration)) (org-remove-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-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 (quote org-open-at-point-functions))) ((org-at-timestamp-p t) (org-follow-timestamp-link)) ((and (or (org-footnote-at-reference-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-property (point) (quote org-linked-text)) (setq type "thisfile" pos (if ... ... ...) path (buffer-substring ... ...)) (throw (quote match) t)) (save-excursion (when (or ... ...) (setq type ... path ...) (throw ... t))) (save-excursion (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 (error "No link found")) (with-current-buffer (or reference-buffer (current-buffer)) (if (string-match " +\\'" path) (setq path (replace-match "" t t path))) (if (and org-link-translation-function (fboundp org-link-translation-function)) (let (...) (setq type ... path ...))) (cond ((assoc type org-link-protocols) (funcall ... path)) ((equal type "mailto") (let ... ... ... ...)) ((member type ...) (browse-url ...)) ((string= type "doi") (browse-url ...)) ((member type ...) (browse-url ...)) ((string= type "tags") (org-tags-view arg path)) ((string= type "tree-match") (org-occur ...)) ((string= type "file") (if ... ... ...) (if ... ... ...)) ((string= type "shell") (let ... ...)) ((string= type "elisp") (let ... ...)) ((and ... ...)) ((string= 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 (#<window 3 on *Backtrace*> 249 (55 . 235) 67349250 nil 249 (4 . 11) nil (7 . 15) (12 . 20))))
  call-interactively(org-open-at-mouse nil nil)

-- 

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

end of thread, other threads:[~2011-06-30  8:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-29 11:48 [BUG] crash while ping-ponging between back-to-back footnotes Jambunathan K
2011-06-29 12:28 ` Nicolas Goaziou
2011-06-29 12:52   ` Jambunathan K
2011-06-29 13:26 ` Bastien
2011-06-29 14:11   ` Jambunathan K
2011-06-29 17:41     ` Nicolas Goaziou
2011-06-30  8:29       ` Bastien

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

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).