Re: [PATCH] Change default ob-python session command to match run-python

2023-12-30 Thread Jack Kamm
Ihor Radchenko  writes:

> Thanks!
> I have several comments.

Thanks for the feedback! I attach a followup patch in response. If all
looks good, I will squash before applying.

>> -(defcustom org-babel-python-command "python"
>> -  "Name of the command for executing Python code."
>> -  :version "24.4"
>> -  :package-version '(Org . "8.0")
>> +(defcustom org-babel-python-command nil
>> +  "Name of the command for interactive and non-interactive Python code.
>> +If set, it overrides `org-babel-python-command-session' and
>> +`org-babel-python-command-nonsession'."
>
> What about default value being 'auto? That would be more explicit.

Sure, I have updated `org-babel-python-command(-session)' to use auto as
default.

> :version tags should not be used when we use :package-version - we drop
> them as we change the defcustom that still has them.

I've dropped the :version tags for the updated variables. I can also
make a separate commit later to drop :version from other ob-python
variables like `org-babel-python-hline-to' and `org-babel-python-None-to'.

> Unless I miss something, it looks like you also allow command arguments,
> not just command name as the value. You may need to adjust the docstring
> to reflect this fact.

I've updated the docstrings to say they are for the command including
arguments.

>>  (defun org-babel-execute:python (body params)
>>"Execute Python BODY according to PARAMS.
>>  This function is called by `org-babel-execute-src-block'."
>> -  (let* ((org-babel-python-command
>> +  (let* ((org-babel-python-command-nonsession
>> +  (or (cdr (assq :python params))
>> +  org-babel-python-command
>> +  org-babel-python-command-nonsession))
>> + (org-babel-python-command-session
>>(or (cdr (assq :python params))
>> -  org-babel-python-command))
>> +  org-babel-python-command
>> +  org-babel-python-command-session))
>
>> @@ -374,7 +407,7 @@ (defun org-babel-python-evaluate-external-process
>>  non-nil, then save graphical results to that file instead."
>>(let ((raw
>>   (pcase result-type
>> -   (`output (org-babel-eval org-babel-python-command
>> +   (`output (org-babel-eval org-babel-python-command-nonsession
>>
>
> I am slightly concerned about
> `org-babel-python-evaluate-external-process' relying upon being called
> from `org-babel-execute:python' that let-binds
> `org-babel-python-nonsession'.
>
> Since `org-babel-python-evaluate-external-process' is a public function,
> it may also be called independently. And it will not obey
> `org-babel-python-command' then.

That's a good catch.

I've fixed this by reverting `org-babel-execute:python' to set
`org-babel-python-command' (not `org-babel-python-command-nonsession').
Then, `org-babel-python-evaluate-external-process' checks both variables
to decide what the command is.

>From 91352d03c897dc546f57f48a14847cc78e74ec85 Mon Sep 17 00:00:00 2001
From: Jack Kamm 
Date: Sat, 30 Dec 2023 20:44:46 -0800
Subject: [PATCH 2/2] Incorporate feedback from Ihor; to be squashed before
 applying

---
 lisp/ob-python.el | 67 ++-
 1 file changed, 37 insertions(+), 30 deletions(-)

diff --git a/lisp/ob-python.el b/lisp/ob-python.el
index 2b17f41fe..5251c3b33 100644
--- a/lisp/ob-python.el
+++ b/lisp/ob-python.el
@@ -46,30 +46,27 @@ (defconst org-babel-header-args:python
 (python . :any))
   "Python-specific header arguments.")
 
-(defcustom org-babel-python-command nil
-  "Name of the command for interactive and non-interactive Python code.
-If set, it overrides `org-babel-python-command-session' and
-`org-babel-python-command-nonsession'."
-  :version "29.2"
+(defcustom org-babel-python-command 'auto
+  "Command (including arguments) for interactive and non-interactive Python code.
+When not `auto', it overrides `org-babel-python-command-session'
+and `org-babel-python-command-nonsession'."
   :package-version '(Org . "9.7")
   :group 'org-babel
-  :type '(choice string (const nil)))
+  :type '(choice string (const auto)))
 
-(defcustom org-babel-python-command-session nil
-  "Name of the command for starting interactive Python sessions.
-If `nil' (the default), uses the values from
+(defcustom org-babel-python-command-session 'auto
+  "Command (including arguments) for starting interactive Python sessions.
+If `auto' (the default), uses the values from
 `python-shell-interpreter' and `python-shell-interpreter-args'.
 If `org-babel-python-command' is set, then it overrides this
 option."
-  :version "29.2"
   :package-version '(Org . "9.7")
   :group 'org-babel
-  :type '(choice string (const nil)))
+  :type '(choice string (const auto)))
 
 (defcustom org-babel-python-command-nonsession "python"
-  "Name of the command for executing non-interactive Python code.
+  "Command (including arguments) for executing non-interactive Python code.
 If `org-babel-python-command' is set, then it overrides this option."
-  

Re: Should org-link-parser add type "file" when link has no "file:" prefix?

2023-12-30 Thread Joseph Turner
Joseph Turner  writes:
> - When handling "file" type links, check if `org-current-uri-scheme'
> matches one of the keys in `org-link-parameters', and use the
> appropriate handler instead of the "file" handler.  (see attached patch
> for an example usage in `org-link-open')

Please ignore the last patch - this one checks for a "file:" prefix.

Joseph

diff --git a/lisp/ol.el b/lisp/ol.el
index 20aab6bb8..947576ddb 100644
--- a/lisp/ol.el
+++ b/lisp/ol.el
@@ -1097,12 +1097,16 @@ (defun org-link-open (link  arg)
   ;; first need to integrate search option, if any.
   ("file"
(let* ((option (org-element-property :search-option link))
-	  (path (if option (concat path "::" option) path)))
-	 (org-link-open-as-file path
-(pcase (org-element-property :application link)
-  ((guard arg) arg)
-  ("emacs" 'emacs)
-  ("sys" 'system)
+	  (path (if option (concat path "::" option) path))
+  (f (org-link-get-parameter org-current-uri-scheme :follow)))
+	 (if (and (not (org-element-property :type-explicit-p link))
+  (functionp f))
+ (funcall f path)
+   (org-link-open-as-file path
+  (pcase (org-element-property :application link)
+((guard arg) arg)
+("emacs" 'emacs)
+("sys" 'system))
   ;; Internal links.
   ((or "coderef" "custom-id" "fuzzy" "radio")
(unless (run-hook-with-args-until-success 'org-open-link-functions path)


Re: Should org-link-parser add type "file" when link has no "file:" prefix?

2023-12-30 Thread Joseph Turner
Ihor Radchenko  writes:

> Joseph Turner  writes:

[...]

> Thanks for reporting!
> Fixed, on main.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=d15e52fef

Thank you for the quick fix!

>> In hyperdrive.el currently, "[[/foobar]]" and "[[file:/foobar]]" have
>> different meanings: a link with no protocol prefix, like "[[/foobar]]",
>> points to a file inside of the same hyperdrive (virtual p2p folder),
>> whereas a link with the "file" protocol prefix, like "[[file:/foobar]]",
>> points to a file on the local filesystem:
>
> I do not recommend such approach. From the point of view of most of the
> Org mode code, it makes no difference whether file link has file: or
> not. So, you may face unexpected issues.

You are certainly right about unexpected issues ;)

> It would be more reliable to provide a separate link type.
> We might even extend the special file+application: link type syntax that
> already allows special behavior for opening file links.

Thank you!  Would you explain about extending file+application syntax?

hyperdrive.el does add a separate "hyper://" link type which is used to
link to a hyperdrive file or directory by its "full" URL:

hyper://aaj45d88g4eenu76rpmwzjiabsof1w8u6fufq6oogyhjk1ubygxy/hyperdrive/hyperdrive-manual.org

Additionally, we want to make it possible for users to copy ("mirror") a
directory of Org mode documents into a hyperdrive for other users to
view and link to.  Ideally, when users upload a set of files to a
hyperdrive, the relative and absolute links between those files within
the same hyperdrive work without modification.

We also wanted users to be able to link to files on the local filesystem
from within a hyperdrive.  Firefox and Chrome treat prefix-less links as
pointers to files on the same webserver and "file:" links as pointers to
files on the filesystem.  We thought that we could do the same thing in
hyperdrive.el: [[/README.org]] could point to a file in the same
hyperdrive while [[file:/README.org]] could point to a local file.

Would you be open to changing Org mode so that prefix-less links could
be handled in a special way by certain modes?  Here's an idea:

- Add a buffer-local variable `org-current-uri-scheme' which could be
set to a string like "hyper".

- When handling "file" type links, check if `org-current-uri-scheme'
matches one of the keys in `org-link-parameters', and use the
appropriate handler instead of the "file" handler.  (see attached patch
for an example usage in `org-link-open')

What do you think?

Thanks!!

Joseph

diff --git a/lisp/ol.el b/lisp/ol.el
index 20aab6bb8..3808b9215 100644
--- a/lisp/ol.el
+++ b/lisp/ol.el
@@ -1097,12 +1097,15 @@ (defun org-link-open (link  arg)
   ;; first need to integrate search option, if any.
   ("file"
(let* ((option (org-element-property :search-option link))
-	  (path (if option (concat path "::" option) path)))
-	 (org-link-open-as-file path
-(pcase (org-element-property :application link)
-  ((guard arg) arg)
-  ("emacs" 'emacs)
-  ("sys" 'system)
+	  (path (if option (concat path "::" option) path))
+  (f (org-link-get-parameter org-current-uri-scheme :follow)))
+	 (if (functionp f)
+ (funcall f path)
+   (org-link-open-as-file path
+  (pcase (org-element-property :application link)
+((guard arg) arg)
+("emacs" 'emacs)
+("sys" 'system))
   ;; Internal links.
   ((or "coderef" "custom-id" "fuzzy" "radio")
(unless (run-hook-with-args-until-success 'org-open-link-functions path)


[PATCH] Fix org-agenda-skip-scheduled-if-deadline-is-shown bug

2023-12-30 Thread Morgan Smith
lisp/org-agenda.el (org-agenda-get-scheduled): Consolidate deadline
fetching code.  Don't check if deadline is shown when
'org-agenda-skip-scheduled-if-deadline-is-shown' has a value of
'repeated-after-deadline'.

Currently when 'org-agenda-skip-scheduled-if-deadline-is-shown' has a
value of 'repeated-after-deadline' then there is no effect.  This is
because when 'org-agenda-get-scheduled' is run on later dates, the
previous deadlines are not put in 'deadline-pos'.
---
 lisp/org-agenda.el | 49 +++---
 1 file changed, 24 insertions(+), 25 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index a1b2f3dc4..df1e8cb7d 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -6606,25 +6606,26 @@ scheduled items with an hour specification like 
[h]h:mm."
  (futureschedp (> schedule today))
  (habitp (and (fboundp 'org-is-habit-p)
(string= "habit" (org-element-property :STYLE 
el
+  (deadline (and (or 
org-agenda-skip-scheduled-delay-if-deadline
+ 
org-agenda-skip-scheduled-if-deadline-is-shown)
+ (when-let ((timestamp (org-element-property 
:deadline el)))
+   (time-to-days
+(org-timestamp-to-time
+ timestamp)
  (suppress-delay
-  (let ((deadline (and 
org-agenda-skip-scheduled-delay-if-deadline
-(org-element-property
- :raw-value
- (org-element-property :deadline 
el)
-(cond
- ((not deadline) nil)
- ;; The current item has a deadline date, so
- ;; evaluate its delay time.
- ((integerp org-agenda-skip-scheduled-delay-if-deadline)
-  ;; Use global delay time.
-  (- org-agenda-skip-scheduled-delay-if-deadline))
- ((eq org-agenda-skip-scheduled-delay-if-deadline
-  'post-deadline)
-  ;; Set delay to no later than DEADLINE.
-  (min (- schedule
-  (org-agenda--timestamp-to-absolute deadline))
-   org-scheduled-delay-days))
- (t 0
+   (cond
+((not (and deadline 
org-agenda-skip-scheduled-delay-if-deadline)) nil)
+;; The current item has a deadline date, so
+;; evaluate its delay time.
+((integerp org-agenda-skip-scheduled-delay-if-deadline)
+ ;; Use global delay time.
+ (- org-agenda-skip-scheduled-delay-if-deadline))
+((eq org-agenda-skip-scheduled-delay-if-deadline
+ 'post-deadline)
+ ;; Set delay to no later than DEADLINE.
+ (min (- schedule deadline)
+  org-scheduled-delay-days))
+(t 0)))
  (ddays
   (cond
;; Nullify delay when a repeater triggered already
@@ -6661,16 +6662,14 @@ scheduled items with an hour specification like 
[h]h:mm."
 ;; doesn't apply to habits.
 (when (pcase org-agenda-skip-scheduled-if-deadline-is-shown
 ((guard
-  (or (not (memq (line-beginning-position 0) deadline-pos))
+  (or (not deadline)
   habitp))
  nil)
 (`repeated-after-deadline
- (let ((deadline (time-to-days
-   (when (org-element-property :deadline 
el)
- (org-time-string-to-time
-  (org-element-interpret-data
-   (org-element-property :deadline 
el)))
-   (and (<= schedule deadline) (> current deadline
+  (and (<= schedule deadline) (> current deadline)))
+ ((guard
+   (not (memq (line-beginning-position 0) deadline-pos)))
+  nil)
 (`not-today pastschedp)
 (`t t)
 (_ nil))
-- 
2.41.0




Month-week and quarter-week datetrees (RFC and package announcement)

2023-12-30 Thread Jack Kamm


I have started a package that defines org-capture datetrees following
year-quarter-week and year-month-week formats:

https://gitlab.com/jackkamm/org-grouped-weektree

I'd appreciate feedback on 2 points:

1. Are any of these datetree formats worth upstreaming into org-mode
   proper?

2. Can we add a public interface for `org-datetree--find-create', and
   are there any suggestions on how to do it?

Regarding #2, an ugly aspect of my current implementation is the abuse
of the private function `org-datetree--find-create'. I also pass in
the week or quarter for the DAY and MONTH arguments of this function,
though I note that `org-datetree-find-iso-week-create' does something
similar in its implementation.



Re: [DISCUSSION] org-capture.el vs remember.el (was: [ELPA] New package: jami-bot and org-jami-bot)

2023-12-30 Thread João Távora
On Sat, Dec 30, 2023 at 7:16 PM João Távora  wrote:

> > On the face of things, remember.el does not comprise a huge amount of
> > code, and I don't see why the above two features couldn't be retrofitted
> > into it.
>
> Seems like the first one could be done with narrowing.
> But would also need some kind of indirect buffer, too,
> right?  How does org-capture.el do it?

Answering myself, with indirect buffers :-)

João



Re: [DISCUSSION] org-capture.el vs remember.el (was: [ELPA] New package: jami-bot and org-jami-bot)

2023-12-30 Thread João Távora
On Sat, Dec 30, 2023 at 5:21 PM Stefan Kangas  wrote:
>
> Ihor Radchenko  writes:
>
> > The refactoring de-coupled what used to be org-remember.el into
> > completely rewritten org-capture.el that added important features that
> > could not be implemented within remember.el framework:
> >
> > 1. org-capture arranges writing the text to remember directly into the
> >target location where it is to be stored. This addressed an important
> >problem of remember.el - remember.el always uses temporary buffer for
> >user input and does not save it until remember-finalize is executed
> >explicitly. A number of users sometimes forgot to call
> >remember-finalize, leading to annoying data losses.
> >
> > 2. remember.el only allows a single text input at a time. org-capture
> >makes it possible for users to write multiple notes in parallel.
> >
> > I am wondering if it would be possible to have the above two key
> > features supported by remember.el. Then, org-capture.el could go back to
> > re-using remember.el infrastructure and thus reduce code duplication.
>
> This is, of course, desirable.  The real question is how much work it
> will take and who will volunteer to do it.

Not volunteering but those two goals seems good, especially
the first one

> On the face of things, remember.el does not comprise a huge amount of
> code, and I don't see why the above two features couldn't be retrofitted
> into it.

Seems like the first one could be done with narrowing.
But would also need some kind of indirect buffer, too,
right?  How does org-capture.el do it?  It would
also mean "commiting to remember" is just C-x C-s and file
recovery works as normal, which is how it should be IMO.

Maybe after-save-hook in this indirect buffer specifically
would have the effect of quitting the window displaying the
indirect buffer? ... Well I just checked and the hook approach
doesn't work, because save-buffer always saves the base buffer.
But surely some other hook or some remapped key would do the
trick.

If this works (big if since given all this is vapourware), we'll
finally have found good use for indirect buffers :-)

The second one is just multiple such setups, which the
window-management code should in theory already allow.

João



[PATCH] org-babel-demarcate-block: duplicate switches too

2023-12-30 Thread gerard . vermeulen

Hi,

The purpose of this patch is to duplicate switches when 
org-babel-demarcate-block

duplicates headers (meaning point in the source block when demarcating).

Regards -- Gerard

0001-org-babel-demarcate-block-duplicate-switches-too.patch
Description: Binary data


Re: [DISCUSSION] Possible inclusion of org-capture.el into Emacs core (was: [ELPA] New package: jami-bot and org-jami-bot)

2023-12-30 Thread Stefan Kangas
Ihor Radchenko  writes:

> With org-protocol, one can also make Emacs receive data from browser and
> perform any action defined by custom handler function - all fully
> configurable and not necessarily related to Org mode.

I don't have much to add besides giving support to the idea.  It would
be useful.  I'm sure it would find its use in other types of note taking
and productivity systems, of which we have several.



Re: [DISCUSSION] org-capture.el vs remember.el (was: [ELPA] New package: jami-bot and org-jami-bot)

2023-12-30 Thread Stefan Kangas
Ihor Radchenko  writes:

> The refactoring de-coupled what used to be org-remember.el into
> completely rewritten org-capture.el that added important features that
> could not be implemented within remember.el framework:
>
> 1. org-capture arranges writing the text to remember directly into the
>target location where it is to be stored. This addressed an important
>problem of remember.el - remember.el always uses temporary buffer for
>user input and does not save it until remember-finalize is executed
>explicitly. A number of users sometimes forgot to call
>remember-finalize, leading to annoying data losses.
>
> 2. remember.el only allows a single text input at a time. org-capture
>makes it possible for users to write multiple notes in parallel.
>
> I am wondering if it would be possible to have the above two key
> features supported by remember.el. Then, org-capture.el could go back to
> re-using remember.el infrastructure and thus reduce code duplication.

This is, of course, desirable.  The real question is how much work it
will take and who will volunteer to do it.

On the face of things, remember.el does not comprise a huge amount of
code, and I don't see why the above two features couldn't be retrofitted
into it.

Patches welcome.



Re: [PATCH] Change default ob-python session command to match run-python

2023-12-30 Thread Ihor Radchenko
Jack Kamm  writes:

> The attached patch changes the default behavior of ob-python sessions,
> to respect python-shell-interpreter(-args) when starting an interactive
> session.

Thanks!
I have several comments.

> -(defcustom org-babel-python-command "python"
> -  "Name of the command for executing Python code."
> -  :version "24.4"
> -  :package-version '(Org . "8.0")
> +(defcustom org-babel-python-command nil
> +  "Name of the command for interactive and non-interactive Python code.
> +If set, it overrides `org-babel-python-command-session' and
> +`org-babel-python-command-nonsession'."

What about default value being 'auto? That would be more explicit.

> +  :version "29.2"

:version tags should not be used when we use :package-version - we drop
them as we change the defcustom that still has them.
See 15.1 Common Item Keywords section of Elisp manual:

‘:package-version '(PACKAGE . VERSION)’
 This keyword specifies that the item was first introduced in
 PACKAGE version VERSION, or that its meaning or default value was
 changed in that version.  This keyword takes priority over
   
 ‘:version’
 ^^

> +(defcustom org-babel-python-command-session nil
> +  "Name of the command for starting interactive Python sessions.
> +If `nil' (the default), uses the values from
> +`python-shell-interpreter' and `python-shell-interpreter-args'.
> +If `org-babel-python-command' is set, then it overrides this
> +option."
> ...
> +(defcustom org-babel-python-command-nonsession "python"
> +  "Name of the command for executing non-interactive Python code.
> +If `org-babel-python-command' is set, then it overrides this option."

Unless I miss something, it looks like you also allow command arguments,
not just command name as the value. You may need to adjust the docstring
to reflect this fact.

>  (defun org-babel-execute:python (body params)
>"Execute Python BODY according to PARAMS.
>  This function is called by `org-babel-execute-src-block'."
> -  (let* ((org-babel-python-command
> +  (let* ((org-babel-python-command-nonsession
> +   (or (cdr (assq :python params))
> +   org-babel-python-command
> +  org-babel-python-command-nonsession))
> + (org-babel-python-command-session
> (or (cdr (assq :python params))
> -   org-babel-python-command))
> +   org-babel-python-command
> +  org-babel-python-command-session))

> @@ -374,7 +407,7 @@ (defun org-babel-python-evaluate-external-process
>  non-nil, then save graphical results to that file instead."
>(let ((raw
>   (pcase result-type
> -   (`output (org-babel-eval org-babel-python-command
> +   (`output (org-babel-eval org-babel-python-command-nonsession
>

I am slightly concerned about
`org-babel-python-evaluate-external-process' relying upon being called
from `org-babel-execute:python' that let-binds
`org-babel-python-nonsession'.

Since `org-babel-python-evaluate-external-process' is a public function,
it may also be called independently. And it will not obey
`org-babel-python-command' then.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



[DISCUSSION] org-capture.el vs remember.el (was: [ELPA] New package: jami-bot and org-jami-bot)

2023-12-30 Thread Ihor Radchenko


Recent emacs-devel discussion brought up some concerns about org-capture
being very specific to Org mode and not integrated with the rest of
Emacs.

However, org-capture was once built on top of the built-in remember.el
before it was refactored into independent code by Carsten:
https://list.orgmode.org/orgmode/c46f10dc-de51-43d4-affe-f71e440d1...@gmail.com/

The refactoring de-coupled what used to be org-remember.el into
completely rewritten org-capture.el that added important features that
could not be implemented within remember.el framework:

1. org-capture arranges writing the text to remember directly into the
   target location where it is to be stored. This addressed an important
   problem of remember.el - remember.el always uses temporary buffer for
   user input and does not save it until remember-finalize is executed
   explicitly. A number of users sometimes forgot to call
   remember-finalize, leading to annoying data losses.

2. remember.el only allows a single text input at a time. org-capture
   makes it possible for users to write multiple notes in parallel.

I am wondering if it would be possible to have the above two key
features supported by remember.el. Then, org-capture.el could go back to
re-using remember.el infrastructure and thus reduce code duplication.

Richard Stallman  writes:

>   > org-jami-bot builds upon jami-bot and extends it with Org mode capture
>   > functionality for text messages and images.
>
> This feature will be useful.  I am not concretely sure what "capture
> functionality" includes, but if it provides higher-level communication
> between Emacs and Jami, that is a good thing.
>
> At the same time, it seems to be implemented in a way that imposes an
> evitable restriction -- requiring use of Org mode.
>
> Dependence of various features on Org mode causes problems in two ways:
>
> * It makes those features hard to use for those that don't use Org mode.
>
> * It adds the need to learn Org mode to the need to learn Emacs itself.
>
> Therefore, new features which make sense indepdently of Org mode
> should be usable without Org mode.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



[DISCUSSION] Possible inclusion of org-capture.el into Emacs core (was: [ELPA] New package: jami-bot and org-jami-bot)

2023-12-30 Thread Ihor Radchenko
Richard Stallman  writes:

> Dependence of various features on Org mode causes problems in two ways:
>
> * It makes those features hard to use for those that don't use Org mode.
>
> * It adds the need to learn Org mode to the need to learn Emacs itself.
>
> Therefore, new features which make sense indepdently of Org mode
> should be usable without Org mode.

This reminds me of "Keep Org mode submodules in Emacs, please!" request:
https://list.orgmode.org/e1kiph1-0001lu...@fencepost.gnu.org/

Similar to jami-bot providing a dbus interface for Jami to interact with
Emacs, Org mode has org-protocol.el providing command line and URL
handler interface that is nearly independent of Org mode itself in its
core function:

;; Usage:
;; --
;;
;;   1.) Add this to your init file (.emacs probably):
;;
;;   (require 'org-protocol)
;;
;;   3.) Ensure emacs-server is up and running.
;;   4.) Try this from the command line (adjust the URL as needed):
;;
;;   $ emacsclient \
;; 
"org-protocol://store-link?url=http:%2F%2Flocalhost%2Findex.html=The%20title"
;;
;;   5.) Optionally add custom sub-protocols and handlers:
;;
;;   (setq org-protocol-protocol-alist
;; '(("my-protocol"
;;:protocol "my-protocol"
;;:function my-protocol-handler-function)))
;;
;;   A "sub-protocol" will be found in URLs like this:
;;
;;   org-protocol://sub-protocol?key=val=val2
;;
;; If it works, you can now setup other applications for using this feature.

With org-protocol, one can also make Emacs receive data from browser and
perform any action defined by custom handler function - all fully
configurable and not necessarily related to Org mode.

17.16.3 The open-source protocol
... The open-source handler is designed to help with editing local
sources when reading a document.. To that effect, you can use a
bookmark with the following location:

javascript:location.href='org-protocol://open-source?='+
  encodeURIComponent(location.href)

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at