all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Please test links
@ 2008-03-15  8:24 Carsten Dominik
  2008-03-15  9:31 ` Leo
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Carsten Dominik @ 2008-03-15  8:24 UTC (permalink / raw)
  To: org-mode mailing list

Hi,

I have been busy and have split out most of the linking code
in org.el into separate files.  As I am not using most of
the link types myself, I would appreciate if people could systematically
test all link types they are using:  The following link types are
in separate files now:

org-bbdb.el
org-gnus.el
org-info.el
org-irc.el
org-mac-message.el
org-mhe.el
org-rmail.el
org-vm.el
org-wl.el


Please report back which of these link types you are using, and
if they are still working after a pull in your it repo.
If not, I'd appreciate detailed backtraces so that this remaining
issues can be fixed.

Thanks!

- Carsten

P.S. if things are really broken, you can always switch back to an
earlier version in the repo, for example using

git checkout release_5.23a

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

* Re: Please test links
  2008-03-15  8:24 Carsten Dominik
@ 2008-03-15  9:31 ` Leo
  2008-03-15 16:36 ` Thomas Baumann
  2008-03-15 19:19 ` Bernt Hansen
  2 siblings, 0 replies; 12+ messages in thread
From: Leo @ 2008-03-15  9:31 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: org-mode mailing list

On 2008-03-15 08:24 +0000, Carsten Dominik wrote:
> Please report back which of these link types you are using, and
> if they are still working after a pull in your it repo.
> If not, I'd appreciate detailed backtraces so that this remaining
> issues can be fixed.

The repo is not on orgmode.org. Where to find it?

-- 
.:  Leo  :.  [ sdl.web AT gmail.com ]  .:  [ GPG Key: 9283AA3F ]  :.

          Use the best OS -- http://www.fedoraproject.org/

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

* Re: Please test links
  2008-03-15  8:24 Carsten Dominik
  2008-03-15  9:31 ` Leo
@ 2008-03-15 16:36 ` Thomas Baumann
  2008-03-15 18:24   ` Carsten Dominik
  2008-03-15 19:19 ` Bernt Hansen
  2 siblings, 1 reply; 12+ messages in thread
From: Thomas Baumann @ 2008-03-15 16:36 UTC (permalink / raw)
  To: emacs-orgmode

Hi Carsten,

I just had a quick look at the following link types

bbdb: works ok both ways

mh-e: links already present work.
setting links is broken and the format of the description is weird

Below is the result from debugging org-mhe-store-link. It seems that the
function is ok, but then the link is stored as "file link".

Cheers
Thomas


Result: mh-folder-mode

Result: t

Result: t
 [3 times]
Result: "Carsten Dominik <dominik@science.uva.nl>"
 [2 times]
Result: "thomas.baumann@ch.tum.de"
 [2 times]
Result: "<E5638AFA-6420-4581-B714-C77FA67FB575@science.uva.nl>"
 [2 times]
Result: "Re: Copyright mh support org-mode "
 [2 times]
Result: "Carsten Dominik <dominik@science.uva.nl>"

Result: "thomas.baumann@ch.tum.de"

Result: "Re: Copyright mh support org-mode "

Result: "<E5638AFA-6420-4581-B714-C77FA67FB575@science.uva.nl>"

Result: (:type "mh" :from "Carsten Dominik <dominik@science.uva.nl>" :to "thomas.baumann@ch.tum.de" :subject "Re: Copyright mh support org-mode " :message-id "<E5638AFA-6420-4581-B714-C77FA67FB575@science.uva.nl>" :fromname "Carsten Dominik" :fromaddress "dominik@science.uva.nl" :toname "thomas baumann" :toaddress "thomas.baumann@ch.tum.de" :fromto "from %f")
 [3 times]
Result: "Email from Carsten Dominik: Re: Copyright mh support org-m"

Result: "Email from Carsten Dominik: Re: Copyright mh support org-m"
 [4 times]
Result: "+iwc"
 [2 times]
Result: "<E5638AFA-6420-4581-B714-C77FA67FB575@science.uva.nl>"

Result: "E5638AFA-6420-4581-B714-C77FA67FB575@science.uva.nl"

Result: "mhe:+iwc#E5638AFA-6420-4581-B714-C77FA67FB575@science.uva.nl"

Result: "mhe:+iwc#E5638AFA-6420-4581-B714-C77FA67FB575@science.uva.nl"
 [2 times]
Result: "mhe:+iwc#E5638AFA-6420-4581-B714-C77FA67FB575@science.uva.nl"

Result: "Email from Carsten Dominik: Re: Copyright mh support org-m"

Result: nil

Result: nil

Result: nil

Stored: file:~/GMXmail/iwc/::11108 t03 14 Carsten Dominik Re Copyright
mh support org mode Apple Mail 1 453904482 Conte

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

* Re: Please test links
  2008-03-15  8:24 Carsten Dominik
  2008-03-15  9:31 ` Leo
  2008-03-15 16:36 ` Thomas Baumann
@ 2008-03-15 19:19 ` Bernt Hansen
  2008-03-15 21:09   ` Bernt Hansen
  2 siblings, 1 reply; 12+ messages in thread
From: Bernt Hansen @ 2008-03-15 19:19 UTC (permalink / raw)
  To: emacs-orgmode

Carsten Dominik <dominik@science.uva.nl> writes:

> Please report back which of these link types you are using, and
> if they are still working after a pull in your it repo.
> If not, I'd appreciate detailed backtraces so that this remaining
> issues can be fixed.

I use bbdb and gnus links.

Attempting to org-store-link in a gnus mail message

Debugger entered--Lisp error: (error "Cannot link to a buffer which is not visiting a file")
  signal(error ("Cannot link to a buffer which is not visiting a file"))
  error("Cannot link to a buffer which is not visiting a file")
  (cond ((run-hook-with-args-until-success ...) (setq link ... desc ...)) ((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 ...) (setq cpltxt ... link ...)) ((and buffer-file-name ...) (setq cpltxt ...) (when ... ...) (if ... ...) (setq link ...)) ((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 (link cpltxt desc description search txt) (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 ... ...) (and link ...)))
  org-store-link(nil)
  call-interactively(org-store-link)
  execute-extended-command(nil)
  call-interactively(execute-extended-command)

Regards,
Bernt

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

* Re: Please test links
  2008-03-15 18:24   ` Carsten Dominik
@ 2008-03-15 20:17     ` Thomas Baumann
  2008-03-15 20:35       ` Carsten Dominik
  2008-03-15 20:26     ` Thomas Baumann
  1 sibling, 1 reply; 12+ messages in thread
From: Thomas Baumann @ 2008-03-15 20:17 UTC (permalink / raw)
  To: emacs-orgmode

quickly installing and learning git....
... and mhe-links still failing

I guess the error comes from 

(defun org-add-link-props (&rest plist)
  "Add these properties to the link property list."
  (let (key value)
    (while plist
      (setq key (pop plist) value (pop plist))
      (setq org-store-link-plist
	    (plist-put org-store-link-plist key value)))))

returning always nil because of (while plist ...

thus

(defun org-mhe-store-link ()
  "Store a link to an MHE folder or message."
  (when (or (equal major-mode 'mh-folder-mode)
	    (equal major-mode 'mh-show-mode))
    (let ((from (org-mhe-get-header "From:"))
	  (to (org-mhe-get-header "To:"))
	  (message-id (org-mhe-get-header "Message-Id:"))
	  (subject (org-mhe-get-header "Subject:"))
	  link desc)
      (org-store-link-props :type "mh" :from from :to to
			    :subject subject :message-id message-id)
      (setq desc (org-email-link-description))
      (setq link (org-make-link "mhe:" (org-mhe-get-message-real-folder) "#"
				(org-remove-angle-brackets message-id)))
      (org-add-link-props :link link :description desc))))

returns nil and therefore org-store-link will not recognize the
successful mhe-link.

Cheers
Thomas

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

* Re: Please test links
  2008-03-15 18:24   ` Carsten Dominik
  2008-03-15 20:17     ` Thomas Baumann
@ 2008-03-15 20:26     ` Thomas Baumann
  1 sibling, 0 replies; 12+ messages in thread
From: Thomas Baumann @ 2008-03-15 20:26 UTC (permalink / raw)
  To: emacs-orgmode

Forgot to add:

(defun org-add-link-props (&rest plist)
  "Add these properties to the link property list."
  (let (key value)
    (while plist
      (setq key (pop plist) value (pop plist))
      (setq org-store-link-plist
	    (plist-put org-store-link-plist key value)))
    t))

does the trick but might be what we call "Jungbauernmethode" :-)

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

* Re: Please test links
  2008-03-15 19:19 ` Bernt Hansen
@ 2008-03-15 21:09   ` Bernt Hansen
  0 siblings, 0 replies; 12+ messages in thread
From: Bernt Hansen @ 2008-03-15 21:09 UTC (permalink / raw)
  To: emacs-orgmode

Bernt Hansen <bernt@norang.ca> writes:

> Carsten Dominik <dominik@science.uva.nl> writes:
>
>> Please report back which of these link types you are using, and
>> if they are still working after a pull in your it repo.
>> If not, I'd appreciate detailed backtraces so that this remaining
>> issues can be fixed.
>
> I use bbdb and gnus links.
>
> Attempting to org-store-link in a gnus mail message
>
> Debugger entered--Lisp error: (error "Cannot link to a buffer which is not visiting a file")
>   signal(error ("Cannot link to a buffer which is not visiting a file"))
>   error("Cannot link to a buffer which is not visiting a file")
>   (cond ((run-hook-with-args-until-success ...) (setq link ... desc ...)) ((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 ...) (setq cpltxt ... link ...)) ((and buffer-file-name ...) (setq cpltxt ...) (when ... ...) (if ... ...) (setq link ...)) ((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 (link cpltxt desc description search txt) (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 ... ...) (and link ...)))
>   org-store-link(nil)
>   call-interactively(org-store-link)
>   execute-extended-command(nil)
>   call-interactively(execute-extended-command)

This works now.  Thanks.

-Bernt

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

* Re: Please test links
  2008-03-15 20:35       ` Carsten Dominik
@ 2008-03-16  7:01         ` Thomas Baumann
  0 siblings, 0 replies; 12+ messages in thread
From: Thomas Baumann @ 2008-03-16  7:01 UTC (permalink / raw)
  To: emacs-orgmode

tested ok:

mhe,
bbdb,
info

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

* Re: Please test links
@ 2008-03-16 14:47 Tokuya Kameshima
  2008-03-17  7:39 ` Carsten Dominik
  0 siblings, 1 reply; 12+ messages in thread
From: Tokuya Kameshima @ 2008-03-16 14:47 UTC (permalink / raw)
  To: Carsten Dominik, emacs-orgmode; +Cc: kames

Hi Carsten,

I checked org-wl.el and it works fine.

BTW, I have another implementation of org-wl.el.  Is it possible to
merge my version to the git?

The differences between git version and mine are:

- Integrated `org-wl-open' function into `org-wl-open'.
- org-wl-store-link: If the message on the cursor line is marked as
  refile ("o"), set the link's folder to the refile destionation
  folder.  I prefer this behavior since I read the email in the inbox
  folder, set the refile mark, and create TODO task using remember
  package from the email before performing the refile operation.
  After I create tasks, I execute the refile.
- Fixed "To:" field extraction problem where the function
  `elmo-message-entity-field' returns a string or a list of strings.
- org-wl-open: Added a workaround for `wl-folder-goto-folder-subr',
  which moves point to the beginning of the current line in the old
  folder.

Thanks,
--Tokuya

> From: Carsten Dominik <dominik <at> science.uva.nl>
> Subject: Re: Re: Please test links
> Newsgroups: gmane.emacs.orgmode
> Date: 2008-03-15 20:35:49 GMT (17 hours and 38 minutes ago)
> 
> At least we got you to learn git! :-)
> 
> Thanks for the analysis, I have fixed this problem for all link
> packages, thanks a lot!!!
> 
> Please, everyone, git it another shot.
> 
> Ahh, I don't know what I would do without all this help.
> 
> - Carsten

\f
;;; org-wl.el - Support for links to Wanderlust messages in Org-mode

;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.

;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
;; Version: 1.0
;;
;; This file is part of GNU Emacs.
;;
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:

;; This file implements links to Wanderlust messages for Org-mode.
;; Org-mode loads this module by default - if this is not what you want,
;; configure the variable `org-modules'.

(require 'org)

;; Declare external functions and variables
(declare-function elmo-folder-exists-p "ext:elmo" (folder) t)
(declare-function elmo-message-entity-field "ext:elmo-msgdb"
		  (entity field &optional type))
(declare-function elmo-message-field "ext:elmo"
		  (folder number field &optional type) t)
(declare-function elmo-msgdb-overview-get-entity "ext:elmo" (&rest unknown) t)
;; Backward compatibility to old version of wl
(declare-function wl-summary-buffer-msgdb "ext:wl-folder" (&rest unknown) t)
(declare-function wl-folder-get-elmo-folder "ext:wl-folder"
		  (entity &optional no-cache))
(declare-function wl-summary-goto-folder-subr "ext:wl-summary"
		  (&optional name scan-type other-window sticky interactive
			     scoring force-exit))
(declare-function wl-summary-jump-to-msg-by-message-id "ext:wl-summary"
		  (&optional id))
(declare-function wl-summary-line-from "ext:wl-summary" ())
(declare-function wl-summary-line-subject "ext:wl-summary" ())
(declare-function wl-summary-message-number "ext:wl-summary" ())
(declare-function wl-summary-redisplay "ext:wl-summary" (&optional arg))
(defvar wl-summary-buffer-elmo-folder)
(defvar wl-summary-buffer-folder-name)
(defvar wl-summary-buffer-temp-mark-list)

;; Install the link type
(org-add-link-type "wl" 'org-wl-open)
(add-hook 'org-store-link-functions 'org-wl-store-link)

;; Implementation
(defun org-wl-store-link ()
  "Store a link to an WL folder or message."
  (when (eq major-mode 'wl-summary-mode)
    (let* ((msgnum (wl-summary-message-number))
	   (folder-name
	    (let ((elem (assq msgnum wl-summary-buffer-temp-mark-list)))
	      (if (equal (nth 1 elem) "o") ; marked as refile
		  (nth 2 elem)
		wl-summary-buffer-folder-name)))
	   (message-id (elmo-message-field wl-summary-buffer-elmo-folder
					   msgnum 'message-id))
	   (wl-message-entity
	    (if (fboundp 'elmo-message-entity)
		(elmo-message-entity
		 wl-summary-buffer-elmo-folder msgnum)
	      (elmo-msgdb-overview-get-entity
	       msgnum (wl-summary-buffer-msgdb))))
	   (from (wl-summary-line-from))
	   (to (let ((to-field (elmo-message-entity-field wl-message-entity
							  'to)))
		 (if (listp to-field)
		     (car to-field)
		   to-field)))
	   (subject (let (wl-thr-indent-string wl-parent-message-entity)
		      (wl-summary-line-subject)))
	   desc link)
      (org-store-link-props :type "wl" :from from :to to
			    :subject subject :message-id message-id)
      (setq message-id (org-remove-angle-brackets message-id))
      (setq desc (org-email-link-description))
      (setq link (org-make-link "wl:" folder-name
				"#" message-id))
      (org-add-link-props :link link :description desc)
      link)))

(defun org-wl-open (path)
  "Follow an WL message link."
  ;; XXX: The imap-uw's MH folder names start with "%#".
  (if (not (string-match "\\`\\(\\(?:%#\\)?[^#]+\\)\\(#\\(.*\\)\\)?" path))
      (error "Error in Wanderlust link"))
  (let ((folder (match-string 1 path))
	(article (match-string 3 path)))
    (if (not (elmo-folder-exists-p (wl-folder-get-elmo-folder folder)))
	(error "No such folder: %s" folder))
    (let ((old-buf (current-buffer))
	  (old-point (point-marker)))
      (wl-folder-goto-folder-subr folder)
      (save-excursion
	;; XXX: `wl-folder-goto-folder-subr' moves point to the
	;; beginning of the current line.  So, restore the point
	;; in the old buffer.
	(set-buffer old-buf)
	(goto-char old-point))
      (wl-thread-open-all)
      (and (wl-summary-jump-to-msg-by-message-id (org-add-angle-brackets
						  article))
	   (wl-summary-redisplay)))))

(provide 'org-wl)

;;; org-wl.el ends here

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

* Re: Please test links
  2008-03-16 14:47 Please test links Tokuya Kameshima
@ 2008-03-17  7:39 ` Carsten Dominik
  2008-03-18 16:20   ` Tokuya Kameshima
  0 siblings, 1 reply; 12+ messages in thread
From: Carsten Dominik @ 2008-03-17  7:39 UTC (permalink / raw)
  To: Tokuya Kameshima; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1516 bytes --]

Hi Tokuya,

On Mar 16, 2008, at 3:47 PM, Tokuya Kameshima wrote:

> Hi Carsten,
>
> I checked org-wl.el and it works fine.
>
> BTW, I have another implementation of org-wl.el.  Is it possible to
> merge my version to the git?

sounds good to me, I'd be happy to accomodate your changes.

> The differences between git version and mine are:
>
> - Integrated `org-wl-open' function into `org-wl-open'.

What do you really mean here?  That you integrate
org-wl-follow-link into org-wl-open?

Fine.

> - org-wl-store-link: If the message on the cursor line is marked as
>  refile ("o"), set the link's folder to the refile destionation
>  folder.  I prefer this behavior since I read the email in the inbox
>  folder, set the refile mark, and create TODO task using remember
>  package from the email before performing the refile operation.
>  After I create tasks, I execute the refile.

I don't really know wl at all, so I am not sure how other people
use this and if this would change or limit different set-ups.
Maybe this can be made configurable?  Or is this not necessary
because it only does something when the message is marked for
refiling?

Any other wl users want to comment on this?

> - Fixed "To:" field extraction problem where the function
>  `elmo-message-entity-field' returns a string or a list of strings.

Sounds good.

> - org-wl-open: Added a workaround for `wl-folder-goto-folder-subr',
>  which moves point to the beginning of the current line in the old
>  folder.

Sounds good too.

- Carsten

[-- Attachment #1.2: Type: text/html, Size: 2644 bytes --]

[-- Attachment #2: Type: text/plain, Size: 204 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Please test links
  2008-03-17  7:39 ` Carsten Dominik
@ 2008-03-18 16:20   ` Tokuya Kameshima
  2008-03-19  6:57     ` Carsten Dominik
  0 siblings, 1 reply; 12+ messages in thread
From: Tokuya Kameshima @ 2008-03-18 16:20 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: kames, emacs-orgmode

Hi Carsten,

Thank you for the feedback.

On Mon, 17 Mar 2008 08:39:32 +0100,
Carsten Dominik <dominik@science.uva.nl> wrote:
> > - org-wl-store-link: If the message on the cursor line is marked as
> >  refile ("o"), set the link's folder to the refile destionation
> >  folder.  I prefer this behavior since I read the email in the inbox
> >  folder, set the refile mark, and create TODO task using remember
> >  package from the email before performing the refile operation.
> >  After I create tasks, I execute the refile.
> 
> I don't really know wl at all, so I am not sure how other people
> use this and if this would change or limit different set-ups.
> Maybe this can be made configurable?  Or is this not necessary
> because it only does something when the message is marked for
> refiling?

I introduced a variable `org-wl-link-to-refile-destination' to
org-wl.el attached below.  If the variable is set to non-nil,
`org-wl-store-link' creates a link not to the current folder but to
the refile destination if the message is marked as refile.  Otherwise,
it creates a link to the current folder.

Thanks,
--Tokuya

\f
;;; org-wl.el - Support for links to Wanderlust messages in Org-mode

;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.

;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
;; Version: 1.0
;;
;; This file is part of GNU Emacs.
;;
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:

;; This file implements links to Wanderlust messages for Org-mode.
;; Org-mode loads this module by default - if this is not what you want,
;; configure the variable `org-modules'.

(require 'org)

(defgroup org-wl nil
  "Options concerning the Wanderlust link."
  :tag "Org Startup"
  :group 'org-link)

(defcustom org-wl-link-to-refile-destination t
  "Create a link to the refile destination if the message is marked as refile."
  :group 'org-wl
  :type 'boolean)

;; Declare external functions and variables
(declare-function elmo-folder-exists-p "ext:elmo" (folder) t)
(declare-function elmo-message-entity-field "ext:elmo-msgdb"
		  (entity field &optional type))
(declare-function elmo-message-field "ext:elmo"
		  (folder number field &optional type) t)
(declare-function elmo-msgdb-overview-get-entity "ext:elmo" (&rest unknown) t)
;; Backward compatibility to old version of wl
(declare-function wl-summary-buffer-msgdb "ext:wl-folder" (&rest unknown) t)
(declare-function wl-folder-get-elmo-folder "ext:wl-folder"
		  (entity &optional no-cache))
(declare-function wl-summary-goto-folder-subr "ext:wl-summary"
		  (&optional name scan-type other-window sticky interactive
			     scoring force-exit))
(declare-function wl-summary-jump-to-msg-by-message-id "ext:wl-summary"
		  (&optional id))
(declare-function wl-summary-line-from "ext:wl-summary" ())
(declare-function wl-summary-line-subject "ext:wl-summary" ())
(declare-function wl-summary-message-number "ext:wl-summary" ())
(declare-function wl-summary-redisplay "ext:wl-summary" (&optional arg))
(declare-function wl-summary-registered-temp-mark "ext:wl-action" (number))
(defvar wl-summary-buffer-elmo-folder)
(defvar wl-summary-buffer-folder-name)

;; Install the link type
(org-add-link-type "wl" 'org-wl-open)
(add-hook 'org-store-link-functions 'org-wl-store-link)

;; Implementation
(defun org-wl-store-link ()
  "Store a link to an WL folder or message."
  (when (eq major-mode 'wl-summary-mode)
    (let* ((msgnum (wl-summary-message-number))
	   (mark-info (wl-summary-registered-temp-mark msgnum))
	   (folder-name
	    (if (and org-wl-link-to-refile-destination
		     mark-info
		     (equal (nth 1 mark-info) "o")) ; marked as refile
		(nth 2 mark-info)
	      wl-summary-buffer-folder-name))
	   (message-id (elmo-message-field wl-summary-buffer-elmo-folder
					   msgnum 'message-id))
	   (wl-message-entity
	    (if (fboundp 'elmo-message-entity)
		(elmo-message-entity
		 wl-summary-buffer-elmo-folder msgnum)
	      (elmo-msgdb-overview-get-entity
	       msgnum (wl-summary-buffer-msgdb))))
	   (from (wl-summary-line-from))
	   (to (let ((to-field (elmo-message-entity-field wl-message-entity
							  'to)))
		 (if (listp to-field)
		     (car to-field)
		   to-field)))
	   (subject (let (wl-thr-indent-string wl-parent-message-entity)
		      (wl-summary-line-subject)))
	   desc link)
      (org-store-link-props :type "wl" :from from :to to
			    :subject subject :message-id message-id)
      (setq message-id (org-remove-angle-brackets message-id))
      (setq desc (org-email-link-description))
      (setq link (org-make-link "wl:" folder-name
				"#" message-id))
      (org-add-link-props :link link :description desc)
      link)))

(defun org-wl-open (path)
  "Follow an WL message link."
  ;; XXX: The imap-uw's MH folder names start with "%#".
  (if (not (string-match "\\`\\(\\(?:%#\\)?[^#]+\\)\\(#\\(.*\\)\\)?" path))
      (error "Error in Wanderlust link"))
  (let ((folder (match-string 1 path))
	(article (match-string 3 path)))
    (if (not (elmo-folder-exists-p (wl-folder-get-elmo-folder folder)))
	(error "No such folder: %s" folder))
    (let ((old-buf (current-buffer))
	  (old-point (point-marker)))
      (wl-folder-goto-folder-subr folder)
      (save-excursion
	;; XXX: `wl-folder-goto-folder-subr' moves point to the
	;; beginning of the current line.  So, restore the point
	;; in the old buffer.
	(set-buffer old-buf)
	(goto-char old-point))
      (wl-thread-open-all)
      (and (wl-summary-jump-to-msg-by-message-id (org-add-angle-brackets
						  article))
	   (wl-summary-redisplay)))))

(provide 'org-wl)

;;; org-wl.el ends here

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

* Re: Please test links
  2008-03-18 16:20   ` Tokuya Kameshima
@ 2008-03-19  6:57     ` Carsten Dominik
  0 siblings, 0 replies; 12+ messages in thread
From: Carsten Dominik @ 2008-03-19  6:57 UTC (permalink / raw)
  To: Tokuya Kameshima; +Cc: emacs-orgmode

Thanks.

Of no other users of WL comment on this, I will install your changes.
Thanks!

- Carsten

On Mar 18, 2008, at 5:20 PM, Tokuya Kameshima wrote:

> Hi Carsten,
>
> Thank you for the feedback.
>
> On Mon, 17 Mar 2008 08:39:32 +0100,
> Carsten Dominik <dominik@science.uva.nl> wrote:
>>> - org-wl-store-link: If the message on the cursor line is marked as
>>> refile ("o"), set the link's folder to the refile destionation
>>> folder.  I prefer this behavior since I read the email in the inbox
>>> folder, set the refile mark, and create TODO task using remember
>>> package from the email before performing the refile operation.
>>> After I create tasks, I execute the refile.
>>
>> I don't really know wl at all, so I am not sure how other people
>> use this and if this would change or limit different set-ups.
>> Maybe this can be made configurable?  Or is this not necessary
>> because it only does something when the message is marked for
>> refiling?
>
> I introduced a variable `org-wl-link-to-refile-destination' to
> org-wl.el attached below.  If the variable is set to non-nil,
> `org-wl-store-link' creates a link not to the current folder but to
> the refile destination if the message is marked as refile.  Otherwise,
> it creates a link to the current folder.
>
> Thanks,
> --Tokuya
>
>
> ;;; org-wl.el - Support for links to Wanderlust messages in Org-mode
>
> ;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software  
> Foundation, Inc.
>
> ;; Author: Carsten Dominik <carsten at orgmode dot org>
> ;; Keywords: outlines, hypermedia, calendar, wp
> ;; Homepage: http://orgmode.org
> ;; Version: 1.0
> ;;
> ;; This file is part of GNU Emacs.
> ;;
> ;; GNU Emacs is free software; you can redistribute it and/or modify
> ;; it under the terms of the GNU General Public License as published  
> by
> ;; the Free Software Foundation; either version 3, or (at your option)
> ;; any later version.
>
> ;; GNU Emacs is distributed in the hope that it will be useful,
> ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
> ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> ;; GNU General Public License for more details.
>
> ;; You should have received a copy of the GNU General Public License
> ;; along with GNU Emacs; see the file COPYING.  If not, write to the
> ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
> ;; Boston, MA 02110-1301, USA.
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;
> ;;; Commentary:
>
> ;; This file implements links to Wanderlust messages for Org-mode.
> ;; Org-mode loads this module by default - if this is not what you  
> want,
> ;; configure the variable `org-modules'.
>
> (require 'org)
>
> (defgroup org-wl nil
>  "Options concerning the Wanderlust link."
>  :tag "Org Startup"
>  :group 'org-link)
>
> (defcustom org-wl-link-to-refile-destination t
>  "Create a link to the refile destination if the message is marked  
> as refile."
>  :group 'org-wl
>  :type 'boolean)
>
> ;; Declare external functions and variables
> (declare-function elmo-folder-exists-p "ext:elmo" (folder) t)
> (declare-function elmo-message-entity-field "ext:elmo-msgdb"
> 		  (entity field &optional type))
> (declare-function elmo-message-field "ext:elmo"
> 		  (folder number field &optional type) t)
> (declare-function elmo-msgdb-overview-get-entity "ext:elmo" (&rest  
> unknown) t)
> ;; Backward compatibility to old version of wl
> (declare-function wl-summary-buffer-msgdb "ext:wl-folder" (&rest  
> unknown) t)
> (declare-function wl-folder-get-elmo-folder "ext:wl-folder"
> 		  (entity &optional no-cache))
> (declare-function wl-summary-goto-folder-subr "ext:wl-summary"
> 		  (&optional name scan-type other-window sticky interactive
> 			     scoring force-exit))
> (declare-function wl-summary-jump-to-msg-by-message-id "ext:wl- 
> summary"
> 		  (&optional id))
> (declare-function wl-summary-line-from "ext:wl-summary" ())
> (declare-function wl-summary-line-subject "ext:wl-summary" ())
> (declare-function wl-summary-message-number "ext:wl-summary" ())
> (declare-function wl-summary-redisplay "ext:wl-summary" (&optional  
> arg))
> (declare-function wl-summary-registered-temp-mark "ext:wl- 
> action" (number))
> (defvar wl-summary-buffer-elmo-folder)
> (defvar wl-summary-buffer-folder-name)
>
> ;; Install the link type
> (org-add-link-type "wl" 'org-wl-open)
> (add-hook 'org-store-link-functions 'org-wl-store-link)
>
> ;; Implementation
> (defun org-wl-store-link ()
>  "Store a link to an WL folder or message."
>  (when (eq major-mode 'wl-summary-mode)
>    (let* ((msgnum (wl-summary-message-number))
> 	   (mark-info (wl-summary-registered-temp-mark msgnum))
> 	   (folder-name
> 	    (if (and org-wl-link-to-refile-destination
> 		     mark-info
> 		     (equal (nth 1 mark-info) "o")) ; marked as refile
> 		(nth 2 mark-info)
> 	      wl-summary-buffer-folder-name))
> 	   (message-id (elmo-message-field wl-summary-buffer-elmo-folder
> 					   msgnum 'message-id))
> 	   (wl-message-entity
> 	    (if (fboundp 'elmo-message-entity)
> 		(elmo-message-entity
> 		 wl-summary-buffer-elmo-folder msgnum)
> 	      (elmo-msgdb-overview-get-entity
> 	       msgnum (wl-summary-buffer-msgdb))))
> 	   (from (wl-summary-line-from))
> 	   (to (let ((to-field (elmo-message-entity-field wl-message-entity
> 							  'to)))
> 		 (if (listp to-field)
> 		     (car to-field)
> 		   to-field)))
> 	   (subject (let (wl-thr-indent-string wl-parent-message-entity)
> 		      (wl-summary-line-subject)))
> 	   desc link)
>      (org-store-link-props :type "wl" :from from :to to
> 			    :subject subject :message-id message-id)
>      (setq message-id (org-remove-angle-brackets message-id))
>      (setq desc (org-email-link-description))
>      (setq link (org-make-link "wl:" folder-name
> 				"#" message-id))
>      (org-add-link-props :link link :description desc)
>      link)))
>
> (defun org-wl-open (path)
>  "Follow an WL message link."
>  ;; XXX: The imap-uw's MH folder names start with "%#".
>  (if (not (string-match "\\`\\(\\(?:%#\\)?[^#]+\\)\\(#\\(.*\\)\\)?"  
> path))
>      (error "Error in Wanderlust link"))
>  (let ((folder (match-string 1 path))
> 	(article (match-string 3 path)))
>    (if (not (elmo-folder-exists-p (wl-folder-get-elmo-folder folder)))
> 	(error "No such folder: %s" folder))
>    (let ((old-buf (current-buffer))
> 	  (old-point (point-marker)))
>      (wl-folder-goto-folder-subr folder)
>      (save-excursion
> 	;; XXX: `wl-folder-goto-folder-subr' moves point to the
> 	;; beginning of the current line.  So, restore the point
> 	;; in the old buffer.
> 	(set-buffer old-buf)
> 	(goto-char old-point))
>      (wl-thread-open-all)
>      (and (wl-summary-jump-to-msg-by-message-id (org-add-angle- 
> brackets
> 						  article))
> 	   (wl-summary-redisplay)))))
>
> (provide 'org-wl)
>
> ;;; org-wl.el ends here

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

end of thread, other threads:[~2008-03-19  6:57 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-16 14:47 Please test links Tokuya Kameshima
2008-03-17  7:39 ` Carsten Dominik
2008-03-18 16:20   ` Tokuya Kameshima
2008-03-19  6:57     ` Carsten Dominik
  -- strict thread matches above, loose matches on Subject: below --
2008-03-15  8:24 Carsten Dominik
2008-03-15  9:31 ` Leo
2008-03-15 16:36 ` Thomas Baumann
2008-03-15 18:24   ` Carsten Dominik
2008-03-15 20:17     ` Thomas Baumann
2008-03-15 20:35       ` Carsten Dominik
2008-03-16  7:01         ` Thomas Baumann
2008-03-15 20:26     ` Thomas Baumann
2008-03-15 19:19 ` Bernt Hansen
2008-03-15 21:09   ` Bernt Hansen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.