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

2024-01-01 Thread Ihor Radchenko
Richard Stallman  writes:

> NOTE: Is it absolute;y necessary to cross post to emacs-devel and
> emacs-orgmode?

This branch of the discussion is also about Org mode development. And we
discuss Org mode development in our mailing list. Not all Org mode users
and contributors are subscribed to emacs-devel, so they would miss this
thread if I did not cross-post.

> Could you please explain in a few lines what sort of jobs org-protocol.el 
> does?
> The doc you sent
> ...
>
> describes in a low-level way _how_ to use it, but in order to think
> about that, the first thing I need to know is _what jobs it can do_.

1. Send web pages (urls, page title, text selection) from browser to
   Emacs buffers. This is often used to "bookmark" pages using Emacs.

2. Save web links from browser/command line into Org link kill ring.

3. Locate and open local source of web pages in Emacs.
   For example, when users have a local git clone of Org wiki pages
   (https://orgmode.org/worg/), they can open Org mode file
   corresponding to any Org wiki page opened in browser in Emacs.

All the above can also be done from command line or by invoking system
URI handler - from any application that knows how to open custom URI
schema.

(1) and (2) are specific to Org mode and will be left as a part of Org
package. But the core framework and maybe (3) might be upstreamed.

The above can also be achieved by invoking emacsclient --eval, but
org-protocol (1) makes it safer as only pre-defined Elisp code will be
evaluated, preventing security issues; (2) integrates with OS URI
handlers.

>   > 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.
>
> Could you state a few examples?

In addition to the above 3 examples there are many possibilities.

Say, one can take some proprietary web page like reddit, and make it
open using Emacs reddit frontend.

Or save a quick note right from terminal outside Emacs
emacsclient "org-protocol://capture?title=A quick note for later"

> Also, how is this related to Org mode?  Why call it "org-protocol" rather
> tham some other name?

(1) is using org-capture library to put the received
url/title/annotation into user-defined template and save the filled
template into Org files.

(2) is using `org-store-link' to save url/title as Org mode link.

>   > 17.16.3 The open-source protocol
>   > ... The open-source handler is designed to help with editing local
>   > sources when reading a document..
>
> What document does that come from?

Org mode manual.
You can evaluate (info "(org)Protocols") to get there in Emacs.

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



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

2023-12-31 Thread Richard Stallman
[[[ To any NSA and FBI agents reading my email: please consider]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

NOTE: Is it absolute;y necessary to cross post to emacs-devel and
emacs-orgmode?

  > 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:

Could you please explain in a few lines what sort of jobs org-protocol.el does?
The doc you sent

;;   1.) Add this to your init file (.emacs probably):
;;
;;   (require 'org-protocol)
;;
;;   3.) Ensure emacs-server is up and running.
...

describes in a low-level way _how_ to use it, but in order to think
about that, the first thing I need to know is _what jobs it can do_.

  > 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.

Could you state a few examples?

Also, how is this related to Org mode?  Why call it "org-protocol" rather
tham some other name?

  > 17.16.3 The open-source protocol
  > ... The open-source handler is designed to help with editing local
  > sources when reading a document..

What document does that come from?

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





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

2023-12-31 Thread Richard Stallman
[[[ To any NSA and FBI agents reading my email: please consider]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > 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:

Could you please explain in a few lines what sort of jobs org-protocol.el does?
The doc you sent

;;   1.) Add this to your init file (.emacs probably):
;;
;;   (require 'org-protocol)
;;
;;   3.) Ensure emacs-server is up and running.
...

describes in a low-level way _how_ to use it,
but in order to think about it, the first thing I need to know
is _what it can do_.


-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





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.



[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