emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Tokuya Kameshima <kames@fa2.so-net.ne.jp>
To: Carsten Dominik <dominik@science.uva.nl>
Cc: kames@fa2.so-net.ne.jp, emacs-orgmode@gnu.org
Subject: Re: Please test links
Date: Wed, 19 Mar 2008 01:20:09 +0900	[thread overview]
Message-ID: <uve3kroli.wl%kames@fa2.so-net.ne.jp> (raw)
In-Reply-To: <5630A0B5-EF80-41AE-B275-51CCB86EC2D8@science.uva.nl>

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

  reply	other threads:[~2008-03-18 16:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-16 14:47 Please test links Tokuya Kameshima
2008-03-17  7:39 ` Carsten Dominik
2008-03-18 16:20   ` Tokuya Kameshima [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=uve3kroli.wl%kames@fa2.so-net.ne.jp \
    --to=kames@fa2.so-net.ne.jp \
    --cc=dominik@science.uva.nl \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).