From mboxrd@z Thu Jan 1 00:00:00 1970 From: gregory@dynapse.com (Gregory J. Grubbs) Subject: Bug: [PATCH] org-store-link not working for Gnus articles on gmane.emacs.orgmode [6.36trans (release_6.36.3.gd087.dirty)] Date: Sun, 09 May 2010 10:02:57 -0600 Message-ID: <874oihdpdx.fsf@dynapse.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1OB98o-0003Jk-2d for emacs-orgmode@gnu.org; Sun, 09 May 2010 12:14:06 -0400 Received: from [140.186.70.92] (port=38915 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OB98k-0003Hl-9A for emacs-orgmode@gnu.org; Sun, 09 May 2010 12:14:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OB98f-0003eD-Q6 for emacs-orgmode@gnu.org; Sun, 09 May 2010 12:14:02 -0400 Received: from mail-vw0-f41.google.com ([209.85.212.41]:54432) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OB98f-0003dx-Kz for emacs-orgmode@gnu.org; Sun, 09 May 2010 12:13:57 -0400 Received: by vws12 with SMTP id 12so1952906vws.0 for ; Sun, 09 May 2010 09:13:55 -0700 (PDT) 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: emacs-orgmode@gnu.org Remember to cover the basics, that is, what you expected to happen and what in fact did happen. You don't know how to make a good report? See http://orgmode.org/manual/Feedback.html#Feedback Your bug report will be posted to the Org-mode mailing list. ------------------------------------------------------------------------ org-store-link is not working for Gnus articles, due to the 'To' field being set to nil in org-gnus-store-link (actually, the relevant field comes back as nil from gnus-summary-article-header). M-x org-store-link calls the debugger with the following backtrace: --8<---------------cut here---------------start------------->8--- Debugger entered--Lisp error: (wrong-type-argument stringp nil) string-match("%-?[0-9.]*c" nil) (if (string-match re (cdr e)) (progn (let ... ... ...))) (when (string-match re (cdr e)) (let (... ...) (add-text-properties 0 3 ... safe) (setcdr e ...))) (while (setq e (pop tbl)) (setq re (concat "%-?[0-9.]*" ...)) (when (string-match re ...) (let ... ... ...)) (while (string-match re string) (setq rpl ...) (setq string ...))) (let ((tbl ...) (case-fold-search nil) (pchg 0) e re rpl) (while (setq e ...) (setq re ...) (when ... ...) (while ... ... ...)) (while (setq pchg ...) (let ... ...)) string) org-replace-escapes("Email from %f: %.30s" (("%c") ("%F" . "\"Sven Bretfeld\" ") ("%f" . "Sven Bretfeld") ("%T") ("%t" . "?") ("%s" . "Re: suggestions of Android smartphones") ("%m" . "87k4s1rzuc.fsf@gmx.ch"))) org-email-link-description() (setq desc (org-email-link-description) link (org-gnus-article-link group newsgroups message-id x-no-archive)) (let* ((group gnus-newsgroup-name) (header ...) (from ...) (message-id ...) (date ...) (subject ...) (to ...) newsgroups x-no-archive desc link) (when (org-xor current-prefix-arg org-gnus-prefer-web-links) (save-window-excursion ...) (setq to ... newsgroups ... x-no-archive ...)) (org-store-link-props :type "gnus" :from from :subject subject :message-id message-id :group group :to to) (setq desc (org-email-link-description) link (org-gnus-article-link group newsgroups message-id x-no-archive)) (org-add-link-props :link link :description desc) link) (cond ((eq major-mode ...) (let* ... ...)) ((memq major-mode ...) (let* ... ... ... ... ... link))) org-gnus-store-link() run-hook-with-args-until-success(org-gnus-store-link) org-store-link(nil) call-interactively(org-store-link t nil) execute-extended-command(nil) call-interactively(execute-extended-command nil nil) --8<---------------cut here---------------end--------------->8--- The error is occuring when the cdr is taken of '("%T") -- a patch follows ... it seems correct to me that the code be made robust in the presence of a non-cons cell. I have tested the links generated; they work for the article links I have tested. --8<---------------cut here---------------start------------->8--- diff --git a/lisp/org.el b/lisp/org.el old mode 100644 new mode 100755 index 8f9e16c..85c79ee --- a/lisp/org.el +++ b/lisp/org.el @@ -17700,7 +17700,7 @@ so values can contain further %-escapes if they are define later in TABLE." e re rpl) (while (setq e (pop tbl)) (setq re (concat "%-?[0-9.]*" (substring (car e) 1))) - (when (string-match re (cdr e)) + (when (and (cdr e) (string-match re (cdr e))) (let ((sref (substring (cdr e) (match-beginning 0) (match-end 0))) (safe "SREF")) (add-text-properties 0 3 (list 'sref sref) safe) --8<---------------cut here---------------end--------------->8--- Emacs : GNU Emacs 23.2.1 (i386-mingw-nt5.1.2600) of 2010-05-08 on G41R2F1 Package: Org-mode version 6.36trans (release_6.36.3.gd087.dirty) current state: ============== (setq org-clock-in-switch-to-state "STARTED" org-export-latex-after-initial-vars-hook '(org-beamer-after-initial-vars) org-special-ctrl-a/e t org-agenda-clockreport-parameter-plist '(:link t :maxlevel 99) org-agenda-custom-commands '(("P" "Projects" tags "Project|project|PROJECT" ((org-use-tag-inheritance nil))) ("o" "Open Scan" agenda "" ((org-agenda-ndays 1) (org-clock-modeline-total (quote today)) (tags "-noagenda") (org-agenda-dim-blocked-tasks nil) (org-agenda-overriding-columns-format "%CATEGORY %ALLTAGS %30ITEM %CLOCKSUM") (org-agenda-start-with-clockreport-mode t) (org-agenda-files (quote ("~/work/openscan/openscan.org" "~/projects/misc.org" "~/projects/habits.org"))) (org-refile-targets (quote ((nil :maxlevel . 3)))) (org-clock-clocktable-default-properties (quote (:maxlevel 1 :step day)))) ) ("S" "Started Tasks" todo "STARTED" ((org-agenda-todo-ignore-with-date nil))) ("w" "Tasks waiting on something" tags "WAITING" ((org-use-tag-inheritance nil))) ("dc" "Clock report" agenda "" ((org-agenda-ndays 1) (org-agenda-start-with-clockreport-mode t) (org-agenda-time-grid nil) (org-agenda-skip-function (quote (org-agenda-skip-entry-if (quote notscheduled) (quote deadline) (quote scheduled))))) ) ("dw" "Weekly clock report" agenda "" ((org-agenda-ndays 7) (org-agenda-start-with-clockreport-mode t) (org-agenda-time-grid nil) (org-agenda-skip-function (quote (org-agenda-skip-entry-if (quote notscheduled) (quote deadline) (quote scheduled))))) ) ("da" "GORT Agenda" ((agenda "") (todo "STARTED")))) org-agenda-files '("~/work/openscan/openscan.org" "~/projects/misc.org" "~/projects/habits.org" "~/projects/notes.org" "~/projects/next-work.org" "~/projects/diary.org") org-agenda-include-diary t org-blocker-hook '(org-block-todo-from-children-or-siblings-or-parent) org-export-latex-tables-centered nil org-agenda-show-inherited-tags nil org-agenda-window-setup 'other-window org-clock-into-drawer nil org-agenda-exporter-settings '((ps-number-of-columns 1) (ps-landscape-mode t) (org-agenda-add-entry-text-maxlines 10) (htmlize-output-type (quote css))) org-completion-use-ido t org-metaup-hook '(org-babel-load-in-session-maybe) org-after-todo-state-change-hook '(org-clock-out-if-current) org-read-date-prefer-future 'time org-agenda-todo-ignore-scheduled t org-clock-history-length 12 org-babel-interpreters '("emacs-lisp" "sh") org-agenda-hide-tags-regexp "noagenda" org-speed-commands-user '(("[" ded/org-show-previous-heading-tidily) ("]" ded/org-show-next-heading-tidily) ("," . org-columns) ("q" . bury-buffer)) org-goto-interface 'outline-path-completion org-todo-state-tags-triggers '(("CANCELLED" ("CANCELLED" . t)) ("WAITING" ("WAITING" . t) ("NEXT")) ("SOMEDAY" ("WAITING" . t)) (done ("NEXT") ("WAITING")) ("TODO" ("WAITING") ("CANCELLED")) ("STARTED" ("WAITING") ("NEXT" . t))) org-agenda-restore-windows-after-quit t org-export-latex-format-toc-function 'org-export-latex-format-toc-default org-stuck-projects '("Project|project/-DONE" nil ("NEXT") "") org-export-preprocess-hook '((lambda nil (org-dblock-update 2)) org-export-blocks-preprocess) org-tags-exclude-from-inheritance '("Project" "project") org-tab-first-hook '(org-babel-hide-result-toggle-maybe org-hide-block-toggle-maybe) org-src-mode-hook '(org-src-mode-configure-edit-buffer) org-finalize-agenda-hook '(org-agenda-to-appt) org-confirm-shell-link-function 'yes-or-no-p org-reveal-start-hook '(org-decrypt-entry) org-export-first-hook '(org-beamer-initialize-open-trackers) org-clock-persist 'history org-clock-sound "~/projects/c136.wav" org-todo-keywords '((sequence "TODO(t)" "STARTED(s!)" "|" "DONE(d!/!)") (sequence "PROPOSED(p)" "WAITING(w@/!)" "MAYBE(m!)" "OPEN(O@)" "|" "CANCELLED(c@/!)") (sequence "QUOTE(q!)" "QUOTED(Q!)" "|" "APPROVED(A@)" "EXPIRED(E@)" "REJECTED(R@)")) org-agenda-before-write-hook nil org-default-notes-file "~/projects//inbox.org" org-directory "~/projects/" org-tag-alist '(("Project" . 112) ("car" . 99) ("NEXT" . 110) ("noexport" . 120) ("customer") ("curascript")) org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers org-cycle-show-empty-lines org-optimize-window-after-visibility-change) org-export-preprocess-before-normalizing-links-hook '(org-remove-file-link-modifiers) org-refile-target-verify-function '(lambda nil (not (member "ARCHIVE" (org-get-tags)))) org-use-speed-commands t org-mode-hook '(org-clock-load (lambda nil (org-defkey org-mode-map [(control tab)] (quote org-next-link)) (org-defkey org-mode-map [C-S-iso-lefttab] (quote org-previous-link)) (org-defkey org-mode-map [C-c C-/] (quote org-decrypt-entries)) (org-defkey org-mode-map [home] (quote beginning-of-buffer)) (org-defkey org-mode-map [end] (quote end-of-buffer))) #[nil "\300\301\302\303\304$\207" [add-hook before-save-hook org-encrypt-entries nil t] 5] (lambda nil (org-add-hook (quote change-major-mode-hook) (quote org-babel-show-result-all) (quote append) (quote local))) org-babel-result-hide-spec org-babel-hide-all-hashes #[nil "\300\301\302\303\304$\207" [org-add-hook change-major-mode-hook org-show-block-all append local] 5]) org-indirect-buffer-display 'current-window org-cycle-include-plain-lists nil org-agenda-entry-text-maxlines 10 org-agenda-ndays 1 org-refile-targets '((org-agenda-files :maxlevel . 3)) org-ctrl-c-ctrl-c-hook '(org-babel-lob-execute-maybe org-babel-hash-at-point org-babel-execute-src-block-maybe) org-cycle-separator-lines 1 org-return-follows-link t org-confirm-elisp-link-function 'yes-or-no-p org-refile-use-outline-path 'file org-log-into-drawer t org-clock-modeline-total 'today org-agenda-mode-hook '((lambda nil (hl-line-mode 1) (org-defkey org-agenda-mode-map "o" (quote org-agenda-show)) (local-unset-key "a"))) org-agenda-todo-ignore-with-date t org-export-interblocks '((lob org-babel-exp-lob-one-liners) (src org-babel-exp-inline-src-blocks)) org-enforce-todo-dependencies t org-reverse-note-order t org-insert-heading-respect-content t org-occur-hook '(org-first-headline-recenter) org-from-is-user-regexp nil org-yank-adjusted-subtrees t org-outline-path-complete-in-steps nil org-export-preprocess-before-selecting-backend-code-hook '(org-beamer-select-beamer-code) org-agenda-todo-ignore-deadlines t org-modules '(org-bbdb org-bibtex org-docview org-gnus org-info org-jsinfo org-habit org-irc org-mew org-mhe org-rmail org-vm org-wl org-w3m) org-columns-default-format "%TODO %CATEGORY %60ITEM(Task)%5Effort(Estim){:} %5CLOCKSUM(Clock) %SCHEDULED(Time) %DEADLINE" org-remember-templates '(("Regular todo" 114 "* TODO %?\n:LOGBOOK:\n:CREATED:%U\n:END:\n%i\n " "~/projects/notes.org" "Tasks") ("Open Scan todo" 111 "* TODO %?\n:LOGBOOK:\n:CREATED:%U\n:END:\n%i\n " "~/work/openscan/openscan.org" "Miscellaneous non-project tasks") ("todo With clip" 119 "* TODO %?%c\n:LOGBOOK:\n:CREATED:%U\n:END:\n\n%i\n" "~/projects/notes.org" "Tasks") ("bookmarks" 98 "* %c\n%i\n %u" "~/projects/notes.org" "Bookmarks")) org-export-latex-final-hook '(org-beamer-amend-header org-beamer-fix-toc org-beamer-auto-fragile-frames org-beamer-place-default-actions-for-lists) org-metadown-hook '(org-babel-pop-to-session-maybe) org-export-blocks '((src org-babel-exp-src-blocks nil) (comment org-export-blocks-format-comment t) (ditaa org-export-blocks-format-ditaa nil) (dot org-export-blocks-format-dot nil)) )