all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* org-mac-protocol problem - Initial content missing
@ 2009-08-01 18:59 CHENG Gao
  2009-08-02  8:37 ` Christopher Suckling
  0 siblings, 1 reply; 8+ messages in thread
From: CHENG Gao @ 2009-08-01 18:59 UTC (permalink / raw)
  To: emacs-orgmode


I found "%i" in remember template doesn't work. In remember buffer I
only get link to original page. Initial content is not inserted even
though I selected them, and even I did "Command-c" after the content is
selected.

How could I get content remember instead of link?


-- 
Volo, non valeo

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

* Re: org-mac-protocol problem - Initial content missing
  2009-08-01 18:59 org-mac-protocol problem - Initial content missing CHENG Gao
@ 2009-08-02  8:37 ` Christopher Suckling
  2009-08-02  9:08   ` CHENG Gao
  0 siblings, 1 reply; 8+ messages in thread
From: Christopher Suckling @ 2009-08-02  8:37 UTC (permalink / raw)
  To: CHENG Gao; +Cc: emacs-orgmode

On Sun, 02 Aug 2009 02:59:29 +0800, CHENG Gao <chenggao@gmail.com> wrote:

> I found "%i" in remember template doesn't work. In remember buffer I
> only get link to original page. Initial content is not inserted even
> though I selected them, and even I did "Command-c" after the content is
> selected.
>
> How could I get content remember instead of link?

To be honest, there's not really enough information here to give an
effective answer. Here are two guesses:

1. Initial content is only supported from certain applications - 
currently Safari, Skim, and (to a very limited extent) BibDesk. This is
due to the scope of the applications' AppleScript dictionaries. The
manual for org-mac-protocol provides a table of which applications are
supported by org-mac-protocol.

2. If the remember template or the note template is not creating a
remember buffer at all, the org-mac-protocol.el may not be loading
correctly because org-remember-templates has yet to be defined. I am
about to publish a small change to org-mac-protocol.el and the
documentation that will eliminate this problem.

HTH,

Christopher

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

* Re: org-mac-protocol problem - Initial content missing
  2009-08-02  8:37 ` Christopher Suckling
@ 2009-08-02  9:08   ` CHENG Gao
  2009-08-03  9:09     ` Christopher Suckling
  0 siblings, 1 reply; 8+ messages in thread
From: CHENG Gao @ 2009-08-02  9:08 UTC (permalink / raw)
  To: emacs-orgmode

*On Sun, 02 Aug 2009 10:37:51 +0200
* Also sprach Christopher Suckling <suckling.list@googlemail.com>:

> On Sun, 02 Aug 2009 02:59:29 +0800, CHENG Gao <chenggao@gmail.com> wrote:
>
>> I found "%i" in remember template doesn't work. In remember buffer I
>> only get link to original page. Initial content is not inserted even
>> though I selected them, and even I did "Command-c" after the content is
>> selected.
>>
>> How could I get content remember instead of link?
>
> To be honest, there's not really enough information here to give an
> effective answer. Here are two guesses:
>
> 1. Initial content is only supported from certain applications - 
> currently Safari, Skim, and (to a very limited extent) BibDesk. This is
> due to the scope of the applications' AppleScript dictionaries. The
> manual for org-mac-protocol provides a table of which applications are
> supported by org-mac-protocol.
>
> 2. If the remember template or the note template is not creating a
> remember buffer at all, the org-mac-protocol.el may not be loading
> correctly because org-remember-templates has yet to be defined. I am
> about to publish a small change to org-mac-protocol.el and the
> documentation that will eliminate this problem.
>
> HTH,
>
> Christopher

Thank you for your reply. Sorry I did not give enough information in
previous posting.

I am using Safari. I read the manual, and also read your scripts. I know
which applications are supported.

For example, I visit the page:
http://orgmode.org/worg/org-contrib/org-protocol.php

Then I run org-remember from script menu. The remember buffer I got is:


,----
| ##     C-c C-c  "~/.emacs.d/org/notes.org" -> "* Remember"
| ## C-u C-c C-c  like C-c C-c, and immediately visit note at target location
| ## C-0 C-c C-c  "???" -> "* ???"
| ## C-1 C-c C-c  to select file and header location interactively.
| ## C-2 C-c C-c  as child of the currently clocked item
| ## To switch templates, use `M-x org-remember'.  To abort use `C-c C-k'.
| 
| * 
| 
|   Source: [2009-08-02 Sun], [[http://orgmode.org/worg/org-contrib/org-protocol.php][org-protocol.el – Intercept calls from emacsclient to trigger custom actions:Safari]]
`----

Only timestamp and link to source page.

My settings are:
(I commented out remember template in org-mac-protocol and then put it
in ~/.emacs.d/init.el)

,----
| ;;Org Mode
| (require 'org-mac-protocol)
| (server-start)
| 
| (setq org-directory "~/.emacs.d/org/")
| (setq org-default-notes-file "~/.emacs.d/org/notes.org")
| (setq org-remember-templates nil)
| (add-to-list 'org-remember-templates
| 	     '("AppleScript remember" ?y "* %?\n\n  Source: %u, %c\n\n  %i" (concat org-directory "notes.org") "Remember"))
| (add-to-list 'org-remember-templates
| 	     '("AppleScript note" ?z "* %?\n\n  Source: %u\n" (concat org-directory "notes.org") "Notes"))
| (setq remember-annotation-functions '(org-remember-annotation))
| (setq remember-handler-functions '(org-remember-handler))
| (add-hook 'remember-mode-hook 'org-remember-apply-template)
| 
| (require 'org)
| (define-key global-map "\C-cl" 'org-store-link)
| (define-key global-map "\C-ca" 'org-agenda)
| (setq org-log-done t)
| 
`----

org-mac-protocol runs well, just initial content is not inserted.

BTW, I suggest to put default remember templates in manual, instructing
users to explicitly set templates in .emacs. Users can choose to use
default templates or use their own.



-- 
Totus mundus agit histrionem

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

* Re: Re: org-mac-protocol problem - Initial content missing
  2009-08-02  9:08   ` CHENG Gao
@ 2009-08-03  9:09     ` Christopher Suckling
  2009-08-03  9:33       ` CHENG Gao
                         ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Christopher Suckling @ 2009-08-03  9:09 UTC (permalink / raw)
  To: CHENG Gao; +Cc: emacs-orgmode

On Sun, 02 Aug 2009 17:08:26 +0800, CHENG Gao <chenggao@gmail.com> wrote:

>
> For example, I visit the page:
> http://orgmode.org/worg/org-contrib/org-protocol.php
>
> Then I run org-remember from script menu. The remember buffer I got is:
>
>
> ,----
> | ##     C-c C-c  "~/.emacs.d/org/notes.org" -> "* Remember"
> | ## C-u C-c C-c  like C-c C-c, and immediately visit note at target location
> | ## C-0 C-c C-c  "???" -> "* ???"
> | ## C-1 C-c C-c  to select file and header location interactively.
> | ## C-2 C-c C-c  as child of the currently clocked item
> | ## To switch templates, use `M-x org-remember'.  To abort use `C-c C-k'.
> | 
> | * 
> | 
> |   Source: [2009-08-02 Sun], [[http://orgmode.org/worg/org-contrib/org-protocol.php][org-protocol.el – Intercept calls from emacsclient to trigger custom actions:Safari]]
> `----
>
> Only timestamp and link to source page.
>
> My settings are:
> (I commented out remember template in org-mac-protocol and then put it
> in ~/.emacs.d/init.el)
>
> ,----
> | ;;Org Mode
> | (require 'org-mac-protocol)
> | (server-start)
> | 
> | (setq org-directory "~/.emacs.d/org/")
> | (setq org-default-notes-file "~/.emacs.d/org/notes.org")
> | (setq org-remember-templates nil)
> | (add-to-list 'org-remember-templates
> | 	     '("AppleScript remember" ?y "* %?\n\n  Source: %u, %c\n\n  %i" (concat org-directory "notes.org") "Remember"))
> | (add-to-list 'org-remember-templates
> | 	     '("AppleScript note" ?z "* %?\n\n  Source: %u\n" (concat org-directory "notes.org") "Notes"))
> | (setq remember-annotation-functions '(org-remember-annotation))
> | (setq remember-handler-functions '(org-remember-handler))
> | (add-hook 'remember-mode-hook 'org-remember-apply-template)
> | 
> | (require 'org)
> | (define-key global-map "\C-cl" 'org-store-link)
> | (define-key global-map "\C-ca" 'org-agenda)
> | (setq org-log-done t)
> | 
> `----
>
> org-mac-protocol runs well, just initial content is not inserted.

I'm stumped. I can't see anything wrong with the above and an almost
identical setup works for me.

(I have come across a couple of web pages that don't like the scripts
full stop, for example http://jan.ucc.nau.edu/tas3/bnf1.html, but that
is not the case here)

Suggested debug:

Make sure that you're using the latest git org-mode.

Open up org-remember.scpt and edit:

,----
| ...
| 
| display dialog theScript
| do shell script theScript
`----

Does theScript contain the expected content?

You could also try running from the terminal:

emacsclient org-protocol:/mac-remember:/y/foo/bar/test%20content:Safari

and seeing whether `test content' is inserted as initial content

> BTW, I suggest to put default remember templates in manual, instructing
> users to explicitly set templates in .emacs. Users can choose to use
> default templates or use their own.

Quite so. Done.

Christopher

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

* Re: org-mac-protocol problem - Initial content missing
  2009-08-03  9:09     ` Christopher Suckling
@ 2009-08-03  9:33       ` CHENG Gao
  2009-08-03  9:45       ` CHENG Gao
  2009-08-03 12:11       ` CHENG Gao
  2 siblings, 0 replies; 8+ messages in thread
From: CHENG Gao @ 2009-08-03  9:33 UTC (permalink / raw)
  To: emacs-orgmode

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

*On Mon, 03 Aug 2009 11:09:46 +0200
* Also sprach Christopher Suckling <suckling.list@googlemail.com>:

> On Sun, 02 Aug 2009 17:08:26 +0800, CHENG Gao <chenggao@gmail.com> wrote:
>
>>
>> For example, I visit the page:
>> http://orgmode.org/worg/org-contrib/org-protocol.php
>>
>> Then I run org-remember from script menu. The remember buffer I got is:
>>
>>
>> ,----
>> | ##     C-c C-c  "~/.emacs.d/org/notes.org" -> "* Remember"
>> | ## C-u C-c C-c  like C-c C-c, and immediately visit note at target location
>> | ## C-0 C-c C-c  "???" -> "* ???"
>> | ## C-1 C-c C-c  to select file and header location interactively.
>> | ## C-2 C-c C-c  as child of the currently clocked item
>> | ## To switch templates, use `M-x org-remember'.  To abort use `C-c C-k'.
>> | 
>> | * 
>> | 
>> |   Source: [2009-08-02 Sun], [[http://orgmode.org/worg/org-contrib/org-protocol.php][org-protocol.el – Intercept calls from emacsclient to trigger custom actions:Safari]]
>> `----
>>
>> Only timestamp and link to source page.
>>
>> My settings are:
>> (I commented out remember template in org-mac-protocol and then put it
>> in ~/.emacs.d/init.el)
>>
>> ,----
>> | ;;Org Mode
>> | (require 'org-mac-protocol)
>> | (server-start)
>> | 
>> | (setq org-directory "~/.emacs.d/org/")
>> | (setq org-default-notes-file "~/.emacs.d/org/notes.org")
>> | (setq org-remember-templates nil)
>> | (add-to-list 'org-remember-templates
>> | 	     '("AppleScript remember" ?y "* %?\n\n  Source: %u, %c\n\n  %i" (concat org-directory "notes.org") "Remember"))
>> | (add-to-list 'org-remember-templates
>> | 	     '("AppleScript note" ?z "* %?\n\n  Source: %u\n" (concat org-directory "notes.org") "Notes"))
>> | (setq remember-annotation-functions '(org-remember-annotation))
>> | (setq remember-handler-functions '(org-remember-handler))
>> | (add-hook 'remember-mode-hook 'org-remember-apply-template)
>> | 
>> | (require 'org)
>> | (define-key global-map "\C-cl" 'org-store-link)
>> | (define-key global-map "\C-ca" 'org-agenda)
>> | (setq org-log-done t)
>> | 
>> `----
>>
>> org-mac-protocol runs well, just initial content is not inserted.
>
> I'm stumped. I can't see anything wrong with the above and an almost
> identical setup works for me.
>
> (I have come across a couple of web pages that don't like the scripts
> full stop, for example http://jan.ucc.nau.edu/tas3/bnf1.html, but that
> is not the case here)
>
> Suggested debug:
>
> Make sure that you're using the latest git org-mode.
>
> Open up org-remember.scpt and edit:
>
> ,----
> | ...
> | 
> | display dialog theScript
> | do shell script theScript
> `----
>
> Does theScript contain the expected content?
>
> You could also try running from the terminal:
>
> emacsclient org-protocol:/mac-remember:/y/foo/bar/test%20content:Safari
>
> and seeing whether `test content' is inserted as initial content
>
>> BTW, I suggest to put default remember templates in manual, instructing
>> users to explicitly set templates in .emacs. Users can choose to use
>> default templates or use their own.
>
> Quite so. Done.
>
> Christopher

Thank you for your reply.

I edited the script to turn on dialog. I can see content is not shown.
Please see attached screenshot. Testing page is
http://orgmode.org/worg/org-contrib/org-protocol.php.


And I run "emacsclient
org-protocol:/mac-remember:/y/foo/bar/test%20content:Safari" and got:

,----
| ##     C-c C-c  "~/.emacs.d/org/notes.org" -> "* Remember"
| ## C-u C-c C-c  like C-c C-c, and immediately visit note at target location
| ## C-0 C-c C-c  "???" -> "* ???"
| ## C-1 C-c C-c  to select file and header location interactively.
| ## C-2 C-c C-c  as child of the currently clocked item
| ## To switch templates, use `M-x org-remember'.  To abort use `C-c C-k'.
| 
| * 
| 
|   Source: [2009-08-03 Mon], [[foo][bar]]
| 
|   
`----
"test content" is not shown.

I use Emacs built from git source:

,----
| GNU Emacs 23.1.50.1 (i386-apple-darwin9.7.0, NS apple-appkit-949.46)
|  of 2009-07-28
`----

I suppose Org Mode contained is fairly latest.
I tried to build git source of Org Mode and failed with error message
as:

,----
| In toplevel form:
| lisp/org-ascii.el:29:1:Error: Symbol's function definition is void: backup-inhibited
| make: *** [lisp/org-ascii.elc] Error 1
`----

It it's important, I installed command line only Emacs 23.1 to
/usr/local, and Org build picked it up.

So I see see nothing I did wrong. 


[-- Attachment #2: Picture 14.jpg --]
[-- Type: image/jpeg, Size: 41194 bytes --]

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


-- 
The enemies of Freedom do not argue; they shout and they shoot.

[-- Attachment #4: 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] 8+ messages in thread

* Re: org-mac-protocol problem - Initial content missing
  2009-08-03  9:09     ` Christopher Suckling
  2009-08-03  9:33       ` CHENG Gao
@ 2009-08-03  9:45       ` CHENG Gao
  2009-08-03 10:10         ` CHENG Gao
  2009-08-03 12:11       ` CHENG Gao
  2 siblings, 1 reply; 8+ messages in thread
From: CHENG Gao @ 2009-08-03  9:45 UTC (permalink / raw)
  To: emacs-orgmode


Sorry I posted previous message too fast. I forgot to select some texts
while testing. I confirm the dialog shows the content, but *Remember*
buffer does not.


-- 
Volo, non valeo

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

* Re: org-mac-protocol problem - Initial content missing
  2009-08-03  9:45       ` CHENG Gao
@ 2009-08-03 10:10         ` CHENG Gao
  0 siblings, 0 replies; 8+ messages in thread
From: CHENG Gao @ 2009-08-03 10:10 UTC (permalink / raw)
  To: emacs-orgmode

Things are getting complicated.

I added "display dialog the Script" to org-remember.scpt. Now when I
select some text and  run
org-remeber script, I can see content is shown in dialog. But after I
press OK button, nothing happens. Seems emacsclient can not be
triggered.

If I dont select any text and run org-remember script, it works
correctly. *Remember* buffer shows date and link.

So I guess there could be something wrong with URIEscape of the content.

I'll uninstalled org-mac-protol and restart from the scratch to check if
there is anything wrong with my installation. Though I suppose there is
nothing wrong, since I only added one line to org-remember.scpt.


-- 
Totus mundus agit histrionem

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

* Re: org-mac-protocol problem - Initial content missing
  2009-08-03  9:09     ` Christopher Suckling
  2009-08-03  9:33       ` CHENG Gao
  2009-08-03  9:45       ` CHENG Gao
@ 2009-08-03 12:11       ` CHENG Gao
  2 siblings, 0 replies; 8+ messages in thread
From: CHENG Gao @ 2009-08-03 12:11 UTC (permalink / raw)
  To: emacs-orgmode


Org git source is just fixed, and I installed Org from git source, and
it works terrificly well. So the culprit is Org Mode bundled with Emacs
TRUNK.

Thank you very much for this great package, and for your help.

-- 
Vivere est cogitare

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

end of thread, other threads:[~2009-08-03 12:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-01 18:59 org-mac-protocol problem - Initial content missing CHENG Gao
2009-08-02  8:37 ` Christopher Suckling
2009-08-02  9:08   ` CHENG Gao
2009-08-03  9:09     ` Christopher Suckling
2009-08-03  9:33       ` CHENG Gao
2009-08-03  9:45       ` CHENG Gao
2009-08-03 10:10         ` CHENG Gao
2009-08-03 12:11       ` CHENG Gao

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.