From: Bastien <bzg@altern.org>
To: "Georg C. F. Greve" <greve@fsfeurope.org>
Cc: emacs-orgmode@gnu.org
Subject: Re: Integration of Org mode and mairix
Date: Tue, 07 Aug 2007 19:54:11 +0200 [thread overview]
Message-ID: <87ps1z5iyk.fsf@bzg.ath.cx> (raw)
In-Reply-To: <m3k5sa9tai.fsf@cerebro.fsfeurope.org> (Georg C. F. Greve's message of "Sun\, 05 Aug 2007 12\:20\:37 +0200")
[-- Attachment #1: Type: text/plain, Size: 507 bytes --]
"Georg C. F. Greve" <greve@fsfeurope.org> writes:
> On Sat, 04 Aug 2007 21:44:48 -0400
> Xiao-Yong Jin <xj2106@columbia.edu> wrote:
>
> xj> Perhaps we should actually suggest Carsten build nnir support in
> xj> org-mode and at the same time persuade the maintainer of nnir.el to
> xj> support mairix? ;-)
>
> I think this could be a clean solution to the problem.
Here is a patch against latest org-mode 5.04 as a first attempt of
implementing custom link-types (stored in `org-link-custom-types'.)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org.el_07082007.patch --]
[-- Type: text/x-diff, Size: 3144 bytes --]
diff --git a/org.el b/org.el
index 1fc081e..c139be1 100644
--- a/org.el
+++ b/org.el
@@ -968,6 +968,23 @@ Automatically means, when TAB or RET or C-c C-c are pressed in the line."
The value of this is taken from the #+LINK lines.")
(make-variable-buffer-local 'org-link-abbrev-alist-local)
+(defcustom org-link-custom-types nil
+ "Alist of recognized link types.
+This types are appended to `org-link-types'.
+Each cell is of the form
+
+ \(\"type\" \(follow-function store-function major-mode\)\)
+
+where \"type\" is the string defining the type, follow-function
+is the function that Org will call to follow these links,
+store-function the function that Org will use to store these link
+and major-mode the major mode where it's active."
+ :group 'org-link
+ :type '(repeat (list (string :tag "Type (string) ")
+ (function :tag "Follow function ")
+ (function :tag "Store function ")
+ (function :tag "Active in major mode"))))
+
(defcustom org-link-abbrev-alist nil
"Alist of link abbreviations.
The car of each element is a string, to be replaced at the start of a link.
@@ -4140,8 +4157,11 @@ that will be added to PLIST. Returns the string that was modified."
(require 'font-lock)
(defconst org-non-link-chars "]\t\n\r<>")
-(defconst org-link-types '("http" "https" "ftp" "mailto" "file" "news" "bbdb" "vm"
- "wl" "mhe" "rmail" "gnus" "shell" "info" "elisp"))
+(defconst org-link-types
+ (append (list "http" "https" "ftp" "mailto" "file" "news" "bbdb" "vm"
+ "wl" "mhe" "rmail" "gnus" "shell" "info" "elisp")
+ (delq nil (mapcar (lambda(x) (car x)) org-link-custom-types))))
+
(defconst org-link-re-with-space
(concat
"<?\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
@@ -10410,9 +10430,13 @@ For links to usenet articles, arg negates `org-usenet-links-prefer-google'.
For file links, arg negates `org-context-in-file-links'."
(interactive "P")
(setq org-store-link-plist nil) ; reset
- (let (link cpltxt desc description search txt)
+ (let (link cpltxt desc description search txt cus)
(cond
+ ((setq cus (assq major-mode (mapcar '(lambda(e) (reverse e))
+ org-link-custom-types)))
+ (funcall (nth 1 cus)))
+
((eq major-mode 'bbdb-mode)
(let ((name (bbdb-record-name (bbdb-current-record)))
(company (bbdb-record-getprop (bbdb-current-record) 'company)))
@@ -11006,7 +11030,7 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file."
(org-remove-occur-highlights nil nil t)
(if (org-at-timestamp-p t)
(org-follow-timestamp-link)
- (let (type path link line search (pos (point)))
+ (let (type path link line search (pos (point)) cus)
(catch 'match
(save-excursion
(skip-chars-forward "^]\n\r")
@@ -11177,7 +11201,10 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file."
(message "%s => %s" cmd (eval (read cmd)))
(error "Abort"))))
- (t
+ ((setq cus (assoc type org-link-custom-types))
+ (funcall (nth 1 cus) path))
+
+ (t
(browse-url-at-point)))))
(move-marker org-open-link-marker nil))
[-- Attachment #3: Type: text/plain, Size: 225 bytes --]
It lets you define an alist of custom link-types. See the docstring of
`org-link-custom-types'.
Then you need to define the follow/store functions by yourself. Here are
the defuns I use (in addition to Georg's mairix.el):
[-- Attachment #4: org-mairix.el --]
[-- Type: application/emacs-lisp, Size: 939 bytes --]
[-- Attachment #5: Type: text/plain, Size: 300 bytes --]
I think the nnir.el support could be provided via custom link types,
instead of being hardcoded within org.el.
Please test it and give me feedback!
PS: i started to have a look at nnir.el to make it aware of mairix. But
i'm not sure i'll have time for this till the end of the week.
--
Bastien
[-- Attachment #6: Type: text/plain, Size: 149 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
next prev parent reply other threads:[~2007-08-07 17:54 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-17 19:22 Integration of Org mode and Gnus Georg C. F. Greve
2007-07-18 0:22 ` Jason F. McBrayer
2007-07-18 8:03 ` Georg C. F. Greve
2007-07-18 10:04 ` Bastien
2007-07-18 10:29 ` Georg C. F. Greve
2007-07-20 16:08 ` Integration of Org mode and mairix (was: ... and Gnus) Adam Spiers
2007-07-22 23:15 ` Integration of Org mode and mairix Georg C. F. Greve
2007-07-23 2:24 ` Is it any function similar to appoinment alert in the planner mode? brianjiang
2007-07-23 12:38 ` Bernt Hansen
2007-07-25 19:15 ` Bastien Guerry
2007-07-26 7:23 ` Bastien
2007-07-27 5:17 ` brianjiang
2007-08-07 0:05 ` Bastien
2007-08-07 17:13 ` Bastien
2007-08-21 2:37 ` william
2007-07-24 14:38 ` Integration of Org mode and mairix Bastien
2007-07-30 14:02 ` Georg C. F. Greve
2007-07-30 16:02 ` Bastien
2007-07-30 16:31 ` Leo
2007-07-30 17:26 ` Bastien
2007-08-05 1:32 ` Xiao-Yong Jin
2007-07-31 15:52 ` Jason F. McBrayer
2007-07-31 16:56 ` Xiao-Yong Jin
2007-07-31 17:19 ` Georg C. F. Greve
2007-08-05 1:40 ` Xiao-Yong Jin
2007-07-31 18:43 ` Bastien
2007-08-01 14:52 ` Jason F. McBrayer
2007-08-01 16:59 ` Bastien
2007-08-05 1:44 ` Xiao-Yong Jin
2007-08-05 10:20 ` Georg C. F. Greve
2007-08-07 17:54 ` Bastien [this message]
2007-08-10 6:56 ` Carsten Dominik
2007-08-14 11:29 ` Adam Spiers
2007-08-15 17:46 ` Carsten Dominik
2007-08-21 12:38 ` Carsten Dominik
2007-08-14 22:54 ` Steven Lumos
2007-08-15 17:46 ` Carsten Dominik
2007-08-16 18:48 ` Steven Lumos
2007-09-23 15:44 ` Georg C. F. Greve
2007-09-23 18:12 ` Carsten Dominik
2007-09-23 21:50 ` Georg C. F. Greve
2007-09-23 22:05 ` Carsten Dominik
2007-09-24 17:38 ` Georg C. F. Greve
2007-09-25 14:41 ` Carsten Dominik
2007-09-25 22:25 ` Georg C. F. Greve
2007-09-25 22:38 ` Carsten Dominik
2007-07-18 11:04 ` Integration of Org mode and Gnus Jason F. McBrayer
2007-07-18 12:01 ` Bastien
2007-07-18 12:57 ` Jason F. McBrayer
2007-07-18 13:08 ` Georg C. F. Greve
2007-07-18 15:39 ` Bastien
2007-07-18 19:39 ` Georg C. F. Greve
2007-07-18 22:06 ` Bastien
2007-07-19 15:29 ` Georg C. F. Greve
2007-07-18 21:54 ` Carsten Dominik
2007-07-19 15:41 ` Bastien
2007-07-18 10:20 ` Tassilo Horn
2007-07-18 10:35 ` Georg C. F. Greve
2007-07-18 11:55 ` Tassilo Horn
2007-07-18 12:25 ` Georg C. F. Greve
2007-07-18 12:54 ` Tassilo Horn
2007-07-18 13:18 ` Georg C. F. Greve
2007-07-18 13:32 ` Tassilo Horn
2007-07-18 0:55 ` Bastien
2007-07-18 7:53 ` Georg C. F. Greve
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=87ps1z5iyk.fsf@bzg.ath.cx \
--to=bzg@altern.org \
--cc=emacs-orgmode@gnu.org \
--cc=greve@fsfeurope.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).