Re: [Orgmode] Org Remember idea

2008-01-14 Thread Adam Spiers
On Wed, Nov 07, 2007 at 12:29:00PM +, Bastien wrote:
 John Rakestraw [EMAIL PROTECTED] writes:
  When I click on the annotate bookmarklet in firefox pops me into emacs
  (into an already existing buffer) with a message that the link and page
  title are in the kill-ring. Yanking gives me a nice link to the web
  page, with the page title as the link text.

Comments on this old thread:

  1. Bastien, would it be worth adding this to the Worg add-on page?

  2. Rather than having the javascript bookmarklet create a
 annotation://... URL which then invokes a custom handler, would
 another possibility be to have the javascript directly construct
 the link and write it to the clipboard?  Although I see that this
 would require jumping through some other hoops:

   http://kb.mozillazine.org/Granting_JavaScript_access_to_the_clipboard

 and I guess it wouldn't work for remember://... which requires
 more than putting something in the clipboard.

  3. Would gconf be a more browser-agnostic way of handling new
 protocols?  e.g.

   gconftool-2 -s /desktop/gnome/url-handlers/remember/command \
   -t string 'org-annotation-helper %s'


___
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


Re: [Orgmode] Org Remember idea

2007-11-08 Thread John Rakestraw
On Thu, 08 Nov 2007 03:57:40 +
Bastien [EMAIL PROTECTED] wrote:

 I tried to do that.  Here's an updated version of
 org-annotation-helper.

Thanks very much -- it's working nicely for me, and I'm hoping I've
learned enough from your example to rig up something similar that I can
use with claws-mail.

I know you're not reading this until next week, Bastien -- but thanks
for your efforts.

And thanks again to Carsten.

-- 
John Rakestraw


signature.asc
Description: PGP signature
___
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


Re: [Orgmode] Org Remember idea

2007-11-08 Thread John Rakestraw
On Thu, 08 Nov 2007 04:59:09 +
Bastien [EMAIL PROTECTED] wrote:

 Thinking of this again: this is exactly the kind of functionnality
 that could easily be demonstrated in a screencast.  Would you
 consider doing one?  

Yes, I'll do something with this -- either in a screencast or a simple
howto -- once I tweak things a bit more and settle into regular use of
this. It would be a small way to give back to the community.


-- 
John Rakestraw


signature.asc
Description: PGP signature
___
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


Re: [Orgmode] Org Remember idea

2007-11-07 Thread Carsten Dominik


On  6Nov2007, at 5:42 PM, Tim O'Callaghan wrote:


I've started using Remember mode more and more, and it has given me an
idea for new piece of functionality.

%c - insert clipboard/kill-ring at point


Will be in 5.14, thanks.

- Carsten



This is for 'auto' pasting links or snippets of text from my browser
into an org file.

What do you think?

Tim.


___
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




___
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


Re: [Orgmode] Org Remember idea

2007-11-07 Thread Bastien
John Rakestraw [EMAIL PROTECTED] writes:

 When I click on the annotate bookmarklet in firefox pops me into emacs
 (into an already existing buffer) with a message that the link and page
 title are in the kill-ring. Yanking gives me a nice link to the web
 page, with the page title as the link text.

This is all I used myself so far...

 When I click on the remember bookmarklet, I'm taken to my standard
 org-remember template screen asking me to select one of my templates.
 The page link and title don't show up -- can I write a template that
 incorporates this information?

My mistake.  Please replace this

,
| (cond ((equal proto remember)
|(remember (concat \n\n orglink)))
`

by this

,
| (cond ((equal proto remember)
|(org-remember ?f))
`

`?f' being the key for the Org template you want to use.  You will be
able to yank the link from the kill-ring once Carsten has implemented
this functionnality (as %c -- see recent discussion about this.)

Hope this will work correctly...

-- 
Bastien


___
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


Re: [Orgmode] Org Remember idea

2007-11-07 Thread John Rakestraw
On Wed, 07 Nov 2007 12:29:00 +
Bastien [EMAIL PROTECTED] wrote:

 Hope this will work correctly...

Yes, it works great. However, to make the remember function work I had
to add a line to the lisp, so that the relevant section now reads:

(cond ((equal proto remember)
(kill-new orglink) ;; added to put the link in the kill-ring  
(org-remember ?w))
  ((equal proto annotation)
   (message Copied '%s' to the kill-ring. orglink)
   (kill-new orglink))

I don't fully understand why I needed to add the line -- all I know is
that without it the link isn't in the kill-ring when I yank it.

I couple this with this template:

(web-clip ?w * %^{Paste page title/URL}\n %u\n  :PROPERTIES:
\n  :END: \n  %? ~/plans/webclips.org) 

I suspect I'll use this a lot -- thanks for setting it up. (And I
understand that once we have the functionality in the template to yank
the kill-ring to a point indicated by %c it will be simpler still.)

The next question is whether the link and perhaps other bits of
information can be passed as variables instead of via the kill-ring. I
ask because it would be great to block (and perhaps copy) a section of
a web page, click on the bookmarklet, and then see a template with the
link/title and the section of text that I blocked/copied already
entered. Something like this:


* link:[[http://www.nytimes.com/2007/11/07/][A news article]]
  [2007-11-07 Wed]
  :PROPERTIES:
  Here is the text I blocked/copied from the web page. It might be 3 or
  4 sentences, and it might be set off somehow either by quotation
  marks or perhaps a different indent level.

  point is here for any notes I want to add to the entry


I don't know whether others will use this functionality. I confess that
part of my interest stems from my experience with the only program I
miss from my days using windows software -- a program called Zoot
(http://www.zootsoftware.com/). Zoot does many things, but one thing I
really like is that it makes it very easy to store, annotate, and
organize links to web pages. 

-- 
John Rakestraw


signature.asc
Description: PGP signature
___
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


Re: [Orgmode] Org Remember idea

2007-11-07 Thread Bastien
John Rakestraw [EMAIL PROTECTED] writes:

 I ask because it would be great to block (and perhaps copy) a section
 of a web page, click on the bookmarklet, and then see a template with
 the link/title and the section of text that I blocked/copied already
 entered.

I tried to do that.  Here's an updated version of org-annotation-helper.



org-annotation-helper.el
Description: application/emacs-lisp

The template I used is

  (?f * %^{Paste the link}%?\n\n%:region)

The bookmarklet:

  javascript:location.href='remember://' + location.href + '%1C' + \
escape(document.title) + '%1C' + escape(window.getSelection())

This basically add a :region property to the link created by the
bookmarklet, :region containing data from window.getSelection()

 I don't know whether others will use this functionality.

Would be nice to know... I didn't use it a lot myself for now;  I can
put the file somewhere on the web if needed.

-- 
Bastien
___
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


Re: [Orgmode] Org Remember idea

2007-11-07 Thread Bastien
John Rakestraw [EMAIL PROTECTED] writes:

 On Wed, 07 Nov 2007 12:29:00 +
 Bastien [EMAIL PROTECTED] wrote:

 Hope this will work correctly...

 Yes, it works great. 

Thinking of this again: this is exactly the kind of functionnality that
could easily be demonstrated in a screencast.  Would you consider doing
one?  

You might check the xvidcap rpm for your system:

  http://atrpms.net/name/xvidcap/

-- 
Bastien


___
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


Re: [Orgmode] Org Remember idea

2007-11-06 Thread Carsten Dominik


On  6Nov2007, at 5:42 PM, Tim O'Callaghan wrote:


I've started using Remember mode more and more, and it has given me an
idea for new piece of functionality.

%c - insert clipboard/kill-ring at point

This is for 'auto' pasting links or snippets of text from my browser
into an org file.

What do you think?


I think it is a good idea, but may backfire.  The current-kill can be  
HUGE

if you do not watch out.  Maybe limited to a certain lengths?

- Carsten





___
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


Re: [Orgmode] Org Remember idea

2007-11-06 Thread Tim O'Callaghan
On 06/11/2007, Carsten Dominik [EMAIL PROTECTED] wrote:

 On  6Nov2007, at 5:42 PM, Tim O'Callaghan wrote:

  I've started using Remember mode more and more, and it has given me an
  idea for new piece of functionality.
 
  %c - insert clipboard/kill-ring at point
 
  This is for 'auto' pasting links or snippets of text from my browser
  into an org file.
 
  What do you think?

 I think it is a good idea, but may backfire.  The current-kill can be
 HUGE
 if you do not watch out.  Maybe limited to a certain lengths?

 - Carsten


I say dealers choice? a warning if its over 30 lines or so for those
that are new to it? I mean i should know what is in the clipboard
before i hit the remember key.

Another idea that i have been thinking about is 'remember-here'  or
'remember at point' where i can use a remember template to insert in
the current line in the current buffer. Either using the current
remember mode templates or another separate one, it could be argued
either way.

as for terminal vs X, that is quite tricky, but %c could be disabled
in windowing environments.

Tim.


___
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


Re: [Orgmode] Org Remember idea

2007-11-06 Thread Tim O'Callaghan
On 06/11/2007, Tim O'Callaghan [EMAIL PROTECTED] wrote:
 On 06/11/2007, Carsten Dominik [EMAIL PROTECTED] wrote:
 
  On  6Nov2007, at 5:42 PM, Tim O'Callaghan wrote:
 
   I've started using Remember mode more and more, and it has given me an
   idea for new piece of functionality.
  
   %c - insert clipboard/kill-ring at point
  
   This is for 'auto' pasting links or snippets of text from my browser
   into an org file.
  
   What do you think?
 
  I think it is a good idea, but may backfire.  The current-kill can be
  HUGE
  if you do not watch out.  Maybe limited to a certain lengths?
 
  - Carsten
 

 I say dealers choice? a warning if its over 30 lines or so for those
 that are new to it? I mean i should know what is in the clipboard
 before i hit the remember key.

 Another idea that i have been thinking about is 'remember-here'  or
 'remember at point' where i can use a remember template to insert in
 the current line in the current buffer. Either using the current
 remember mode templates or another separate one, it could be argued
 either way.

 as for terminal vs X, that is quite tricky, but %c could be disabled
 in windowing environments.

 Tim.



___
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


Re: [Orgmode] Org Remember idea

2007-11-06 Thread Tim O'Callaghan
sorry - i mean disabled in non-windowing environments.

On 06/11/2007, Tim O'Callaghan [EMAIL PROTECTED] wrote:
 On 06/11/2007, Tim O'Callaghan [EMAIL PROTECTED] wrote:
  On 06/11/2007, Carsten Dominik [EMAIL PROTECTED] wrote:
  
   On  6Nov2007, at 5:42 PM, Tim O'Callaghan wrote:
  
I've started using Remember mode more and more, and it has given me an
idea for new piece of functionality.
   
%c - insert clipboard/kill-ring at point
   
This is for 'auto' pasting links or snippets of text from my browser
into an org file.
   
What do you think?
  
   I think it is a good idea, but may backfire.  The current-kill can be
   HUGE
   if you do not watch out.  Maybe limited to a certain lengths?
  
   - Carsten
  
 
  I say dealers choice? a warning if its over 30 lines or so for those
  that are new to it? I mean i should know what is in the clipboard
  before i hit the remember key.
 
  Another idea that i have been thinking about is 'remember-here'  or
  'remember at point' where i can use a remember template to insert in
  the current line in the current buffer. Either using the current
  remember mode templates or another separate one, it could be argued
  either way.
 
  as for terminal vs X, that is quite tricky, but %c could be disabled
  in windowing environments.
 
  Tim.
 



___
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


Re: [Orgmode] Org Remember idea

2007-11-06 Thread John Rakestraw
 I've started using Remember mode more and more, and it has given me an
 idea for new piece of functionality.
 
 %c - insert clipboard/kill-ring at point
 
 This is for 'auto' pasting links or snippets of text from my browser
 into an org file.
 

I used planner mode for a while before switching to org mode, and still
occasionally look in on planner to see what they're doing. A couple of
weeks ago I stumbled on this in the list planner-el-discuss:

 Ever wanted to create a planner annotation or start remember directly
 from within an external web browser, say Firefox?  Here's how I do it.
 
 I've registered special protocol handlers in the browser,
 remember:// and annotation://.  I've configured these handlers to
 call a script that passes the information to a running Emacs session
 using emacsclient/gnuclient.  The remember/annotation handlers are
 invoked through bookmarklets (bookmarks which execute JavaScript
 code).
 
 The remember:// protocol starts M-x remember with a planner link for
 the current website filled in, using the document title as the
 description of the link, just like planner-w3m does.
 
 The annotation:// protocol handler works similar to
 `planner-annotation-as-kill': it puts a planner link in the kill ring.

I would really like to have something like this for org. The poster
actually included the lisp code, the browser protocols, and the script
that did all this. I know next to nothing about lisp so was unable to
do anything with it, but is it possible that it could be easy for
someone who knows this stuff to adapt it to org?

In hopes that someone will look at it, I've posted the code below.
Apologies for the length of the post.

--John

;;; gjk-planner-annotation-helper.el --- start remember from a web
browser

;; Author: Geert Kloosterman [EMAIL PROTECTED]
;; Created: Sat Nov 19 22:33:18 2005
;; Updated: Thu Oct 25 17:48:41 2007
;; Keywords: planner remember

;;; Commentary:

;; We want to be able to pass a URL and document title directly from a
;; web browser to Emacs.
;;
;; We define a remember:// url handler in the browser and use a shell
;; script to handle the protocol.  This script passes the information
;; to a running Emacs process (using emacsclient/gnuclient).  We use 
;; bookmarklets to create the remember:// urls dynamicly.
;;
;; The protocol types currently recognized are:
;; 
;; remember:// start `remember' with the url and title filled in
;; annotation://   similar to `planner-annotation-as-kill'.
;;
;; The urls used internally will have the following form:
;;
;;   remember://the web page url%1Cthe title
;;
;; The title will be url-hex-encoded.  %1C is the (url-encoded) low
;; ascii value for the field separator.
;;

;; The bookmarklets:
;;
;; javascript:location.href='remember://' + location.href + '%1C' +
escape(document.title) ;; javascript:location.href='annotation://' +
location.href + '%1C' + escape(document.title)

;; The helper script:
;;
;; #!/bin/sh
;; # planner-annotation-helper -- pass a remember-url to emacs
;; #
;; # Author: Geert Kloosterman [EMAIL PROTECTED]
;; # Date: Sat Nov 19 22:33:18 2005
;; 
;; if [ -z $1 ]; then
;; echo $0: Error: no arguments given! 12
;; exit 1
;; fi
;; 
;; # For years I've been using Martin Schwenke's dtemacs script to start
;; # Emacs.  The script uses gnuclient to connect to Emacs and starts a
;; # new Emacs process when necessary.
;; # See http://www.meltin.net/hacks/emacs/
;; #
;; # dtemacs -batch -eval (progn (gjk/planner-annotation-helper
\$1\ ) \\) ;; 
;; # As of Emacs 22 emacsclient will work too
;; emacsclient --eval (progn (gjk/planner-annotation-helper \$1\ )
nil) ;; 
;; # EOF

;; Adding a protocol handler
;; -
;;
;; Firefox
;;
;; To add a protocol handler (eg: remember://) in Firefox, take the
;; following steps:
;;
;; - type in about:config in the location bar
;; - right click, select New -- String
;; - the name should be network.protocol-handler.app.remember 
;; - the value should be the executable, eg.
planner-annotation-helper. ;;   At least under Linux this does not
need to be the full path to ;;   the executable.
;;
;; See http://kb.mozillazine.org/Register_protocol for more details.
;;
;; Opera
;;
;; In Opera add the protocol in the Preferences-Advanced-Programs
;; dialog.


;;; Code:

(autoload 'url-unhex-string url)

(defun gjk/planner-annotation-helper (urlstring)
  Process an externally passed remember:// style url.

URLSTRING consists of a protocol part and a url and title,
separated by %1C.

The protocol types currently recognized are:

remember:// start `remember' with the url and title
annotation://   similar to `planner-annotation-as-kill'.

  (let ((remember-annotation-functions nil))
;; The `parse-url' functions break on the embedded url,
;; since our format is fixed we'll split the url ourselves.
(if (string-match  ^\\([^:]*\\):\\(/*\\)\\(.*\\) urlstring)
  (let* ((proto (match-string 1 urlstring))
(url+title (match-string 

Re: [Orgmode] Org Remember idea

2007-11-06 Thread Adam Spiers
On Tue, Nov 06, 2007 at 05:42:03PM +0100, Tim O'Callaghan wrote:
 I've started using Remember mode more and more, and it has given me an
 idea for new piece of functionality.
 
 %c - insert clipboard/kill-ring at point
 
 This is for 'auto' pasting links or snippets of text from my browser
 into an org file.
 
 What do you think?
 
 Tim.

With the patch I just posted to the concurrent thread concerning
embedding elisp in remember templates, this should easily be achieved
via something like

  %(x-clipboard-yank)

or you could even define a wrapper function `x-clipboard-yank-safely'
which watches out for the case where the clipboard contents are large
and handles the situation accordingly, then use it via

  %(x-clipboard-yank-safely)

Though `%c' is easier to type, of course :-)


___
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


Re: [Orgmode] Org Remember idea

2007-11-06 Thread Bastien
John Rakestraw [EMAIL PROTECTED] writes:

 I used planner mode for a while before switching to org mode, and still
 occasionally look in on planner to see what they're doing. A couple of
 weeks ago I stumbled on this in the list planner-el-discuss:

I had seen this as well and tried to adapt it for Org immediately.  I
didn't post the code here because I'm not using/testing it a lot, but
since others seem interested, here it is.



org-annotation-helper
Description: Binary data


org-annotation-helper.el
Description: application/emacs-lisp

 I would really like to have something like this for org. The poster
 actually included the lisp code, the browser protocols, and the script
 that did all this.

I would summarize the step like this:

1. put org-annotation-helper in a path for executables

2. ~$ chmod +x org-annotation-helper

3. add the Org bookmarklet (right click on Firefox Personnal Toolbar to
   create a bookmark -- see the screenshot)

inline: bookmarklet.png
4. test it!

 In hopes that someone will look at it, I've posted the code below.

Please tell me if the code above is working for you.  As I said, I
didn't test it enough.

-- 
Bastien
___
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


Re: [Orgmode] Org Remember idea

2007-11-06 Thread John Rakestraw
Hi Bastien --

 Please tell me if the code above is working for you.  As I said, I
 didn't test it enough.

Thanks very much for this. I'm not sure that I have it working as you
intended. 

When I click on the annotate bookmarklet in firefox pops me into emacs
(into an already existing buffer) with a message that the link and page
title are in the kill-ring. Yanking gives me a nice link to the web
page, with the page title as the link text.

When I click on the remember bookmarklet, I'm taken to my standard
org-remember template screen asking me to select one of my templates.
The page link and title don't show up -- can I write a template that
incorporates this information?

I fear that I'm just being dense and that there's something obvious
that I'm not seeing. Any hints?

Thanks again.

-- 
John Rakestraw


signature.asc
Description: PGP signature
___
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