all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] add firefox/vimperator support to contrib/lisp/org-mac-link-grabber.el
@ 2010-07-01 15:20 Anthony Lander
  2010-07-01 19:59 ` David Maus
  0 siblings, 1 reply; 6+ messages in thread
From: Anthony Lander @ 2010-07-01 15:20 UTC (permalink / raw)
  To: emacs-orgmode Mode

[-- Attachment #1: Type: text/plain, Size: 205 bytes --]

This patch adds a new option, [v]imperator, to the org-mac-link- 
grabber menu. Use this to grab links from Firefox running the  
Vimperator plugin.

Code by Michael Kohl (http://github.com/citizen428).



[-- Attachment #2: org-mac-link-grabber-vimperator-patch.txt --]
[-- Type: text/plain, Size: 4205 bytes --]

diff --git a/contrib/lisp/org-mac-link-grabber.el b/contrib/lisp/org-mac-link-grabber.el
index bb12204..8ec428b 100644
--- a/contrib/lisp/org-mac-link-grabber.el
+++ b/contrib/lisp/org-mac-link-grabber.el
@@ -4,7 +4,7 @@
 ;; Copyright (c) 2010 Free Software Foundation, Inc.
 ;; 
 ;; Author: Anthony Lander <anthony.lander@gmail.com>
-;; Version: 1.0
+;; Version: 1.0.1
 ;; Keywords: org, mac, hyperlink
 ;;
 ;; This program is free software; you can redistribute it and/or modify
@@ -39,6 +39,7 @@
 ;; Mail.app - grab links to the selected messages in the message list
 ;; AddressBook.app - Grab links to the selected addressbook Cards
 ;; Firefox.app - Grab the url of the frontmost tab in the frontmost window
+;; Vimperator/Firefox.app - Grab the url of the frontmost tab in the frontmost window
 ;; Safari.app - Grab the url of the frontmost tab in the frontmost window
 ;; Google Chrome.app - Grab the url of the frontmost tab in the frontmost window
 ;; Together.app - Grab links to the selected items in the library list
@@ -108,6 +109,12 @@ applications and inserting them in org documents"
   :group 'org-mac-link-grabber
   :type 'boolean)
 
+(defcustom org-mac-grab-Firefox+Vimperator-p nil
+  "Enable menu option [v]imperator to grab links from Firefox.app running the Vimperator plugin"
+  :tag "Grab Vimperator/Firefox.app links"
+  :group 'org-mac-link-grabber
+  :type 'boolean)
+
 (defcustom org-mac-grab-Chrome-app-p t
   "Enable menu option [f]irefox to grab links from Google Chrome.app"
   :tag "Grab Google Chrome.app links"
@@ -129,6 +136,7 @@ applications and inserting them in org documents"
 						("a" "ddressbook" org-mac-addressbook-insert-selected ,org-mac-grab-Addressbook-app-p)
 						("s" "afari" org-mac-safari-insert-frontmost-url ,org-mac-grab-Safari-app-p)
 						("f" "irefox" org-mac-firefox-insert-frontmost-url ,org-mac-grab-Firefox-app-p)
+						("v" "imperator" org-mac-vimperator-insert-frontmost-url ,org-mac-grab-Firefox+Vimperator-p)
 						("c" "hrome" org-mac-chrome-insert-frontmost-url ,org-mac-grab-Chrome-app-p)
 						("t" "ogether" org-mac-together-insert-selected ,org-mac-grab-Together-app-p)))
 		 (menu-string (make-string 0 ?x))
@@ -232,6 +240,51 @@ applications and inserting them in org documents"
   (insert (org-mac-firefox-get-frontmost-url)))
 
 \f
+;; Handle links from Google Firefox.app running the Vimperator extension
+;; Grab the frontmost url from Firefox+Vimperator. Same limitations are
+;; Firefox
+
+(defun as-mac-vimperator-get-frontmost-url ()
+  (let ((result (do-applescript
+					(concat
+					 "set oldClipboard to the clipboard\n"
+					 "set frontmostApplication to path to frontmost application\n"
+					 "tell application \"Firefox\"\n"
+					 "	activate\n"
+					 "	delay 0.15\n"
+					 "	tell application \"System Events\"\n"
+					 "		keystroke \"y\"\n"
+					 "	end tell\n"
+					 "	delay 0.15\n"
+					 "	set theUrl to the clipboard\n"
+					 "	set the clipboard to oldClipboard\n"
+					 "	set theResult to (get theUrl) & \"::split::\" & (get name of window 1)\n"
+					 "end tell\n"
+					 "activate application (frontmostApplication as text)\n"
+					 "set links to {}\n"
+					 "copy theResult to the end of links\n"
+					 "return links as string\n"))))
+    (replace-regexp-in-string "\s+-\s+Vimperator" "" (car (split-string result "[\r\n]+" t)))))
+
+
+(defun org-mac-vimperator-get-frontmost-url ()
+  (interactive)
+  (message "Applescript: Getting Vimperator url...")
+  (let* ((url-and-title (as-mac-vimperator-get-frontmost-url))
+	 (split-link (split-string url-and-title "::split::"))
+	 (URL (car split-link))
+	 (description (cadr split-link))
+	 (org-link))
+    (when (not (string= URL ""))
+      (setq org-link (org-make-link-string URL description)))
+    (kill-new org-link)
+    org-link))
+
+(defun org-mac-vimperator-insert-frontmost-url ()
+  (interactive)
+  (insert (org-mac-vimperator-get-frontmost-url)))
+
+\f
 ;; Handle links from Google Chrome.app
 ;; Grab the frontmost url from Google Chrome. Same limitations are
 ;; Firefox because Chrome doesn't publish an Applescript dictionary

[-- Attachment #3: Type: text/plain, Size: 1 bytes --]



[-- Attachment #4: Type: text/plain, Size: 201 bytes --]

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

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

* Re: [PATCH] add firefox/vimperator support to contrib/lisp/org-mac-link-grabber.el
  2010-07-01 15:20 [PATCH] add firefox/vimperator support to contrib/lisp/org-mac-link-grabber.el Anthony Lander
@ 2010-07-01 19:59 ` David Maus
  2010-07-06  9:19   ` Carsten Dominik
  0 siblings, 1 reply; 6+ messages in thread
From: David Maus @ 2010-07-01 19:59 UTC (permalink / raw)
  To: Anthony Lander; +Cc: emacs-orgmode Mode


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

Anthony Lander wrote:
>This patch adds a new option, [v]imperator, to the org-mac-link-
>grabber menu. Use this to grab links from Firefox running the
>Vimperator plugin.

>Code by Michael Kohl (http://github.com/citizen428).

I'm not sure about this, but the file is

,----
| (C) Copyright (c) 2010 Free Software Foundation, Inc.
`----

and the code is by Michael Kohl who is not on the list of copyrighted
contributors[1] and exceeds the 15-or-so-lines.[2] This would require
Michael to assign copyright to FSF, doesn't it?

  -- David

[1] http://orgmode.org/worg/org-contribute.php#sec-5

[2] http://www.gnu.org/prep/maintain/maintain.html#Legally-Significant
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --]

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

_______________________________________________
Emacs-orgmode mailing list
Please 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] 6+ messages in thread

* Re: [PATCH] add firefox/vimperator support to contrib/lisp/org-mac-link-grabber.el
  2010-07-01 19:59 ` David Maus
@ 2010-07-06  9:19   ` Carsten Dominik
  2010-07-06 11:26     ` Anthony Lander
  0 siblings, 1 reply; 6+ messages in thread
From: Carsten Dominik @ 2010-07-06  9:19 UTC (permalink / raw)
  To: David Maus; +Cc: emacs-orgmode Mode


On Jul 1, 2010, at 9:59 PM, David Maus wrote:

> Anthony Lander wrote:
>> This patch adds a new option, [v]imperator, to the org-mac-link-
>> grabber menu. Use this to grab links from Firefox running the
>> Vimperator plugin.
>
>> Code by Michael Kohl (http://github.com/citizen428).
>
> I'm not sure about this, but the file is
>
> ,----
> | (C) Copyright (c) 2010 Free Software Foundation, Inc.
> `----
>
> and the code is by Michael Kohl who is not on the list of copyrighted
> contributors[1] and exceeds the 15-or-so-lines.[2] This would require
> Michael to assign copyright to FSF, doesn't it?


Yes.  Unless it is 90% cut and paste, with 10% changing small things  
or so.

Also, patchwork has trouble with the patch, I cannot apply it.

- Carsten

>
>  -- David
>
> [1] http://orgmode.org/worg/org-contribute.php#sec-5
>
> [2] http://www.gnu.org/prep/maintain/maintain.html#Legally-Significant
> --
> OpenPGP... 0x99ADB83B5A4478E6
> Jabber.... dmjena@jabber.org
> Email..... dmaus@ictsoc.de
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

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

* Re: [PATCH] add firefox/vimperator support to contrib/lisp/org-mac-link-grabber.el
  2010-07-06  9:19   ` Carsten Dominik
@ 2010-07-06 11:26     ` Anthony Lander
  2010-07-06 11:35       ` Carsten Dominik
  0 siblings, 1 reply; 6+ messages in thread
From: Anthony Lander @ 2010-07-06 11:26 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode Mode


On 10-Jul-6, at 5:19 AM, Carsten Dominik wrote:
>
> Yes.  Unless it is 90% cut and paste, with 10% changing small things  
> or so.
>

It is, in effect, about 8 changed lines within 4 or 5 copy/pasted and  
renamed functions.

> Also, patchwork has trouble with the patch, I cannot apply it.

Is there something I can do to help, Carsten?

   -Anthony

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

* Re: [PATCH] add firefox/vimperator support to contrib/lisp/org-mac-link-grabber.el
  2010-07-06 11:26     ` Anthony Lander
@ 2010-07-06 11:35       ` Carsten Dominik
  2010-07-06 11:48         ` Anthony Lander
  0 siblings, 1 reply; 6+ messages in thread
From: Carsten Dominik @ 2010-07-06 11:35 UTC (permalink / raw)
  To: Anthony Lander; +Cc: emacs-orgmode Mode


On Jul 6, 2010, at 1:26 PM, Anthony Lander wrote:

>
> On 10-Jul-6, at 5:19 AM, Carsten Dominik wrote:
>>
>> Yes.  Unless it is 90% cut and paste, with 10% changing small  
>> things or so.
>>
>
> It is, in effect, about 8 changed lines within 4 or 5 copy/pasted  
> and renamed functions.
>
>> Also, patchwork has trouble with the patch, I cannot apply it.
>
> Is there something I can do to help, Carsten?

Try to resubmit the patch, as an attachment with MIME media type
"text" and subtype "x-patch", "x-diff"[1], or "plain".

Thanks!

- Carsten

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

* Re: [PATCH] add firefox/vimperator support to contrib/lisp/org-mac-link-grabber.el
  2010-07-06 11:35       ` Carsten Dominik
@ 2010-07-06 11:48         ` Anthony Lander
  0 siblings, 0 replies; 6+ messages in thread
From: Anthony Lander @ 2010-07-06 11:48 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode Mode


On 10-Jul-6, at 7:35 AM, Carsten Dominik wrote:
>
> Try to resubmit the patch, as an attachment with MIME media type
> "text" and subtype "x-patch", "x-diff"[1], or "plain".
>

Carsten, the previous submit was text/plain. Here is the MIME header:

--Apple-Mail-38--957295067
Content-Disposition: attachment;
	filename=org-mac-link-grabber-vimperator-patch.txt
Content-Type: text/plain;
	name=org-mac-link-grabber-vimperator-patch.txt;
	x-unix-mode=0644
Content-Transfer-Encoding: quoted-printable

I will try it again, though. This time through Yahoo mail instead of  
Mail.app.

   -Anthony

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

end of thread, other threads:[~2010-07-06 11:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-01 15:20 [PATCH] add firefox/vimperator support to contrib/lisp/org-mac-link-grabber.el Anthony Lander
2010-07-01 19:59 ` David Maus
2010-07-06  9:19   ` Carsten Dominik
2010-07-06 11:26     ` Anthony Lander
2010-07-06 11:35       ` Carsten Dominik
2010-07-06 11:48         ` Anthony Lander

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.