From mboxrd@z Thu Jan 1 00:00:00 1970 From: Liam Healy Subject: Re: Unable to generate link in non-org file with org-id-store-link present Date: Sun, 31 Oct 2010 17:28:13 -0400 Message-ID: References: <87y69em8qr.wl%dmaus@ictsoc.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=46205 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PCfRp-0000S8-Iw for emacs-orgmode@gnu.org; Sun, 31 Oct 2010 17:28:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PCfRn-0000vs-Dd for emacs-orgmode@gnu.org; Sun, 31 Oct 2010 17:28:17 -0400 Received: from mail-gx0-f169.google.com ([209.85.161.169]:33523) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PCfRn-0000vn-92 for emacs-orgmode@gnu.org; Sun, 31 Oct 2010 17:28:15 -0400 Received: by gxk2 with SMTP id 2so1712147gxk.0 for ; Sun, 31 Oct 2010 14:28:14 -0700 (PDT) In-Reply-To: <87y69em8qr.wl%dmaus@ictsoc.de> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: David Maus Cc: emacs-orgmode@gnu.org On Sun, Oct 31, 2010 at 4:02 PM, David Maus wrote: > At Sun, 31 Oct 2010 15:09:48 -0400, > Liam Healy wrote: >> >> With recent versions (since about version 7) of org-mode, I cannot >> generate links in a non-org file when org-id-store-link is in >> org-store-link-functions. =A0Either I get an error "before first >> headline" (makes no sense to me, since I'm not in an org file), or >> emacs spins forever, saturating the CPU and doing nothing. =A0If I leave >> org-id-store-link out of org-store-link-functions, everything works >> fine but of course I get no id link in org files. =A0Is there a fix for >> this? > > Which Org and Emacs version are you using? > > M-x org-version RET Org-mode version 7.02trans (release_7.02.22.gde21) > M-x emacs-version RET GNU Emacs 23.1.1 (x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2009-10-19 on debian-build.int-office-er.priv, modified by Debian > > And can you provide a backtrace for this behavior? > > =A01. reload Org mode so it runs on uncompiled files > > =A0 =A0M-x org-reload RET Done > > =A02. Toggle debug-on-quit and debug-on-error > > =A0 =A0M-x toggle-debug-on-quite RET > =A0 =A0M-x toggle-debug-on-error RET > > =A03. Try to reproduce the bug (if Emacs spins for ever, hit C-g) > > If you encounter the error or can stop Emacs from hanging (C-g), you > get a buffer with the backtrace. It did, I did, here it is: Debugger entered--Lisp error: (quit) re-search-forward("^[ ]*" 4266 t) (while (re-search-forward re end t)) (let ((indent ...) (beg ...) (re ...) end hiddenp) (outline-next-heading) (setq end (point)) (goto-char beg) (while (re-search-forward re end t)) (setq hiddenp (org-invisible-p)) (end-of-line 1) (and (equal ... 10) (forward-char 1)) (while (looking-at "^[ ]*\\(:CLOCK:\\|:LOGBOOK:\\|CLOCK:\\|:END:\\)") (if ... ... ... ...)) (org-skip-over-state-notes) (skip-chars-backward " \n ") (if (eq ... 42) (forward-char 1)) (let (...) (insert "\n:PROPERTIES:\n:END:")) (beginning-of-line 0) (org-indent-to-column indent) (beginning-of-line 2) (org-indent-to-column indent) (beginning-of-line 0) (if hiddenp (save-excursion ... ...) (org-flag-drawer t))) org-insert-property-drawer() (save-excursion (org-insert-property-drawer) (setq end (progn ... ...))) (if force (save-excursion (org-insert-property-drawer) (setq end ...)) (throw (quote exit) nil)) (if (re-search-forward org-property-start-re end t) (setq beg (1+ ...)) (if force (save-excursion ... ...) (throw ... nil)) (goto-char beg) (if (re-search-forward org-property-start-re end t) (setq beg ...))) (let* ((beg ...) (end ...)) (goto-char beg) (if (re-search-forward org-property-start-re end t) (setq beg ...) (if force ... ...) (goto-char beg) (if ... ...)) (if (re-search-forward org-property-end-re end t) (setq end ...) (or force ...) (goto-char beg) (setq end beg) (org-indent-line-function) (insert ":END:\n")) (cons beg end)) (save-excursion (let* (... ...) (goto-char beg) (if ... ... ... ... ...) (if ... ... ... ... ... ... ...) (cons beg end))) (catch (quote exit) (save-excursion (let* ... ... ... ... ...))) org-get-property-block(4037 4266 force) (setq range (org-get-property-block beg end (quote force))) (let ((buffer-invisibility-spec ...)) (setq range (org-get-property-block beg end ...)) (goto-char (car range)) (if (re-search-forward ... ... t) (progn ... ...) (goto-char ...) (insert "\n") (backward-char 1) (org-indent-line-function) (insert ":" property ":")) (and value (insert " " value)) (org-indent-line-function)) (cond ((equal property "TODO") (when ... ...) (if ... ...) (org-todo value) (org-set-tags nil ...)) ((equal property "PRIORITY") (org-priority ...) (org-set-tags nil ...)) ((equal property "SCHEDULED") (if ... ... ...)) ((equal property "DEADLINE") (if ... ... ...)) ((member property org-special-properties) (error "The %s property can not yet be set with `org-entry-put'" property)) (t (let ... ... ... ... ... ...))) (let ((beg ...) (end ...) range) (cond (... ... ... ... ...) (... ... ...) (... ...) (... ...) (... ...) (t ...))) (save-excursion (goto-char (or pom ...)) (org-back-to-heading t) (let (... ... range) (cond ... ... ... ... ... ...)) (run-hook-with-args (quote org-property-changed-functions) property value)) (save-excursion (if (markerp pom) (set-buffer ...)) (save-excursion (goto-char ...) (org-back-to-heading t) (let ... ...) (run-hook-with-args ... property value))) (org-with-point-at pom (org-back-to-heading t) (let (... ... range) (cond ... ... ... ... ... ...)) (run-hook-with-args (quote org-property-changed-functions) property value)) org-entry-put(4204 "ID" "b7f6dacd-3d83-492d-877e-075d3312d0a6") (cond ((and id ... ...) id) (create (setq id ...) (org-entry-put pom "ID" id) (org-id-add-location id ...) id) (t nil)) (let ((id ...)) (cond (... id) (create ... ... ... id) (t nil))) (save-excursion (goto-char (or pom ...)) (let (...) (cond ... ... ...))) (save-excursion (if (markerp pom) (set-buffer ...)) (save-excursion (goto-char ...) (let ... ...))) (org-with-point-at pom (let (...) (cond ... ... ...))) org-id-get(4204 create) org-id-get-create() (org-make-link "id:" (org-id-get-create)) (let* ((link ...) (case-fold-search nil) (desc ...)) (org-store-link-props :link link :description desc :type "id") link) org-id-store-link() run-hook-with-args-until-success(org-id-store-link) (cond ((run-hook-with-args-until-success ...) (setq link ... desc ...)) ((equal ... "*Org Edit Src Example*") (let ... ... ... ... ... ... ... ...)) ((equal ... ...) (let ... ...)) ((eq major-mode ...) (let ... ... ...)) ((eq major-mode ...) (setq cpltxt ... link ...) (org-store-link-props :type "w3" :url ...)) ((eq major-mode ...) (setq cpltxt ... link ...) (org-store-link-props :type "w3m" :url ...)) ((setq search ...) (setq link ...) (setq cpltxt ...)) ((eq major-mode ...) (setq cpltxt ... link ...) (org-store-link-props :type "image" :file buffer-file-name)) ((eq major-mode ...) (let ... ... ...)) ((and ... ...) (setq custom-id ...) (cond ... ... ...)) ((buffer-file-name ...) (setq cpltxt ...) (when ... ... ...) (setq link ...)) ((interactive-p) (error "Cannot link to a buffer which is not visiting a file")) (t (setq link nil))) (let ((outline-regexp ...) link cpltxt desc description search txt custom-id agenda-link) (cond (... ...) (... ...) (... ...) (... ...) (... ... ...) (... ... ...) (... ... ...) (... ... ...) (... ...) (... ... ...) (... ... ... ...) (... ...) (t ...)) (if (consp link) (setq cpltxt ... link ...)) (setq link (or link cpltxt) desc (or desc cpltxt)) (if (equal desc "NONE") (setq desc nil)) (if (and ... link) (progn ... ... ...) (or agenda-link ...))) org-store-link(nil) call-interactively(org-store-link nil nil) > > Best, > =A0-- David Thanks, Liam